Design Article
Back EMF method detects stepper motor stall: Pt. 1—The basics
David Swanson and Radek Stejskal, STMicroelectronics
10/27/2011 3:00 AM EDT
(Automotive applications for stepper motors may include headlight leveling, adaptive headlamps (that is where the headlamps turn right or left with the steering wheel), EGR (exhaust gas recirculation) valves, and adjustable mirrors. Non-automotive apps for the method described in this series would be any stepper motor application where the current is around 1A.)
For many years we thought we understood stepper motors. They seemed fairly straightforward machines. A stepper motor is essentially a motor who is a slave to the controller. “Aren’t they all?” You say. Not like this. Commutation is done by the controller, when the controller wants to; without regard to anything the stepper motor has to say. 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 need the controller to perform any of the commutation. The brushless DC (BLDC) motor, a close relative to the stepper motor, at least gets to tell the controller when it wants to commutate. A stepper motor, on the other hand, is told to go or told to stop at any point… a slave. As a result the motor has to be driven well beyond what is necessary to ensure that it moves (and stops) when told. The stepper motor controller doesn’t need feedback. When one is yelling he/she is not interested in feedback. A stepper motor controller is, in effect, yelling at the motor.
A good analogy would be a restaurant:
In reality, feedback is important
Even in a stepper motor feedback can be desirable. For instance it would be good to know if the motor stops listening (i.e., stalls). We can look for feedback on the state of the motor by polling a third party such as a position sensor. Or we can look to the motor itself for rotational information. This can be done in the form of motor current monitoring as a reflection of back electro-motive force (Back EMF or BEMF). Or we can look directly at BEMF.
External components to monitor motor position can add cost to the system. If we can get what we need without adding components or cost then we will. Our mantra… "More Features with Less Cost" is a good thing. After all, we are engineers.
The L9942
The L9942 is an integrated stepper motor driver for bipolar stepper motors used in automotive headlamp leveling. Among its many features is (quoting from the datasheet) “a programmable current profile look-up-table to allow for flexible adaptation of the stepper a motor characteristics and intended operating conditions.” In other words it can do full stepping, half stepping, and micro-stepping nicely. The L9942 micro-stepping mode provides for 32 programmable current regulated steps over 360 electrical degrees. That translates to eight different levels of current per quadrant.

Each step current is regulated by pulse-width modulation (PWM) control. The PWM on-time is fixed by an oscillator. The off-time is set by the current measured. A current mirror feedback provided from the high side switches is compared to 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 is turned off until the next PWM on-time. As a result a current sine wave is approximated in 32 steps through PWM control of the outputs.

Stall detection methods
Of the two methods previously described, monitoring motor current for the absence of back EMF is more indirect. During stall, the motor current rises quickly because the back EMF is absent. Lack of BEMF does two things. First, it increases the potential current in a winding at a given voltage per Ohm’s law. Secondly, 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 both rises, and rises quickly.

However, when micro-stepping, the system regulates the motor phase current by turning off the phase when the preprogrammed current threshold is reached. As a result, the motor current will not spike when the motor is stalled. Instead, the duty cycle will reduce to something fairly small as the current control algorithm compensates for the loss of BEMF. Loss of BEMF is then detected by observing an abnormally low duty cycle for a given commanded current. The L9942 has the ability to measure this duty cycle and report back to the host micro the information via SPI (Serial Peripheral Interface).
The difficulty with this method is that there are many parameters that can move around in the normal operating space of a stepper motor. Things like temperature, battery voltage, and loading or torque can have a dramatic affect on the current regulation duty cycle. In the end 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 not as simple as 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.
BEMF sensing explained
The next thought then is to approach the issue at the source, sensing BEMF directly. Overdriving a stepper motor phase causes the BEMF to be shifted up to 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.
We can take full advantage of this phenomenon when sensing BEMF. When the phase current is transitioning from one polarity to the other, the current passes through zero. Little or no current in the phase means that when we turn off the phase to look for BEMF there are no big issues with the inductive flyback. Actually, we are off anyway. We might as well look.
The resulting waveforms (Figure 5) look as we would expect. In an unloaded motor at the points where the phase current is at or near zero the back EMF for that phase is the strongest.
Where we have to be careful is when understanding the effects of motor loading on the phasing (or phase shifting) of the back EMF. Since this algorithm only looks for BEMF when the phase is not being driven, there is a very short window to “look.” As the motor is loaded, the back EMF shifts such that it will be more in line with the driving voltage/current for that phase. As can be expected motor loading adds some variation to the BEMF detection. A fully loaded motor just on the edge of stall looks to be the same as a fully stalled motor. Fortunately, a stepper motor is not intended to be driven with that much load.
Next: Universal motor concepts
For many years we thought we understood stepper motors. They seemed fairly straightforward machines. A stepper motor is essentially a motor who is a slave to the controller. “Aren’t they all?” You say. Not like this. Commutation is done by the controller, when the controller wants to; without regard to anything the stepper motor has to say. 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 need the controller to perform any of the commutation. The brushless DC (BLDC) motor, a close relative to the stepper motor, at least gets to tell the controller when it wants to commutate. A stepper motor, on the other hand, is told to go or told to stop at any point… a slave. As a result the motor has to be driven well beyond what is necessary to ensure that it moves (and stops) when told. The stepper motor controller doesn’t need feedback. When one is yelling he/she is not interested in feedback. A stepper motor controller is, in effect, yelling at the motor.
A good analogy would be a restaurant:
- A brush type motor is like a buffet… You eat what you want when you want. The amount of food available is all that is controlled.
- A brushless motor is like a fancy sit-down restaurant where the waiter is waiting for you to tell him when to serve you. He does his best to serve you when you want to be served. He only has control as to the amount of food you get to eat.
- For a stepper motor, the waiter says “YOU EAT NOW!” or “YOU GO HOME NOW!”… I think you get my point.
In reality, feedback is important
Even in a stepper motor feedback can be desirable. For instance it would be good to know if the motor stops listening (i.e., stalls). We can look for feedback on the state of the motor by polling a third party such as a position sensor. Or we can look to the motor itself for rotational information. This can be done in the form of motor current monitoring as a reflection of back electro-motive force (Back EMF or BEMF). Or we can look directly at BEMF.
External components to monitor motor position can add cost to the system. If we can get what we need without adding components or cost then we will. Our mantra… "More Features with Less Cost" is a good thing. After all, we are engineers.
The L9942
The L9942 is an integrated stepper motor driver for bipolar stepper motors used in automotive headlamp leveling. Among its many features is (quoting from the datasheet) “a programmable current profile look-up-table to allow for flexible adaptation of the stepper a motor characteristics and intended operating conditions.” In other words it can do full stepping, half stepping, and micro-stepping nicely. The L9942 micro-stepping mode provides for 32 programmable current regulated steps over 360 electrical degrees. That translates to eight different levels of current per quadrant.

