Part 3

Update: I’m working on a new, much updated version of this series. I’ll keep these pages around while that work is still in progress, but please check out the new pages for the latest information.


In most applications, simply driving the motor is not enough. In many cases the goal is to drive the motor at a specified speed. For that a control loop has to be established and of course for that to work the actual shaft-speed has to be measured. There are many ways to measure the shaft-speed, some of the popular ones are using a quadrature encoder wheel or a tachometer. The first one generates two series of pulses, where the relative phase of one to the other depends on the direction of the rotation, while the frequency of the pulses relate to the speed of the rotation. Tachometers are pretty much special dynamos. Their output voltage is proportional to their shaft-speed.

The DC motor that is driven, however is also a dynamo, so in theory it can be used to measure its own speed. All we need to do for that is to measure the Back-EMF voltage, which we denoted with Vg previously and called generator-voltage. For the sake of this article all these terms are interchangeable, and I will stick to generator-voltage. If we measured the generator voltage, than closed-loop speed-control of the motor can be achieved without any external measuring element. As I described it previously, any time the motor current is 0, the generator voltage appears on the motor terminals. Certain drive-modes have a period in their cycle where the current is 0. Those drive-modes can be used in conjunction with this technique, the generator-voltage can be sampled and the control loop can be closed. These drive modes are the sign/magnitude drive , the modified active collapse drive and the synchron collapse drive. For measuring back-EMF, the voltage of the motor terminals has to be measured, so the all the required circuitry for the modified active collapse drive is there anyway. However for the synchron collapse drive, the motor current has to be measured as well.

It is important to note that the generator-voltage measurement can only be done if the motor current does in fact reaches 0, so the circuit must operate in the discontinuous current mode. Since the average current in this mode cannot be more than half of the short-circuit current, to reach maximum torque, a higher than nominal battery voltage has to be used. Whether the circuit operates in continuous or discontinuous mode, depends on many things, among other things, the generator voltage itself. This poses a problem, so the sampling circuit has to be able to detect if the circuit is in deed in discontinuous mode. It is even more important if the circuit operates with a higher than nominal battery voltage, since that, in continuous current mode can damage the motor.

There are many ways of capturing the voltage on the motor terminals. You can measure the differential voltage, or measure the voltage on the two terminals individually. It is interesting to note that one of the leads is always connected to either the positive supply rail or to ground, so it is enough to measure the voltage on one of the leads, since the other terminal is at a known potential.


The following screen captures show actual waveforms measured on the leads of a motor, while driving in different drive-modes:

Sign/Magnitude drive with high-side drive

Active-collapse drive with high-side drive

Sign/Magnitude drive with alternating high- and low-side drive

Active-collapse drive with alternating high- and low-side drive

Those wavy parts are where the generator voltage is visible on the motor poles.


Those waves lead us to this chapter: why are they there and what can we to about them. It is obviously a problem to measure the generator voltage if they’re so noisy.

To identify the route cause we have to go back to how DC motors work. In an average small DC motor, you’ll find a permanent magnet in the stator (the non-moving shell of the motor) and three coils in a three pointed star arrangement on the rotor (the moving part of the motor). It also has two commutators that connect the external wires to the coils:

If you need an introduction to how these motors work, see or
for an excellent explanation.

As the rotor rotates the relative motion of each coil to the magnetic field changes in a sinusoidal fashion. The commutator selects a different coil depending on the position of the rotor, so the voltage on the motor terminals is always as high as possible:


At least in theory. In practice, the field is not fully homogeneous, the commutator doesn’t switch instantly and not precisely at the cross-over point. This is the reason for not seeing nice half-sine waves, as the thick black function above would indicate.

The commutator can also arc and add additional noise to the signal. These are the small spikes you can see on the scope images.

In order to be able to detect the generator voltage with any useful precision, some noise-filtering has to be done on this signal. One simple thing to do, is to pass it through a low-pass R/C filter. That will remove the arc- and other commutation noise form the signal, leaving us with the wavy base signal. One rather usable method is to search for the extreme points of this now filtered signal. You can use either maxima or minima, it doesn’t really matter: they both are relative to the shaft rotation though the ratio is obviously different. This method however assumes that a full wave will be found in the window where the generator voltage can be detected. For that to be true, the cycle-time of the bridge driver has to be rather low. In my experience a roughly 10ms cycle time works well for at least the motors I’ve tried. (If the target speed is above 2000 RPM, and the motor is in deed a 3-pole one, than one wave is 5ms long. Larger motors tend to have lower RPMs, but higher number of poles.)

Design example

