Back-EMF speed detection in motors

Thank you for going to all the trouble to do that (well, if it were me I wouldn't be able to prevent myself -- but thanks anyway).

The current is measured in the middle of the on-time of the lower FETs of the bridge. Because of the way that the processor wants to drive the FETs this happens to be at the same time, but that's probably immaterial (if anything it should help).

To the extent that the current thusly measured is representative (and it certainly double-checks against meter readings pretty well) it does not need to get flipped -- the current read at the - terminal of the motor is subtracted from the current read at the + terminal of the motor, and that's that.

(In theory I could just use one -- with two I get a bit of improved SNR).

It looks like it. Rmotor is calibrated for what works in practice, which should take Rsense into account (Rmotor also visibly changes with temperature, by much more than Rsense).

In operation there is a "drive" variable that ranges from -1 to 1, from which the duty cycle is computed such that -1 drive generates a duty cycle of 100% in the minus direction and +1 drive generates a duty cycle of 100% in the plus direction. Then the drive absolute value is limited to a bit less than 1 so that the charge pumps work correctly and so that the current reading settles before the ADC reads it.

--
Tim Wescott 
Control system and signal processing consulting 
www.wescottdesign.com
Reply to
Tim Wescott
Loading thread data ...

Any problem that I don't see a solution to... drives me nuts. Besides, the wife was attending her annual Easter brunch with a bunch of retired Girl Scout Leaders she's worked with for 40 years, so I was "home alone" ;-)

I've never encountered this sort of problem... my motors haven't had to turn around on the fly, so I was trying to find how a fixed offset could get in there _before_ it happens to me on an actual project.

"Sampling" always bothers me. How much ripple? (Live by digital, die by digital ;-)

How is that done??? Do you mean that one sample is negative, so they, in essence, add?

Charge pumps? Schematic? ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| Phoenix, Arizona  85048    Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

But are they the same the ADC in the microcontroller is measuring?

--
Failure does not prove something is impossible, failure simply 
indicates you are not using the right tools... 
nico@nctdevpuntnl (punt=.) 
--------------------------------------------------------------
Reply to
Nico Coesel

I have verified my Algebraic rendition via simulation, so we're left with two scenarios, (1) Your implementation has a flaw, or (2) We're both missing something in the modeling of the motor, perhaps the brush/commutator overlap??

Time for some lab work >:-} ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| Phoenix, Arizona  85048    Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

I don't have access to IEEE, but this paper may point you in the right direction....

Xplore

IEEE

Modeling of universal motor performance and brush commutation using finite element computed inductance and resistance matrices

formatting link
...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| Phoenix, Arizona  85048    Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

The motor current readings _from the microcontroller_ have been double- checked with a multimeter. So yes, by definition they're the same.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

Clever sampling can save you a lot of grief. 'course, I may be outsmarting myself.

