Back-EMF speed detection in motors

Mar 22, 2013 95 Replies

The flyback diode does NOT effect the calculations. There's a subtlety there that _even_I_ overlooked at first ;-)

Could you share your schematic? Privately to me if you prefer. ...Jim Thompson

Not per se. But this sounds kind of like a two terminal R versus 4 terminal R type problem. Is the wiring resistance between the controller and the motor enough to account for this?

?-)

And my mind went ding. I have seen an awful lot of two brush DC motors that have an odd number of commutator segments. Thus most of the time one of the brushes is spanning two segments. It is a thought.

?-)

You should be able to just lump the wiring resistance into the armature resistance.

The clue, I think {;-), is that the offset is at all commands EXCEPT at stall... "stall" I presume means you're running 100% duty cycle, so no flyback diode involved?

That's why I keep asking for a schematic, or at least a command equation... I suspect Vdiode is in your equation, when it doesn't belong. ...Jim Thompson

Well, motors stop behaving linearly at very low RPM, so I'm not sure you can read too much into that. Stick-slip friction and such like.

That doesn't explain the "offset". ...Jim Thompson

No, but it may explain why there is no offset at zero RPM.

The schematic is two half bridges:

power rail --o--- | | fet driver --> FET | o--------- MOTOR -----> other half bridge | fet driver --> FET | current sense --o | .-. | | current sense R '-' | current return -o | --- GND

Current, Im, is sensed with a Kelvin connection from the current sense resistor to an op-amp (to reduce ground issues) to a pair of ADC channels which sample at the center of the lower FET on time. Then the ADC readings are subtracted to get motor current.

Voltage is sensed at the rail, and computed as

Vm = 2 * (1 - rho) * Vsupply,

where rho is the duty cycle from 0 to 1 (50% being off).

Speed is computed as Wm = (Vm - Ra * Im) / k_t

Speed is regulated with a PID loop that commands motor current, motor current is regulated with a PI loop that commands duty cycle. That's lots-o-loops, but it's nicely stable and I have a need to interpose current and speed limits, which fit very nicely into those loops.

The problem is not with the loops, or at least not something overt with the loops -- I can look at the computed speed, and its average matches the commanded speed quite nicely.

Now I'm confused ;-) Where's the offset?

If the "average" speed matches the commanded speed, I don't understand the problem... that's what is should be. Is the ripple confusing your computation?

I've used a full-H-bridge to drive motors, but I use one side to set direction (held low) and PWM the other side... then change direction by swapping side functions. ...Jim Thompson

The average _computed_ speed matches the commanded speed. The computed speed reads about 30RPM high of actual. That's the offset.

That works well if you're mostly driving in one direction or another, but it makes for a hiccup around zero drive. I could do it that way with a few lines of code, but experience has shown that if you're reversing voltage a lot it's not smooth.

(I dunno if the "reversing voltage" concern makes a difference here or not -- I have to admit that banging both half bridges at the same time is a long-time habit.)

A habit I avoid, at least in my video iris controls ;-)

I often independently control all 4 devices in a full-H-bridge... to contain body currents to safe levels. ...Jim Thompson

That's interesting. Is it something that's necessary when you're using discretes, or just an integrated-driver sort of things?

Mostly what I'm doing is driving the H-bridge the way that the microprocessor is set up to do. It's easy enough if you stay within the confines of what the hardware can handle, hard if you go outside of that.

It's not clear to me how you extract Vbemf that way. Maybe it'll register... sometimes I tend toward slow ;-)

I'll behavioral model the situation and play it. ...Jim Thompson

This _is_ a PM motor, right? No field winding, either parallel or in series? ...Jim Thompson

Are you sure you're not getting an effective DC offset as a result of the dead time control of the PWM?

Best regards, Spehro Pefhany

As someone else mentioned, computed speed would be lower by a fixed offset if the a constant brush voltage drop is included in your calculation:

Wm = (Vm - Vbrush - (Ra * Im)) / k_t

Rejected because? (I may have missed some of the discussion on this).

Yup. That _might_ be adding 2 body diode forwards to the "broth" ;-) ...Jim Thompson

Hide quoted text -

Yeah, I know jack about motors, but what about this Tim? For your static measurement what happens if you hold the motor in place and run some current through it?

George H.

Because my computed speed is consistently _high_, in both directions.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required