As I said at the beginning this article described my experiences I had during the development of the H-Bridge µModule. If you’re interested in an actual implementation, that uses some of the more advanced drive techniques described in this article, please see that design. Note, that due to the limitations of the current-sense amplifier it’s impossible on that circuit to implement the synchron collapse drive method. Also, since that circuit uses back-EMF detection and closed-loop control, the firmware doesn’t use the locked anti-phase or the active field-collapse drive either. These however could be implemented if no back-EMF feedback is desired.

Print Friendly, PDF & Email

11 thoughts on “Part 3

  1. Thanks for sharing the knowledge . Although i just wanted to know and build simple H bridge to run motor forward/reverse . I just learned that there is lot more then I had not imagine . Thanks again

  2. I actually used this site as a reference in one of my project.
    The only thing I’m concerned with is with the drive techniques you can do. Because of the drawings, I was led to believe that a MOSFET switched on will be ABLE TO CONDUCT BIDIRECTIONALLY, which I confirmed later. The MOSFET will conduct only in one direction if it was turned ON. However, it *can* conduct current the opposite direction, whether the MOSFET is ON or OFF. This is because of the built-in body diode. If the conduction through the body diode is what you are talking about, please make it clear (also remember that driving the MOSFET ON is not a pre-requisite in doing so). Please contact me, thanks.

    • The fact that MOSFETs have an intrinsic diode – which is responsible for the backwards current flow – is called out several times in the article, and in fact is shown on every schematic. I’m sorry if you got mislead. Even if you’ve used switching elements that don’t exhibit this behavior (BJTs for example) you would want to add those diodes anyway to conduct the motor current when all switches are off – which you can’t avoid at least for short intervals.

      When you turn a MOSFET on, it will be able to conduct in both directions through its channel. What you can’t avoid is backwards conduction even when the MOSFET is off due to the body-diode.

      Hope this helps,
      Andras Tantos

  3. Thanks for your excelent description of the different switching modes.
    But I´m looking for the advantages / disadvantages of an additional method to switch the Mosfets as the chip TLE6284G it does. This H-bridge driver will switch Q1 an Q3 on, while PWM is off. I think this will get a short cirquit and the motor will get in a break mode. Please can you describe me this situation, am I right or wrong?

    Thanks from Germany

    • Stefan,

      Thanks for your comments. I suggest you read though the new H-Bridge secret series, where you will find a detailed description of the drive mode that you’re talking about, mostly in the Sign-Magnitude Drive chapter.

      Andras Tantos

  4. i am trying to control dc motor using sign magnitude drive.The problem is when i watch the wave form across motor terminal ,the negative spikes are visible of ampliude -24 volts .i used a snubber of 10 uf ,12 ohm and the spikes it a good way to remove spikes or i should do something else.the negative spikes are generated(ue to magnetic field collapsing) when the motor turns off .i hope u will help me in this regard.

    • Snubbers are not a bad way to go about the spikes if you already have the bases covered:
      – Make sure your catch diodes are fast enough to open. They are the ones that will take over the conduction during the shoot-through protection window
      – Make sure you tune your turn-on and -off times appropriately. If you open the FETs too fast, that will cause bigger spikes

  5. What if i tie the PWM signal on the enable EN pin or the VCC rather than the gate of the mosfet.

    What are the advantages or disadvantages of doing so.

    I think i will save one PWM pin also the problem that both the mosfets Q1 and Q2 which are ON for a finite time will be minimised.

    this is because i am not breaking the channel and making it again and again , and more over by tieng vcc to the pwm pin i will be changing the average Ids.

    but if i apply pwm to gate then the formation and breking of the channel will limit the frequency at which the h bridge could have been used.

    so where will it be better to connect the pwm signal
    to the gate or to the vcc(enable)?

    • First of all, sorry for missing this comment for so long…

      Turning the VCC on or off independent of the rest of the circuitry is a tricky business and needs very careful considerations. The problem is that most CMOS devices contain so-called ESD protection elements on their inputs. There are several possible structures but one common way of doing this is to connect a diode from the input towards VCC (and another towards GND but that’s not important for now). This diode is normally closed, but whenever the input is above VCC, it opens and conducts the extra charge to that pin. If you disconnect power from one part of the circuit, but keep the rest powered, it’s quite easy to engage these protection diodes and create something, called a leakage path. In other words, you can easily power your – you think – unpowered circuit from one of its input pins. Overall, I would strongly advise against doing this, unless you really know what you’re doing.

      As far as using the EN pin as the PWM source: that depends on the control you want to achieve. Read the datasheet of your particular driver, understand it’s logic diagram (there’s usually a table listing the state of all outputs as a function of the inputs) and see if that’s what you want to do. You might turn off all four FETs, which is definitely not what you want. But if you have half-bridge drivers and one side remains enabled, you can implement asynchronous sign-magnitude driver that way for example.

      I hope this helps,

Leave a Reply

Your email address will not be published. Required fields are marked *