Edited by Robert Repas
• The inductance in a stepper-motor phase winding limits how fast current rises when power is applied.
• Series-resistor current limiting needs higher voltages for faster step rates, but higher voltages mean greater energy loss.
Microchip Technology Inc., www.microchip.com
“A Finer Control of Linear Motion,”
“Selecting the Best Stepmotors,”
Stepper motors feature many special qualities that make them economical for control and measurement uses. Various software and hardware techniques can optimize specific stepper features. For example, simple modifications to the standard H-bridge motor drive minimize current use while the system operates at voltages above manufacturer-specified levels, The result is improved torque-speed qualities in the stepper.
Consider a simple hybrid stepper-motor-drive circuit controlled using a PIC16HV616 microcontroller (MCU). The general-purpose I/O peripheral ports A and C on the MCU control the switching of high-power MOSFETs in an H-bridge configuration that powers the motor windings.
In this circuit, each winding of a hybrid stepping motor is connected to its own H-bridge. The motor is driven in bipolar mode, meaning the switched-on MOSFETs determine the direction of current flow through the winding of each phase. The two motor windings or phases (winding A and winding B) are represented in the schematic by both an inductor (LW) and resistor (RW) that model the actual behavior of the coil. The values specified in the electrical ratings of the manufacturer datasheet for this example motor are 4.2 mH and 1.5 Ω, respectively. Other specifications gleaned from the data sheet include a rated dc-supply voltage of 3 V and a maximum dc current of 2 A.
The upper half of each H-bridge is driven by two P-channel MOSFETs, and the lower half by two N-channel enhancement MOSFETs. Two additional N-channel MOSFETs are applied to each P-channel gate to create an inverter that translates the MCU I/O voltage to the value needed by the P-channel gates. Each N-channel gate connects to a port pin on the PIC16HV616 MCU. Notice that PORTA pins control winding A, and PORTC pins control winding B.
The PIC16HV616 MCU features a permanent internal 5-V shunt regulator, in parallel with the VDD source pin. The internal regulator reduces the need for external regulation components when using current-limiting techniques with higher voltages. The size of the required external current-limiting resistor (RREG) depends on the load connected to the VDD pin. Resistor values are calculated using equations in the PIC16HV616 datasheet.
The PIC MCU implements a “Two-Phase On,” full-stepping algorithm, where both phases remain powered at each step. The always-powered design generates optimal torque values. The N-channel/P-channel pair activated in each H-bridge sets current-flow direction. To ensure each MOSFET remains in the open position until triggered by the PIC MCU, each gate connects to a 10-kΩ pull-up or pull-down resistor for P-channel and N-channel MOSFETs, respectively.
The circuit, as shown, works at the rated 3-V supply, as long as the motor is stopped or stepping at a slow rate. However, rising step rates create a dramatic drop in motor torque.
Most manufacturers include torque-speed information within the datasheet for a particular motor. However, the information reference points and style of presentation varies by manufacturer. Some critical points on a torque-speed graph could prove important in the design. They include holding torque, pull-in curve, pull-out curve, maximum start, and maximum rate.
The holding torque indicates the maximum static torque available when the rotor is at a standstill. Any torque applied to the motor shaft above this value results in a stall, or in the rotor shaft slipping to rotate in the opposite direction. This holding torque depends upon the number of motor phases excited at one time.
Two curves of interest denote the boundaries for the pull-in and pull-out regions. The pull-in region indicates the step-rate range where a motor can accelerate from a standing start without missing steps. The pull-out region shows the load that the motor can move when at operating speed. It is important to note the motor must start from a stand-still within the pull-in region, and then accelerate into the pull-out region to obtain these speeds. Similarly, to stop, the motor must first decelerate from the pull-out region into the pull-in region before the stepping sequence is removed. Failing to follow these two procedures typically results in stalled motors or skipped steps.
Numerous environmental and inherent mechanical conditions affect motor torque-speed curves. One such condition is the inductive nature of the coil. A motor winding is essentially an inductor. Therefore, it follows that the winding is governed by the same principles that apply to inductors. Most notably, the rate of current change through the motor winding ramps up gradually over a specific period of time. Inductors, of course, resist any change in current flow. Voltage must be applied to the inductor for a minimum period of time to let current reach effective levels.
The amount of torque produced depends directly on the strength of the magnetic field generated by coil current. Higher current means a stronger magnetic field and thus greater torque. However, as step rates rise, the coil sees voltage for shorter periods of time. A situation could develop where there is too little time for current to reach effective levels, with a consequential drop in available torque. The equation for the rate of current change within an inductor makes it clear that the amount of current flowing through the coil depends upon the coil inductance, the time duration and, most notably, the voltage:
where dI = change in current, dt = change in time, VS = supply voltage, and LW = inductance of the winding. Rearranging the equation to solve for time gives:
As more voltage gets applied to the winding, it takes less time to reach the same current level. However, a higher supply voltage also raises the maximum current. The circuit must employ some type of current limiting to stay below the manufacturer’s recommended maximum current level. Exceeding recommended current levels could overheat the motor or demagnetize the rotor due to excessively strong magnetic fields from the windings. For faster step rates, the designer must use some form of current limiting to minimize rise times yet avoid damaging current levels.
Series-resistor current limiting
The simplest current-limiting technique adds resistance in series with the current path. Basic Ohm’s Law demonstrates that as the series resistance rises, the current through the circuit drops. Furthermore, if we look at the standard equation for coil current as a function of time, adding more resistance reduces the current rise time.
where VS = supply voltage, RT = total resistance of the coil and MOSFET “on” resistance, LW = inductance of the coil winding, IT = instantaneous current value.
This in-series resistance is easily calculated using basic Ohm’s Law by setting the desired voltage, maximum allowable current, and the total resistance of the coil and MOSFETs in the current path:
In the example shown, the motor-drive supply voltage is 5 V. Ohm’s Law is used to calculate total circuit resistance at 2.5 Ω to limit current through the winding to its 2-A maximum. The winding has a resistance of 1.5 Ω while the two MOSFETs have an on-resistance value of 0.05 and 0.09 Ω, respectively, for an overall resistance of 1.64 Ω. A series resistance of 0.86 Ω is added to the circuit to bring total resistance to 2.5 Ω.
The shortened rise time within the coil ensures adequate current levels at slightly higher step rates. However, the current-limit method presents some inherent disadvantages that designers must consider. First, faster step rates demand higher voltage and even higher series resistance to keep winding current at the same level. The current flow produces a power loss in the series resistor equal to I2R. Higher resistance means greater power losses. Consequently, the circuit needs a large and potentially expensive high-wattage resistor. Such “wasted” energy will significantly reduce run-time in battery-operated systems. Furthermore, certain power resistors implement a wire-wound design that could potentially add inductance to the circuit further slowing current rise times. The application dictates whether these limitations are acceptable.
Dual-voltage supply-current limiting
Unlike the Series Resistance method that uses only a single supply voltage, the dual-voltage method uses two power supplies of differing voltages. The higher voltage supply only operates during the current ramp-up phase. At maximum current, the higher voltage is turned off and the lower voltage is applied to maintain the rated current.
The desired supply is connected via a switching mechanism. For example, two P-Channel MOSFETs are connected to control signals generated by other general-purpose input/output pins on the PIC16HV616 MCU. A diode on the drain of the P-Channel MOSFET connected to the 3-V supply keeps the transistor off until turned on by the PIC MCU. This method yields a steep current rise in the coil, while providing higher efficiency than the in-series resistor method.
The “On” time for the higher voltage supply is critical. If it’s on for too long, the current level will climb beyond the safe region reducing motor and drive life. Too short a period of time and the winding won’t generate sufficient torque. The scheme shown in the accompanying diagram is an open-loop system — there is no feedback to the MCU that monitors current.
Chopper controller current limiting
An improvement on the dual-supply design uses one PIC16HV616 comparator peripheral to create a chopper configuration that limits the winding current when using higher voltages. A chopper circuit limits current flow by turning the circuit off if the current exceeds a preset value. When the current drops, power returns. The effect chops the steady power source into controlled-width pulses.
In this method, a high supply voltage (12 V, for example) brings the current levels up quickly within the coil. The amount of current flowing in the circuit is measured using a current-sensing resistor. The higher the current flow, the greater the voltage drop on the sensing resistor. The output of the resistor is applied to the noninverting input of a comparator circuit located within the MCU. The inverting side of the comparator connects to an internal programmable reference voltage or CVREF. When the circuit is energized, current through the winding begins to rise. The voltage drop across the sensing resistor rises proportionately with the current. When this voltage exceeds the CVREF, the comparator generates a logic LOW on its output that turns off or “chops” the voltage applied across the coil
The comparator features a built-in 45-mV hysteresis that prevents the output from switching too fast. This feature also reduces the effect of noise on the non-inverting input of the comparator. Finally, the programmable CVREF can be altered in firmware to vary motor torque, when necessary.
Using Ohm’s Law, the programmable CVREF operating limits for maximum and minimum are each divided by the maximum rated current of 2 A to determine a suitable sense-resistance value. Typically, sense resistances range from 0.5 to 1 Ω, though other values are possible depending on the application. However, as a rule of thumb, the voltage drop across the sense resistor should never exceed 10% of the H-bridge supply voltage.
Current limiting is only one part of developing a robust stepper-motor application. Other considerations include reducing friction, using damping techniques to reduce vibration, and choosing switching elements that work efficiently within the design. The above current-limiting techniques help compensate the inductive nature of the motor coil by reducing current rise times.