Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

General questions about motor controllers/drivers/h-bridges

I’ve been trying to learn a lot about motor control as I plan how to implement some robotics ideas I have. I have a ton of questions but to keep this post relatively focused I’ll just ask a few of them…

I’ve been trying to get a handle on the way in which different controllers/drivers implement h-bridge switching. There seem to be a number of schemes for driving the four switches, and I’m having trouble figuring out what the pros and cons of the various methods are (or what method is being used, in some cases).

For instance, look at the Dual MC33926 or MC33887 Motor Driver Carrier. If you hold one of the IN lines high and PWM the other, you alternate between driving and back-EMF braking (if I understand correctly). But if you instead hold the IN lines steady and PWM one of the D lines, you alternate between driving and coasting (right?).

This kind of difference seems to be reflected at a higher level in the control schemes of the various motor controllers. The TReX Jr lets you specify a speed (PWM duty cycle) for both driving and braking. To me this implies that it’s switching between driving and coasting in “drive” mode, and between braking and coasting in “brake” mode (so it must be PWMing one of the D lines). By contrast, the Qik 2s9v1 doesn’t have a separate “brake” mode but does have a “coast” mode. Looking at the TB6612FNG datasheet, this makes sense – it doesn’t seem to support PWMing between drive and high-impedance, only drive and brake.

I guess my question is, does any of this matter? What are the pros and cons of the two schemes, or are they effectively identical for practical purposes? My intuition tells me that in applications where careful speed control is desired (balancing robot?) it might be better to PWM between drive and brake rather than drive and coast – does that make any sense?

Are there energy efficiency (battery life) considerations? What about regenerative braking? There are motor controllers that claim to recharge your battery when braking (I’d link, but you probably know what I’m talking about and it seems kinda rude to link to them on your forum). But I have trouble understanding why almost any H-bridge control scheme wouldn’t pump energy back into the batteries during braking. It’s gotta go somewhere, and it’s either into the battery or lost as heat (in the freewheel diodes?)

Changing topics a bit (because this post isn’t nearly long enough), I have a question about current sensing. It’s not obvious to me how this behaves during PWM – the datasheets only really define the behavior of the current sensing during the “on” phase of PWM. Is the current sensing as implemented by these kinds of drivers (which seem to sense the current of the “currently selected” high-side MOSFET) just useless during PWM, or will it more-or-less accurately reflect the current flowing through my motor? What about during back-EMF braking – can the built-in current sensing monitor the back-EMF induced current?

I have the feeling my questions probably reflect some pretty basic misunderstandings. Hopefully somebody can set me straight :slight_smile: Thanks.

You’re right about MC33926 driver. You can PWM between drive-coast or between drive-brake depending on which line you PWM. Our Jrk 21v3 uses that chip in drive-brake mode.

The current sense pin (FB) on the MC33926 only reports current going through the high-side of the H bridge, so we needed to add a filter to smooth out the signal from that pin to get a good reading, and then (in software) divide by the duty cycle (percentage of time that the high-side is active) to get a real measurement of the current. This worked because the jrk PWMs between a low-low output state and a low-high output state. If you were PWMing between high-high and high-low then I’m not sure how the FB pin would behave, but maybe it would allow you to measure the back-emf during braking.

We generally like drive-brake PWMing better than drive-coast PWMing because the speed of the motor is more linearly related to your duty cycle in drive-brake mode.



I want to point out that you cannot do “regenerative braking” by braking or coasting alone. With low-side braking, for example, the motor generates a current that flows through ground and back into the motor, and the energy is lost to the resistance of the current path (including in the windings of the motor.) When coasting, the motor generates a voltage less than the battery voltage, so it is unable to flow backwards across the FETs to charge the battery.

Drive-brake PWM at a low duty cycle or variable braking (PWM between coast and brake) should allow you to recover some of the energy stored in the motor as it slows down.

If you know of any real-world measurements of how much power can be recovered with different kinds of regenerative braking, I would be interested to see them.


Thanks for the very helpful responses. Also, I just ran across your high-power motor drivers (which I had somehow previously missed). The writeup for these provides a great overview of the various options – I wish I’d encountered it some time ago.

I’m not completely sure I understand this. I guess what I’m lacking is an understanding of what that FB pin is putting out during the low phase of the PWM cycle. During the high phase, FB puts out a current proportional to what’s flowing through the active high-side MOSFET – clear enough. We’re interested in the average (not just high phase) current, so you’re saying we should divide by the duty cycle. But to me this only makes sense if the FB pin continues to source the same current during the low phase of the PWM cycle. Then your smoothed (time-averaged) current from FB is equal to the high phase current, and you must divide by duty cycle to determine the true average current flowing through the high-side MOSFET.

If, instead, the FB pin current goes to zero during the low phase (as the high-side MOSFET current surely does, in your example), isn’t the smoothed current coming out of FB already (effectively) divided by the duty cycle?