Each step current is regulated by pulse-width modulation (PWM) control. The PWM on-time is fixed by an oscillator. The off-time is set by the current measured. A current mirror feedback provided from the high side switches is compared to 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 is turned off until the next PWM on-time. As a result a current sine wave is approximated in 32 steps through PWM control of the outputs.

Figure 2, L9942 current regulation block diagram
Stall detection methods
Of the two methods previously described, monitoring motor current for the absence of back EMF is more indirect. During stall, the motor current rises quickly because the back EMF is absent. Lack of BEMF does two things. First, it increases the potential current in a winding at a given voltage per Ohm’s law. Secondly, 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 both rises, and rises quickly.

However, when micro-stepping, the system regulates the motor phase current by turning off the phase when the preprogrammed current threshold is reached. As a result, the motor current will not spike when the motor is stalled. Instead, the duty cycle will reduce to something fairly small as the current control algorithm compensates for the loss of BEMF. Loss of BEMF is then detected by observing an abnormally low duty cycle for a given commanded current. The L9942 has the ability to measure this duty cycle and report back to the host micro the information via SPI (Serial Peripheral Interface).
The difficulty with this method is that there are many parameters that can move around in the normal operating space of a stepper motor. Things like temperature, battery voltage, and loading or torque can have a dramatic affect on the current regulation duty cycle. In the end 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 not as simple as 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.
BEMF sensing explained
The next thought then is to approach the issue at the source, sensing BEMF directly. Overdriving a stepper motor phase causes the BEMF to be shifted up to 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.
We can take full advantage of this phenomenon when sensing BEMF. When the phase current is transitioning from one polarity to the other, the current passes through zero. Little or no current in the phase means that when we turn off the phase to look for BEMF there are no big issues with the inductive flyback. Actually, we are off anyway. We might as well look.
The resulting waveforms (Figure 5) look as we would expect. In an unloaded motor at the points where the phase current is at or near zero the back EMF for that phase is the strongest.
Where we have to be careful is when understanding the effects of motor loading on the phasing (or phase shifting) of the back EMF. Since this algorithm only looks for BEMF when the phase is not being driven, there is a very short window to “look.” As the motor is loaded, the back EMF shifts such that it will be more in line with the driving voltage/current for that phase. As can be expected motor loading adds some variation to the BEMF detection. A fully loaded motor just on the edge of stall looks to be the same as a fully stalled motor. Fortunately, a stepper motor is not intended to be driven with that much load.
Next: Universal motor concepts
Navigate to related information


Robotics Developer
10/28/2011 1:00 PM EDT
A good article with nice details! Thanks. I really liked the graphics and the text overlays that expand upon what we are seeing. It looks like a rational approach that is both economical and well thought out. I wonder now how I can use this in other applications..
Sign in to Reply
prabhakar_deosthali
10/29/2011 4:57 AM EDT
A very informative article . The graphics are superb. I believe this back EMF is also used in brush less DC motors in a sensor less commutation control.
Sign in to Reply
David Ashton
10/29/2011 5:26 AM EDT
Nice article, but would it be possible to put in a link to the full figure 2 diagram...the 2 parts are different scales and not easy to stitch together.
Sign in to Reply
David Ashton
10/29/2011 5:43 AM EDT
If anyone else is interested, the full diagram for fig 2 is Fig 7 in the L9942 data sheet at
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00072898.pdf
Sign in to Reply
Saminathan
11/1/2011 3:30 AM EDT
Very good and informative article
Sign in to Reply
arashv60
11/3/2011 4:53 AM EDT
very good article,
Sign in to Reply
MrDave
11/22/2011 1:39 PM EST
Thanks
Sign in to Reply
K.Brown
5/4/2012 6:29 PM EDT
Is there any explanation of how the current profile lookup table works that someone could point me towards? I have read the entire datasheet 1.5 times ;) It gives no hint as to what values to fill the registers with.
Thanks
Sign in to Reply