For the last 40 years, stepper motors have been used in applications requiring tight position control at an affordable price. The advantageous economics stem from simplicity. Steppers deliver accurate positioning without feedback, and can be driven by squarewaves, which almost any digital controller can supply.

But don’t underestimate the complexity of these electromechanical devices; controlling them is often more difficult than controlling other motors. For starters, inherently low damping leads to frequent resonance and acoustic noise problems. Another problem is their limited speed range. On a typical 200-step/rev stepper, reversing the current in one of the stator coils results in only 1.8° of shaft movement, compared to 100 times that amount of movement when the current is reversed in the stator of a two-pole ac design. As the step frequency increases, a point is reached (at a fairly low rpm) where the current simply can’t commutate in and out of the coils fast enough - the inductance of the coils oppose rapid current changes — and motor torque decreases.

For better performance, steppers are often driven in current mode with sinewaves instead of squarewaves. This not only offers smoother performance over a wider speed range, but also increases positional resolution. Current mode control also reduces sensitivity to system fluctuations, such as power supply disturbances, coil crosstalk from high mutual inductance, or changes in coil resistance because of heating. But achieving top performance with a current mode controller requires careful attention to design details.

Better behaved stepper

Consider a singlechip sinusoidal current- mode stepper controller in which motor current is regulated via digital control loops running in software. Reference sine and cosine signals are supplied to the inputs of the servo loops, which are generated from a sinusoidal look-up table in memory. Instead of maintaining a separate wavetable for each reference signal, data is retrieved from a single table by using two pointers offset by 90°. It’s not necessary to fetch every point in the table when reconstructing each cycle of the reference waveform. Because table access occurs at fixed intervals, more waveform points will be skipped at higher speeds. To change the phase relationship between the coil currents required for reverse operation, the wavetable pointer is decremented, instead of incremented, at each interval.

An on-board analog-to-digital converter acquires samples of the motor phase currents and software digitally compares them to the sine and cosine reference signals. The result of each comparison is an error signal, processed by a simple gain stage. As with most current-mode controllers driving inductive loads, the only pole in the open-loop transfer function is that formed from the inductance L and resistance R of the motor windings. A stability analysis shows that, as a result, a gain stage is all that is needed for stable operation; no phase-lead compensation is required. By selecting a sampling frequency much higher than the bandwidth of the servo loop, the sampleand- hold delays associated with the a/d converter and PWM modules are insignificant in terms of their impact on the loop phase margin.

One step at a time

The output of each gain stage is processed and supplied to the onboard PWM module, which generates the switching signals necessary for controlling both H-bridge power stages. The PWM module is capable of generating PWM signals in several formats, so it’s important to select a mode optimized for the application. Specifically, the PWM module should generate high-resolution output that delivers fast current slewing, economical motor current detection, and control of both H-bridges with the available six PWM signals.

Continue on page 2

To meet these requirements, a bipolar PWM topology is used. It gets its name from the fact the load sees the PWM carrier as an ac signal, whose peak-to-peak amplitude is 2x the H-bridge supply voltage. Two PWM signals are required for each H-bridge, and they’re connected so the diagonal FETs are driven by the same signal, turning on and off simultaneously. Similarly, the two FETs comprising each side of the H-bridge are driven in a complementary way, so that when a top FET is on, the bottom FET is off, and vice-versa. But both FETs in a half-bridge can never be on at the same time or the power supply will be shorted. Because it takes a small amount of time for each FET to turn off, a dead-time is inserted between the turn off of a given FET, and the turn on of the complementary FET. The deadtime is managed automatically by the PWM module and is typically set to a value between 250 nsec and 1 μsec for most power FET circuits.

To achieve faster current slewing, the H-bridge power supply voltage is significantly higher than the rating of the stepper. Assuming the motor winding insulation can withstand the higher voltage, this is acceptable for current mode control, because the closed-loop action guarantees the motor current rating is never exceeded. Unfortunately, this also results in higher current ripple. To mitigate this, PWM frequency is increased so motor inductance more effectively filters the PWM carrier.

Some PWM techniques allow motor current to circulate within the H-bridge, bypassing the shunt resistor altogether. This loss of current feedback is obviously a problem, especially in over-current conditions. However, with bipolar PWMs motor current flows through the shunt resistor at all times, thus increasing the simplicity and reliability of the current detection. A circuit capable of monitoring bidirectional motor current only requires a single power supply driving a rail-to-rail op-amp with good output slewing qualities. The circuit is designed so that a zero-current condition generates a voltage close to half of the a/d converter range. When all FETs are off, the a/d converter input is sampled and saved for later use in the current reconstruction algorithm.

Choosing the appropriate sample times for the current feedback signal is critical for proper performance of the current control loop. Two factors drive this decision. First, the sample times should be chosen so that they do not occur during any of the PWM edges. Second, the sample time should be chosen at a point that will yield the average value of the current waveform. Under steady-state conditions, the average current value should occur near the middle of each PWM waveform portion. One current reading is required per PWM period, and the sample time is chosen to be at either 25% or 75% through the PWM period, depending on which time is furthest away from the switching edges. If the sample time is 25% through the PWM cycle, the reading is subtracted from the zero-current reading taken earlier, to obtain the motor current value. If it is 75%, the motor current is calculated by subtracting the zerocurrent reading from the new a/d converter reading.

At higher speeds (when high current slewing is required), the current loop draws upon the high voltage supplied to the Hbridge to slew the current quickly. However, at very high speeds, the supply voltage cannot slew the current fast enough to track the reference sinewave accurately, resulting in saturation of the current loop. As speed continues to increase, the saturation effect becomes more pronounced, resulting in a seamless transition to a full-step squarewave mode that yields higher torque than sinusoidal waveforms.

The motor current accurately tracks the reference sinewave, resulting in high-quality stepper performance with little vibration. Controlling a stepper motor in this way is ideally suited for applications requiring low vibration and extended position resolution, such as CNC machines, medical scanners, and office equipment.