Back-EMF method detects stepper-motor stall
David Swanson and Radek Stejskal, STMicroelectronics - January 5, 2012
Stepper motors find use in many automotive applications, including headlight leveling; adaptive headlamps, in which the headlamps turn right or left with the steering wheel; EGR (exhaust-gas-recirculation) valves; and adjustable mirrors. Nonautomotive apps for the method include any stepper motor with a current of approximately 1A.
Stepper motors seem to be fairly straightforward machines. They are essentially slaves to controllers, which perform commutation when they want to without regard to the stepper motor. The controller requires no feedback to help with appropriate times to commutate.
In comparison, a brush-type motor commutates when it wants to and doesn’t require the controller to perform any commutation. The BLDC (brushless-dc) motor, a close relative of the stepper motor, tells the controller when it wants to commutate.
Because a stepper motor acts as a slave, you must drive it well beyond what is necessary to ensure that it moves and stops when told. The stepper-motor controller needs no feedback.
Even in a stepper motor, however, feedback can be desirable. For instance, it would be nice to know whether the motor has stalled. You can look for feedback on the state of the motor by polling a third party, such as a position sensor, or you can look to the motor itself for rotational information. You can perform these tasks using motor-current monitoring as a reflection of back EMF, or BEMF (back electromotive force). Alternatively, you can look directly at BEMF.
External components to monitor motor position can add cost to the system. You can, however, get what you need without adding components or cost.
L9942 stepper motor
The integrated L9942 stepper-motor driver for bipolar stepper motors operates in automotive-headlamp leveling. The device offers a programmable current-profile look-up table to allow for flexible adaptation of the stepper-motor characteristics and intended operating conditions. In other words, it can do full stepping, half-stepping, and microstepping. The L9942’s microstepping mode provides for 32 programmable current-regulated steps over 360°, translating to eight levels of current per quadrant (Figure 1).
PWM control regulates each step current. An oscillator fixes the pulse-width modulator’s on-time, and the measured current fixes its off-time. The high-side switches provide a current-mirror feedback, which the L9942 compares with a preset, programmable current value through a look-up table. When the current in the phase matches the value in the look-up table, the phase turns off until the PWM’s next on-time. As a result, the L9942 approximates a current sine wave in 32 steps through PWM control of the outputs (Figure 2).
During a stall, the motor current rises quickly because the BEMF is absent. The lack of BEMF increases the potential current in a winding at a given voltage, according to Ohm’s Law, and it increases the rate of change of the current in the windings because the rate of change of current in an inductor is proportional to the voltage across the inductor. With little or no BEMF in a motor winding, the current rises quickly (Figure 3).
When microstepping, however, the system regulates the motor-phase current by turning off the phase when it reaches the preprogrammed current threshold. As a result, the motor current does not spike when the motor stalls. Instead, the duty cycle decreases to a fairly small value because the current-control algorithm compensates for the loss of BEMF. You detect BEMF loss by observing an abnormally low duty cycle for a given commanded current. The L9942 measures this duty cycle and reports the information back to the host microcontroller through SPI.
The difficulty with this method is that many parameters can move around in the normal operating space of a stepper motor. Temperature, battery voltage, and loading or torque can have a dramatic effect on the current regulation’s duty cycle. The operating point at one end of the normal spectrum can look like a stalled motor at the other end. Overlapping parameters make it difficult at best to safely discern a stalled rotor. As a result, it is more difficult than measuring a current or looking at a regulated duty cycle. To minimize the effects of motor resistance, battery voltage, and temperature, the stall-detection algorithm can look directly at BEMF.
Overdriving a stepper-motor phase causes the BEMF to shift by as much as 90°. As a result, in an unloaded stepper motor, the BEMF is highest in a phase when the current is the lowest in that phase (Figure 4). You can take full advantage of this phenomenon when sensing BEMF. When the phase current is moving from one polarity to the other, the current passes through 0A, meaning that no major issues occur with the inductive flyback when you turn off the phase to look for BEMF (Figure 5).
The resulting waveforms look as you would expect. In an unloaded motor, in which the phase current is at or near 0A, the BEMF for that phase is the strongest (Figure 6). You must, however, understand the effects of motor loading on the phasing, or phase shifting, of the BEMF. Because this algorithm looks for BEMF only when the phase is not being driven, you have a short window during which to “look.” As the motor loads, the BEMF shifts so that it aligns better with the driving voltage and current for that phase. Motor loading adds some variation to the BEMF detection. A fully loaded motor just on the edge of stalling looks the same as a fully stalled motor. Fortunately, a stepper motor is not intended to be driven with that much load.
Universal motor concepts
BEMF is directly proportional to angular velocity, or armature speed, and motor torque is directly proportional to motor current. The following equation clearly illustrates the relationship between angular velocity and BEMF: BEMF=−N×B×A×ω×sin(ωt), where N is the number of coil turns, B represents the magnetic field, A is the area that the motor’s magnetic field encompasses, ω is the angular velocity, and t is time. Notice that N, B, and A are all constants specific to the motor construction. They never change unless some dramatic entropy is going on. At that point, BEMF detection is the least of your concerns. Aside from the sinusoidal nature of the signal, BEMF is directly proportional to motor speed and nothing else.
The following equation clearly describes the relationship between motor torque and motor current: T=[(PN)/2π)]φI, where T is torque, N is the number of coil turns, P is the number of poles, φ is the flux, and I is the current. Note again that current and torque are directly proportional to each other. Other factors, including voltage and the temperature’s dependence on the resistivity of copper, can increase or decrease the motor current, which in turn affects the total available torque. However, they do not change the torque-to-current relationship.
A stepper motor is typically a fixed-current system—that is, the controller feeds a fixed set of currents into two phases at a rotational velocity that the rotor directly reflects. A fixed current into a motor produces a fixed torque, and, thanks to the automatic phase shifting of the BEMF with respect to drive current, a stepper motor can have a fixed current and rotate at a fixed speed for a range of loads or torques.
The phase current generates the torque using the preceding equations. The load determines in which direction to apply that torque. In a lightly loaded stepper motor, a small portion of the torque drives the load, and the remaining torque slows down the motor. To remain below the commanded rotational speed, the current first drives the motor to go faster and then brakes it to go slower. The overall torque exiting the output shaft is zero for an unloaded motor.
BEMF also is a representation of rotor position, as the moving magnets in the rotor induce BEMF in the stator. The rotor’s magnetic field is fixed to the rotor and rotates with it. The stator field relates to the current in the stator. A positive current in the stator creates a positive field, and vice versa.
With magnetics, as with some people, opposites attract. When the polarity in the stator is the opposite of the rotor, attraction and, thus, acceleration occur. When the polarity is the same in both the rotor and the stator, braking occurs. In an unloaded motor, you get an almost-perfect distribution of acceleration and braking. As the stepper motor loads, the BEMF shifts to convert more of the torque to forward motion and less to braking.
In a partially loaded stepper motor, the BEMF shifts to increase the percentage of driving torque over the braking torque (Figure 7). This shift continues as external loading increases until the loading exceeds the potential torque capability (Figure 8).
In a fully loaded stepper motor, the moment that the torque demand causes the BEMF to shift any further, the output torque decreases, and the motor stops rotating. To more easily see the effects of torque on BEMF, look at a stepper motor in full-step mode (Figure 9). The red curve represents the current, and the purple curve represents the voltage on the phase. The thin black curve represents a feeble attempt at estimating the BEMF.
In an unloaded motor, the BEMF leads the phase current. The figure shows a skewed BEMF peak and a prolonged near-zero period, which represents the torque first speeding up and then slowing down the rotor. Just spinning the motor would provide a symmetrical BEMF waveform.
The loading for a loaded motor is more in line with the current it is receiving (Figure 10). The BEMF is more symmetrical with the driving currents. The zero-crossing point is in the middle, or between the two driving-current regions. If you were to further load this motor, it would stall.
Systems that use stepper motors severely overdrive their motors to ensure that they never, under all normal operating conditions, approach stall. Comparing these waveforms with what appears during stalling shows a dramatic difference, with virtually no BEMF during nondriven intervals (Figure 11). Typically, a stalled rotor vibrates as it tries to move; however, any rotational movement translates to BEMF. A stalled but vibrating rotor shows an issue with BEMF detection (Figure 12).
These waveforms overlap somewhat with the previous ones. This figure shows the behavior of a full-step-mode-driven motor, which differs from a microstep-mode-driven motor. When you are using microstep mode, you are looking only during that short moment when the current is 0A. You can see only a small portion at a time. It may seem limiting, but it is enough. To get some idea of what the BEMF looks like on average for a given motor, a simple system checks BEMF synchronously with stepper-motor phasing (Figure 13). With a microprocessor’s analog-to-digital sampling, you can quickly obtain several thousand BEMF readings and generate a histogram of the values.
Histograms and limits
The L9942 stepper motor uses an 8-bit STM8A microcontroller, which can synchronously sample the BEMF in step with the L9948. The step-clock frequency for the L9942 is 2 kHz, and the peak current in microstepping mode is 400 mA. The ADC takes its sample at the end of the zero-current step, ensuring the most consistent BEMF readings (Figure 14). Compare the BEMF results with those for a stalled rotor and a running rotor (Figure 15). In some instances, the stalled rotor’s BEMF shows some variance and overlaps with the running motor’s BEMF readings. This result is due to motor vibration, which causes BEMF to be more than 0V during the ADC sample (Figure 16). Statistically, this overlap is minimal; BEMF is usually lower than this figure shows. By setting the BEMF threshold at approximately 2V, a reliable detection can take place because most BEMF measurements are well below that level. If you look at the time it takes to effectively detect stalling for this motor, you find that you can detect the stall within one mechanical revolution of the motor. A current period is the time it takes to make one full 360° electrical rotation. This example steps 32 times at 2 kHz for one full period, translating to 16 msec per period. Within 10 half-periods, or 80 msec, the system detects stall 100% of the time.
These cases compare an unloaded motor with a stalled motor. The differences between these two states are dramatic and easily detectable. From this analysis, you can see that a loaded motor causes the detected BEMF thresholds to drop as the BEMF shifts to align with current. You must take this drop into account when considering an acceptable stalling threshold. Every application has a maximum expected torque requirement, which must be taken into account when determining the BEMF stall threshold. A loose or spongy transmission or a soft stall, in which the rotor can bounce, may also affect these limitations, which are even more difficult to overcome using the current and duty-cycle method. Because the BEMF sensing takes place outside the IC, you can to some extent overcome this limitation with a statistical method discerning the stall threshold.
The BEMF method for detecting stall while using the L9942 can be reliable and cost-effective. This method takes advantage of motor parameters that change little with time or temperature. As a result, this method overcomes many of the limitations of the more traditional stall-detection method of current and duty-cycle sensing. At least one automotive headlamp application uses this algorithm.
This article originally appeared in two parts on EDN’s sister site, Automotive Designline. Read part one at http://bit.ly/tVHk2V and part two at http://bit.ly/uTJ1Tm.
David Swanson is principal engineer in STMicroelectronics’ automotive business unit. He has been with the company since 1987. Before joining ST, Swanson worked for the Delco products division of GM. He graduated with a bachelor’s degree in electrical engineering from North Carolina State University—Raleigh and holds many patents in several areas of automotive electronics.
Radek Stejskal is an applications engineer in STMicroelectronics’ automotive business unit in Prague, Czech Republic. A graduate of the Czech Technical University (Prague), he has worked with ST since 2003. His job focus is developing application demo boards for dc, stepper, and BLDC motor-control drivers.
Share your thoughts.
EDN.com Analog Design Channel Video Player
Datasheets.com Parts Search
185 million searchable parts
(please enter a part number or hit search to begin)