I assume that’s a mild rather than very strong preference, since many of your products seem to use drive-coast PWM (as far as I can tell). I guess you probably look for a good balance of features in driver chips without regard to which mode they support. Your MC33926/MC33887 product pages seem to suggest drive-coast PWM (in the “typical application” section) even though drive-brake is supported – is that because the control circuit only requires one PWM output?

I think I understand. During the brake phase, the back-EMF develops a current. You switch to the other phase and dump that current (inductive energy) into the battery. The current decays quickly, but you then build it up again when you switch back to the brake phase.

Well, I’m not really convinced at this point that regenerative braking has a big potential savings for small robots, but this is one of the links that got me wondering about it. I don’t know if I’d call it real-world, exactly, but it is interesting. The problem is that they don’t really tell you what they’re doing.

Anyway, thanks again for the answers. If I can ask a few nuts & bolts kind of questions – I’m looking at your micro metal gearmotors for two things I’d like to work on: a four-wheel drive robot with one motor per wheel, and a balancing robot. Since the prices are the same, I’m leaning toward the HP versions. Any reason why I might not want to? I guess the only downside would be that if I use something like the Qik 2s9v1 to drive them, I’d have to be careful not to stall at 100% PWM?

Do you have any guidance on an appropriate gear ratio for a small balancing robot? At the balance point, I wouldn’t imagine the robot needs a lot of torque to perform small corrections – it seems you’d want quick, linear response and minimal free play in the gearing.

Sorry about the wall 'o text and massive list of questions :frowning:

No, think about it again: the average current coming out of FB is effectively multiplied by the duty cycle (a number between 0 and 1) because it only occurs when the high-side is active. So we have to divide to get a measurement of the current through the motor.


Oops. Yeah, I was thinking of multiplication when you said division. So, the method you outline computes (roughly, of course) the current through the motor during the high phase. This isn’t the same thing as the current over the entire PWM cycle. For current-limiting purposes, wouldn’t the average current be what you care about, rather than the high-phase current? If so, the question is what happens to the current during the low phase…

I guess the idea is that at high enough PWM frequencies, the current keeps flowing in the low phase due to inductance, so the measured current during high-phase is a reasonable approximation to the overall average?

Sorry if I’m being dense here…


Thanks for the link to the graphs supposedly showing the benefits of regenerative braking. It looks like they are making the claim that their method of driving has significant benefits when running the motor at a constant speed. I find it really hard to believe that there is much you can gain when running at a constant speed, and I would bet that the 10% difference that they see comes from other aspects of the driver. For example, their driver runs at a PWM frequency three times higher than the Parallax one.

I think you are considering the right issues for making a balancing robot, but I do not have much to say about the tradeoffs. How big are you planning to make it? I would try to estimate the maximum speed that I need, then get the motors with the highest possible torque that can reach that speed, then make sure that I can get a driver capable of powering them continuously at their stall currents. The torque should tell you something about the maximum angle that it can recover from, so that would give you an idea about whether the overall plan is reasonable.


Ah, that’s a very good way to think about it. Torque doesn’t matter so much near the balance point, but at the farthest excursion from the balance point. Thanks.


There can be somewhat substantial differences at a constant speed, and I think at least some of the advantage shown in the Dimension Engineering graphs are due to the drive/brake drive/coast difference. However, as you can also see from their somewhat limited data, just the motor can make a significant difference, and we do not know what range of duty cycles their data covers. For instance, the two approaches should match up at 100%, which we do not see. If the MOSFETs are not the same (and we know they are not the same in the two drivers they are comparing), you would see a similar difference since we see RPM on the x-axis, not duty cycle. The unit with higher-resistance MOSFETs would have to be driven at a higher duty cycle, so current would be higher for the same RPM, and efficiency would indeed be worse since more energy would be getting lost in the higher-resistance MOSFETs.

I am really skeptical that they have anything other than a “conventional H bridge topology”, and their claim that most “[recirculate] current in the motor during each switching cycle… our solution returns the current to the battery” sound like marketing BS since the current has to keep going through the motor in either case, and most of the data they present on that page probably has no current going back to the battery.

One reason for the drive/brake approach being more efficient is that it does what is called “synchronous rectification”. All of these H-bridges have diodes on them to let the inductive current go somewhere when you switch off the MOSFET(s). If you can turn on the corresponding MOSFET at the right time (the “synchronous” part), you can get that current to flow through the MOSFET body (backwards from the usual direction you’d expect in the MOSFET) instead of through the diode. The diodes can each have a volt drop, whereas the MOSFETs can have more than 10x less, so you can save a substantial amount of power that would otherwise be lost in the diodes.

Anyway, there are a lot of factors that affect what is most efficient and how much that extra efficiency might be. In the context of the small motor drivers we are often working with, it’s usually not as much of a concern as other things like what the other features of the driver are. (For instance, I just don’t know of any chip with performance similar to the VNH2SP30, so if we don’t want to go to a discrete H-bridge, we have to settle for the drive mode it offers.) For higher-power devices, such as our high-power motor drivers, it’s usually easy to do a quick test to see what is most efficient with your particular motor, voltage, PWM frequency, and so on. (And if you can’t easily tell what’s better, it’s not worth worrying about what’s better.)

- Jan