The point of the sampling is to pick the time where the current reading represents the average current in the motor. The current in the motor coils is a sawtooth + DC; sampling in the center of the bottom FET on- time gets you right in the center of the rising segment of the sawtooth, which gets you the average motor current that cycle. (Again, assuming I'm not outsmarting myself).

Yes. When the motor is pulling current in the "+" direction the current on the "+" bottom FET is negative and the current on the "-" bottom FET is positive. So the "subtraction" is really an add.

See the data sheet for the LM5109 -- that's representative. Basically most of the H-bridge gate driver chips out there have a charge pump for the high-side gate, to allow you to use N-channel high-side transistors. When the bottom FET turns on it charges up the boost cap for the high side through a diode; when the driver turns on the top FET it uses that boost cap to supply the gate voltage for the top FET.

It's all very clever, and on a bazzilion different gate driver chips. If there's someone out there doing something different I can't call it to mind.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

That'll be an logarythmic curve, right? what's the time constant?

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

Unless it's a very crappy motor the time constant will be long enough to consider the segment linear. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| Phoenix, Arizona  85048    Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

Tim,

Have you tried replacing the motor with an inductor with a series resistor with similar values to your motor model and measuring the response?

Another test is to lock the motor so it can't rotate and see what the measured RPM is.

it sounds like the current flowing when you are driving the motor is causing an offset in your readings - that won't be there when the motor is stationary.

kevin

Reply to
kevin93

Not true in the presence of losses, and of course, any time you've got current going on a ramp or some other curve, it all goes out the window.

Eddy current losses cause an "instant" jump in current, proportional to the change in voltage, while DCR introduces an L/R time constant, shifting the average-crossing point a little earlier than half. Think of the transformer equivalent model:

. Rdc Lleak . o---RRR----LLL---+--------+ . | | . L Lp R Reddy . L R . | | . o----------------+--------+

Plus (in the case of a transformer proper) whatever secondary load connects across Lp. (Note that Lleak and Lp are divided proportionally, strictly speaking; an L-equivalent circuit like this is only reasonably true for k ~= 1.) In a motor, this might amount to harmonics induced from the finite number of rotor poles and how their exact magnetic profile differs from an ideal circle, but that's all slow-rotatey-stuff that gets averaged and lumped in with DC current (which does most of the real work).

If you sliding-average a pair of "middle" samples (one up, one down), it automatically accounts for the DCR sample error.

I would just as well sample frequently and filter down (takes lots of sampling + DSP), or slow it down analog (a couple analog poles isn't all that fast in response) and sample it at my leisure. Trying to do tricky sample-in-the-middle business is going to get awkward around variable slopes and timing (how do you know you've sampled in the middle of both halves of a 2% or 98% duty cycle waveform, and how is that affected by the sample-and-hold aperture?).

I doubt this is the problem you're having, just... nuts and bolts, eh?

Tim

--
Deep Friar: a very philosophical monk. 
Website: http://seventransistorlabs.com
Reply to
Tim Williams

Took the words out of my mouth. My answer was going to be "very large compared to the PWM frequency".

If there's curve there it's undetectable on an O-scope.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

I considered things like this as potential problems. Pragmatically, though, the current sense line (A) looks nice and flat on the O-scope, except for the wingwazzle right at the bottom FET turn-on, and (B), the microprocessor's current measure matches the multimeter.

Point (B) trumps a lot of other arguments for me.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

There are chips specifically for sensing motor currents in situations like this. Avago has some.

--

John Larkin         Highland Technology, Inc 

jlarkin at highlandtechnology dot com 
http://www.highlandtechnology.com 

Precision electronic instrumentation 
Picosecond-resolution Digital Delay and Pulse generators 
Custom laser drivers and controllers 
Photonics and fiberoptic TTL data links 
VME thermocouple, LVDT, synchro   acquisition and simulation
Reply to
John Larkin

Le Mon, 01 Apr 2013 12:58:25 -0500, Tim Wescott a écrit:

Hmmm... I suppose you have some (1st order?) LPF between the current sampling shunt and the ADC input. With a ramp input that amounts to some delay which translates into a fixed offset at sampling time.

Did you check the order of magnitude?

--
Thanks, 
Fred.
Reply to
Fred Bartoli

Yes. All such filtering is parasitic and minimized as much as I can.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

g

or

in,

ttdesign.com- Hide quoted text -

Seems you should have solved this issue. Have you tried other motors, changed this and that. What's the effect of a bigger external magnetic field? What happens if you hit it with a heat gun, cool spray... (something else)?

George H.

Reply to
George Herold

/ di=

o!

Lithium-Ion == Lipo

Reply to
Greegor

We've kludged in a solution that's satisfactory -- the problem cropped up at the end of the project when the customer is more interested in shipping product than having everything being theoretically perfect, and we had something that would work well enough (this sort of speed control doesn't work well unless your expectations are low at any rate).

I was mostly asking to find out if my customer and I were being insanely picky, if this was one of those "oh yea, that happens all the time" sorts of things, or if I'd invented some new and unique problem that I just wasn't able to find.

It sounds like the last one, unfortunately.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

Probably just because you're trying to "code" an Analog solution ;-)

I've figured out, at least in my head, how to model brushes straddling commutator bars. When I get time to go back to it, I'll simulate that and see if it matters. Two arguers in my head, one says nay, one says yea ;-) ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| Phoenix, Arizona  85048    Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.