Back-EMF speed detection in motors

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

Reply to
Tim Wescott
Loading thread data ...

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.

Reply to
Tim Wescott

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

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

Reply to
Jim Thompson

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

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.

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.

Reply to
Tim Wescott

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

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?

Reply to
Fred Bartoli

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

Reply to
Tim Wescott

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

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.

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

Reply to
Jim Thompson

That's too bad. I've been hoping you'd chime in one day and tell us you'd solved it. In my limited experience if you don't chase down that last unexplained bump or wiggle, then the law of Murphy guarantees that the wiggle will come back and bite you in the future.

(Knock on wood, I don't want to jinx you :^)

George H.

ttdesign.com- Hide quoted text -

Reply to
George Herold

That's why I was hanging in here so intently... so far ;-) my motor drivers were essentially one-sided with a "reverse" switch. So this full-H problem intrigued me... I was hoping for a solution before I'm facing it all by myself ;-) ...Jim Thompson

Reply to
Jim Thompson

Now if i only believed that is where you are sampling. I think you are hitting near the peak. 'Nuff said.

?-)

Reply to
josephkk

PolyTech Forum 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.