H-bridge secrets part 2

Back-EMF

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.

Measurements

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.

Complications

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
http://www.phys.unsw.edu.au/~jw/HSCmotors.html or
http://www.solarbotics.net/starting/200111_dcmotor/200111_dcmotor2.html
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.

© 2004-2007 Andras Tantos