Driving medium-voltage motors, especially stepper and brushless dc (BLDC) motors, can be a control engineering nightmare. As these motors become more popular in everything from radio-controlled cars, electric razors, and car water pumps, itís a challenge that must be met with minimal cost, board area, and complexity.
Stepper motors also can be found in everyday products like video surveillance products, micro-printers, and cash machines. In addition, stepper motors are a hobbyistís dream for pursuing a variety of home projects like computer numerical control (CNC) machines or 3D printers. Todayís integrated circuits have accepted the challenge with highly integrated control engines that reduce development time, cost, and board area.
At the heart of a stepper motor is an H-bridge for directing bi-directional current across the motor windings. For stepper motor applications requiring some degree of microstepping, itís necessary to implement some sort of current control to accurately and smoothly step the motor from one position to the next. In a discrete solution, you implement this with a gate driver, some MOSFETs in the bridge, current sense resistors in series with the low-side MOSFETs across the winding, an operational amplifier (op amp) to measure the voltage across the sense resistor, and finally a microcontroller (MCU) capable of measuring this voltage (integrated analog-to-digital converter, or ADC) and acting upon it. Close the loop with a proportional-integral controller in a microprocessor with high-resolution pulse-width modulation (PWM) outputs, and youíre done. This sounds expensive, area-consuming, and most certainly time-consuming -- unless you stayed awake during all those control-theory classes. And we havenít even begun to include protection on the MOSFETs for shoot through, thermal run-away, and over-current.
Figure 1: Example of a stepper motor driver system block diagram.
The good news is that thereís an easier way. Integrated solutions are available that can simplify all of the above to a simple pulse input from a microprocessor when you want your stepper motor to take a step. Letís take a look at the interface (Figure 1).
The Step and Direction pins can be connected to standard general-purpose input/output (GPIO) pins on your processor. A rising edge on the Step input indexes one position into the logic table and increases (or decreases) the current in each phase, as needed to commutate with the motor. An example of this lookup table is shown in Table 1. The resulting current in the winding for a given step input depends on the microstepping mode you chose for the device. Speed is determined by how fast you issue the step pulses. The Direction pin is simply set high, or low, depending on which way you want to move.
Finally, Vref is a voltage that can be derived from a simple voltage divider to set the maximum, or full-scale, current in each phase. This is the reference for the internal DAC that dynamically changes the voltage on the internal comparator. By comparing this voltage with the voltage across the external sense resistor, current is regulated at each step per Table 1. This technique is commonly referred to as current chopping. Choose your microstepping mode with a set of high-low digital input pins and you are spinning in record time! It really is that easy, and evaluation boards with a graphical user interface (GUI) makes it that much easier.
BLDC Motor Drive
Moving to a more complicated beast, the BLDC motor requires all of the previously mentioned discrete components necessary for a stepper motor, plus a way to detect back electromotive force (BEMF). This is commonly done with zero-crossing comparators to detect when the trapezoidal voltage waveforms of each phase cross through a zero voltage point. After all the discrete blocks are in place, itís time to delve into the dark world of firmware development in your MCU. Hereís where you generate 120-degree phase-shifted PWM bursts to move the electric field precisely around the stator of your motor to lead the rotor around at the speed you desire. Simple enough, if you have done it before, and have time to tune the loop to your motor parameters to avoid miscommutation on every cycle.