4. Current Limiting for Stepping Motors
Small stepping motors, such as those used for head positioning on floppy disk drives, are usually driven at a low DC voltage, and the current through the motor windings is usually limited by the internal resistance of the winding. High torque motors, on the other hand, are frequently built with very low resistance windings; when driven by any reasonable supply voltage, these motors typically require external current limiting circuitry.
There is good reason to run a stepping motor at a supply voltage above that needed to push the maximum rated current through the motor windings. Running a motor at higher voltages leads to a faster rise in the current through the windings when they are turned on, and this, in turn, leads to a higher cutoff speed for the motor and higher torques at speeds above the cutoff.
Microstepping, where the control system positions the motor rotor between half steps, also requires external current limiting circuitry. For example, to position the rotor 1/4 of the way from one step to another, it might be necessary to run one motor winding at full current while the other is run at approximately 1/3 of that current.
The remainder of this section discusses various circuits for limiting the current through the windings of a stepping motor, starting with simple resistive limiters and moving up to choppers and other switching regulators. Most of these current limiters are appropriate for many other applications, including limiting the current through conventional DC motors and other inductive loads.
The easiest to understand current limiter is a series resistor. Most motor manufacturers recommended this approach in their literature up until the early 1980's, and most motor data sheets still give performance curves for motors driven by such circuits. The typical circuits used to control the current through one winding of a permanent magnet or hybrid motor are shown in Figure 4.1.
Figure 4.1R1 in this figure limits the current through the motor winding. Given a rated current of I and a motor winding with a resistance Rw, Ohm's law sets the maximum supply voltage as I(Rw+R1). Given that the inductance of the motor motor winding is Lw, the time constant for the motor winding will be Lw/(Rw+R1). Figure 4.2 illustrates the effect of increasing the resistance and the operating voltage on the rise and fall times of the current through one winding of a stepping motor.
Figure 4.2R2 is shown only in the unipolar example in Figure 4.1 because it is particularly useful there. For a bipolar H-bridge drive, when all switches are turned off, current flows from ground to the motor supply through R1, so the current through the motor winding will decay quite quickly. In the unipolar case, R2 is necessary to equal this performance.
Note: When the switches in the H-bridge circuit shown in Figure 4.1 are opened, the direction of current flow through R1 will reverse almost instantaneously! If R1 has any inductance, for example, if it is wire-wound, it must either be bypassed with a capacitor to handle the voltage kick caused by this current reversal, or R2 must be added to the H-bridge.
Given the rated maximum current through each winding and the supply voltage, the resistance and wattage of R1 is easy to compute. R2 if it is included, poses more interesting problems. The resistance of R2 depends on the maximum voltage the switches can handle. For example, if the supply voltage is 24 volts, and the switches are rated at 75 volts, the drop across R2 can be as much as 51 volts without harming the transistors. Given an operating current of 1.5 amps, R2 can be a 34 ohm resistor. Note that an interesting alternative is to use a zener diode in place of R2.
Figuring the peak average power R2 must dissipate is a wonderful exercise in dynamics; the inductance of the motor windings is frequently undocumented and may vary with the rotor position. The power dissapated in R2 also depends on the control system. The worst case occurs when the control system chops the power to one winding at a high enough frequency that the current through the motor winding is effectively constant; the maximum power is then a function of the duty cycle of the chopper and the ratios of the resistances in the circuit during the on and off phases of the chopper. Under normal operating conditions, the peak power dissipation will be significantly lower.
A pair of high wattage power resistors can cost more than a pair of power transistors plus a heat sink, particularly if forced air cooling is available. Furthermore, a transistorized constant current source, as shown in Figure 4.3, will give faster rise times through the motor windings than the current limiting resistor shown in Figure 4.1. This is because a current source will deliver the full supply voltage across the motor winding until the current reaches the rated current; only then will the current source drop the voltage.
Figure 4.3In Figure 4.3, a transistorized current source (T1 plus R1) has been substituted for the current limiting resistor R1 used in the examples in Figure 4.1. The regulated voltage supplied to the base of T1 serves to regulate the voltage across the sense resistor R1, and this, in turn, maintains a constant current through R1 so long as any current is allowed to flow through the motor winding.
Typically, R1 will have as low a resistance as possible, in order to avoid the high cost of a power resistor. For example, if the forward voltage drops across the diode in series with the base T1 and VBE for T1 are both 0.65 volts, and if a 3.3 volt zener diode is used for a reference, the voltage across R1 will be maintained at about 2.0 volts, so if R1 is 2 ohms, this circuit will limit the current to 1 amp, and R1 must be able to handle 2 watts.
R3 in Figure 4.3 must be sized in terms of the current gain of T1 so that sufficient current flows through R1 and R3 to allow T1 to conduct the full rated motor current.
The transistor T1 used as a current regulator in Figure 4.3 is run in linear mode, and therfore, it must dissapate quite a bit of power. For example, if the motor windings have a resistance of 5 ohms and a rated current of 1 amp, and a 25 volt power supply is used, T1 plus R1 will dissapate, between them, 20 watts! The circuits discussed in the following sections avoid this waste of power while retaining the performance advantages of the circuit given here.
When an H-bridge bipolar drive is used with a resistive current limiter, as shown in Figure 4.1, the resistor R2 was not needed because current could flow backwards through R1. When a transistorized current limiter is used, current cannot flow backwards through T1, so a separate current path back to the positive supply must be provided to handle the decaying current through the motor windings when the switches are opened. R2 serves this purpose here, but a zener diode may be substituted to provide even faster turn-off.
The performance of a motor run with a current limited power supply is noticably better than the performance of the same motor run with a resistively limited supply, as illustrated in Figure 4.4:
Figure 4.4With either a current limited supply or a resistive current limiter, the initial rate of increase of the current through the inductive motor winding when the power is turned on depends only on the inductance of the winding and the supply voltage. As the current increases, the voltage drop across a resistive current limiter will increase, dropping the voltage applied to the motor winding, and therefore, dropping the rate of increase of the current through the winding. As a result, the current will only approach the rated current of the motor winding asymptotically
In contrast, with a pure current limiter, the current through the motor winding will increase almost linearly until the current limiter cuts in, allowing the current to reach the limit value quite quickly. In fact, the current rise is not linear; rather, the current rises asymptotically towards a limit established by the resistance of the motor winding and the resistance of the sense resistor in the current limiter. This maximum is usually well above the rated current for the motor winding.
Both the resistive and the linear transistorized current limiters discussed above automatically limit the current through the motor winding, but at a considerable cost, in terms of wasted heat. There are two schemes that eliminate this expense, although at some risk because of the lack of feeback about the current through the motor.
If you plot the voltage across the motor winding as a function of time, assuming the use of a transistorized current limiter such as is illustrated in Figure 4.3, and assuming a 1 amp 5 ohm motor winding, the result will be something like that illustrated in Figure 4.5:
Figure 4.5As long as the current is below the current limiter's set point, almost the full supply voltage is applied across the motor winding. Once the current reaches the set point, the voltage across the motor winding falls to that needed to sustain the current at the set point, and when the switches open, the voltage reverses briefly as current flows through the diode network and R2.
An alternative way to get this voltage profile is to use a dual-voltage power supply, turning on the high voltage for as long as it takes to bring the current in the motor winding up to the rated current, and then turning off the high voltage and turning on the sustaining voltage. Some motor controllers do this directly, without monitoring the current through the motor windings. This provides excellent performance and minimizes power losses in the regulator, but it offers a dangerous temptation.
If the motor does not deliver enough torque, it is tempting to simply lengthen the high-voltage pulse at the time the motor winding is turned on. This will usually provide more torque, although saturation of the magnetic circuits frequently leads to less torque than might be expected, but the cost is high! The risk of burning out the motor is quite real, as is the risk of demagnitizing the motor rotor if it is turned against the imposed field while running hot. Therefore, if a dual-voltage supply is used, the temptation to raise the torque in this way should be avoided!
The problems with dual voltage supplies are particularly serious when the time intervals are under software control, because in this case, it is common for the software to be written by a programmer who is insufficiently aware of the physical and electrical characteristics of the control system.
Another alternative approach to controlling the current through the motor winding is to use a simple power supply controlled by pulse width modulaton (PWM) or by a chopper. During the time the current through the motor winding is increasing, the control system leaves the supply attached with a 100% duty cycle. Once the current is up to the full rated current, the control system changes the duty cycle to that required to maintain the current. Figure 4.6 illustrates this scheme:
Figure 4.6For any chopper or pulse width modulator, we can define the duty-cycle D as the fraction of each cycle that the switch is closed:
D = Ton / (Ton + Toff)Where
Ton -- time the switch is closed during each cycleThe voltage curve shown above indicates the full supply voltage being applied to the motor winding during the on-phase of every chopper cycle, while when the chopper is off, a negative voltage is shown. This is the result of the forward voltage drop in the diodes that are used to shunt the current when the switches turn off, plus the external resistance used to speed the decay of the current through the motor winding.
Toff -- time the switch is open during each cycle
For large values of Ton or Toff, the exponential nature of the rise and fall of the current through the motor winding is significant, but for sufficiently small values, we can approximate these as linear. Assuming that the chopper is working to maintain a current of I and that the amplitude is small, we will approximate the rates of rise and fall in the current in terms of the voltage across the motor winding when the switch is closed and when it is open:
Von = Vsupply - I(Rwinding + Ron)Here, we lump together all resistances in series with the winding and power supply in the on state as Ron, and we lump together all resistances in the current recirculation path when the switch(es) are open as Roff. The forward voltage drops of any diodes in the current recirculation path have been lumped as Vdiode; if the off-state recirculation path runs from ground to the power supply (H-bridge fast decay mode), the supply voltage must also be included in Vdiode. Forward voltage drops of any switches in the on-state and off-state paths should also be incorporated into these voltages.
Voff = Vdiode + I(Rwinding + Roff)
To solve for the duty cycle, we first note that:
dI/dt = V/LWhere
I -- current through the motor windingWe then substitute the specific voltages for each phase of operation:
V -- voltage across the winding
L -- inductance of the winding
Iripple / Toff = Voff / LWhere
Iripple / Ton = Von / L
Iripple -- the peak to peak ripple in the currentSolving for Toff and Ton and then substituting these into the definition of the duty cycle of the chopper, we get:
D = Ton / (Ton + Toff) = Voff / (Von + Voff)If the forward voltage drops in diodes and switches are negligable, and if the only significant resistance is that of the motor winding itself, this simplifies to:
D = I Rwinding / Vsupply = Vrunning / VsupplyThis special case is particularly desirable because it delivers all of the power to the motor winding, with no losses in the regulation system, without regard for the difference between the supply voltage and the running voltage.
The AC ripple Iripple superimposed on the running current by a chopper can be a source of minor problems; at high frequencies, it can be a source of RF emissions, and at audio frequencies, it can be a source of annoying noise. For example, with audio frequency chopping, most stepper controlled systems will "squeel", sometimes loudly, when the rotor is displaced from the equilibrium position. To find the ripple amplitude, first recall that:
Iripple / Toff = Voff / LThen solve for Iripple:
Iripple = Toff Voff / LThus, to reduce the ripple amplitude at any particular duty cycle, it is necessary to increase the chopper frequency. This cannot be done without limit because switching losses increase with frequency. Note that this change has no significant effect on AC losses; the decrease in such losses due to decreased amplitude in the ripple is generally offset by the effect of increasing frequency.
The primary problem with use of a simple chopping or pulse-width modulation control scheme is that it is completely open loop. Design of good chopper based control systems requires knowledge of motor characteristics such as inductance that are frequently poorly documented, and as with dual-voltage supplies, when motor performance is marginal, it is very tempting to increase the duty-cycle without attention to the long-term effects of this on the motor. In the designs that follow, this weakness will be addressed by introducing feedback loops into the low level drive system to directly monitor the current and determine the duty cycle.
The most common approach to automatically adjusting the duty cycle of the switches in the stepper driver involves monitoring the current to the motor windings; when it rises too high, the winding is turned off for a fixed interval. This requires a current sensing system and a one-shot, as illustrated in Figure 4.7:
Figure 4.7Figure 4.7 illustrates a unipolar drive system. As with the circuit given in Figure 4.3, R1 should be as small as possible, limited only by the requirement that the sense voltage provided to the comparator must be high enough to be within its operating range. Note that when the one-shot output (¬Q) is low, the voltage across R1 no-longer reflects the current through the motor winding. Therefore, the one-shot must be insensitive to the output of the comparator between the time it fires and the time it resets. Practical circuit designs using this approach involve some complexity to meet this constraint!
Selecting the value of R2 for the circuit shown in Figure 4.7 poses problems. If R2 is large, the current through the motor windings will decay quickly when the higher level control system turns off this motor winding, but when the winding is turned on, the current ripple will be large and the power lost in R2 will be significant. If R2 is small, this circuit will be very energy efficient but the current through the motor winding will decay only slowly when this winding is turned off, and this will reduce the cutoff speed for the motor.
The peak power dissapated in R2 will be I2R2 during Toff and zero during Ton; thus, the average power dissapated in R2 when the motor winding is on will be:
P2 = I2R Toff / (Ton + Toff)Recall that the duty cycle D is defined as Ton/(Ton+Toff) and may be approximated as Vrunning/Vsupply. As a result, we can approximate the power dissapation as:
P2 = I2R2 (1 - Vrunning/Vsupply).Given the usual safety margins used in selecting power resistor wattages, a better approximation is not necessary.
When designing a control system based on pulse width modulation, note that the cutoff time for the one-shot determines Toff, and that this is fixed, determined by the timing network attached to the one-shot. Ideally, this should be set as follows:
Toff = L Iripple / VoffThis presumes that the inductance L of the motor winding is known, that the acceptable magnitude of Iripple is known, and that Voff, the total reverse voltage in the current recirculation path, is known and fixed.
Note that this scheme leads to a variable chopping rate. As with the linear current limiters shown in Figure 4.3, the full supply voltage will be applied during the turn-on phase, and the chopping action only begins when the motor winding reaches the current limit set by Vref. This circuit will vary the chopping rate to compensate for changes in the back EMF of the motor winding, for example, those caused by rotor motion; in this regard, it offers the same quality of regulation as the linear current limiter.
The one-shot current regulator shown in Figure 4.7 can also be applied to an H-bridge regulator. The encoded H-bridge shown in Figure 3.13 is an excellent candidate for this application, as shown in Figure 4.8:
Figure 4.8Unlike the circuit in Figure 4.7, this circuit does not provide design tradeoffs in the selection of the resistance in the current decay path; instead, it offers the same selection of decay paths as was available in the original circuit from Figure 3.13. If the X and Y control inputs are held in a running mode (01 or 10), the current limiter will alternate between that running and slow decay modes, maximizing energy efficiency. When the time comes to turn off the current through the motor winding, the X and Y inputs may be set to 00, using fast decay mode to maximize the cutoff speed, while if the damping effect of dynamic braking is needed to control resonance, X and Y may be set to 11.
Note that the current recirculation path during dynamic braking does not pass through R1, and as a result, if the motor generates a large amount of power, burnt out components in the motor or controller are likely. This is unlikely to cause problems with stepping motors, but when dynamic braking is used with DC motors, the current limiter should be arranged to remain engaged while in braking mode!
SGS-Thompson (and others) L293 (1A) and L298 (2A) dual H-bridges are designed for easy use with partial feedback current limiters. These chips have enable inputs for each H-bridge that can be directly connected to the output of the one-shot, and they have ground connections for motor-power that are isolated from their logic ground connections; this allows sense resistors to be easily incorporated into the circuit.
The 3952 H-bridge from Allegro Microsystems can handle up to 2-amps at 50 volts and incorporates all of the logic necessary for current control, including comparators and one-shot. This chip is available in many package styles; Figure 4.9 illustrates the DIP configuration wired for a constant current limit:
Figure 4.9If Rt is 20 Kohm, and Ct is 1000pF, Toff for the pulse-width modulation will be fixed at 20 (±2) microseconds. The 3952 chip incorporates a 10 to 1 voltage divider on the Vref input, so attaching Vref to the 5 volt logic supply sets the actual reference voltage to 0.5 V. Thus, if the sense resistor Rs is 0.5 ohms, this arrangement will attempt to maintain a regulated current through the load of 1 A.
Note that all power switching chips are potentially serious sources of electromagnetic interfence! The 47µF capacitor shown between the motor power and ground should be as close to the chip as possible, and the path from the SENSE pin through Rs to ground and back to a ground pin of the chip should be very short and with a very low resistance.
On the 5 volt side, because Vref is taken from Vcc, a small decoupling capacitor should be placed very close to the chip. It may even be appropriate to isolate the Vref input from Vcc with a small series resistor and a separate decoupling capacitor. If this is done, note that the resistance from the Vref pin to ground through the chip's internal voltage divider is around 50 Kohms.
One of the more dismaying features of the 3952 chip, as well as many of its competitors, is the large number of control inputs. These are summarized in the following table:
In the forward and reverse running modes, the mode input determines whether fast or slow decay modes are used during Toff. In the dynamic braking modes, the mode input determines whether the current limiter is enabled. This is of limited value with stepping motors, but use of dynamic braking without a current limiter can be dangerous with DC motors.
BRAKE ENABLE PHASE MODE OUTa OUTb Notes 0 - - 0 0 0 Brake 0 - - 1 0 0 Limited Brake 1 1 - 0 - - Standby 1 1 - 1 - - Sleep 1 0 0 0 0 1 Reverse, Slow 1 0 0 1 0 1 Reverse, Fast 1 0 1 0 1 0 Forward, Slow 1 0 1 1 1 0 Forward, Fast
In sleep mode, the power consumption of the chip is minimized. From the perspective of the load, sleep and standby modes put the load into fast decay mode (all switches off) but in sleep mode, the chip draws considerably less power, both from the logic supply and the motor supply.
In many cases, motor control systems are expected to operate acceptably with a number of different stepping motors. The one-shot based current regulators illustrated in Figures 4.7 to 4.9 have an accuracy that depends on the inductance of the motor windings. Therefore, if fixed accuracy is required, any motor substition must be balanced by changes to the RC network that determines the off-time of the one-shot.
This section deals with alternative designs that eliminate the need for this tuning. These alternative designs offer fixed precision current regulation over a wide range of load inductances. The key to this approach is arrange the recirculation paths so that the current-sense resistor R1 is always in the circuit, and then turn the switches on or off depending only on the current.
The usualy way to build this type of controller is to use a comparator with a degree of hysteresis, for example, by feeding the output of the comparator back into one of its inputs through a resistor network, as illustrated in Figure 4.10:
Figure 4.10To compute the desired values of R2 and R3, we note that:
Vripple > VhysteresisWhere:
Vripple = Iripple R1and:
Iripple -- the maximum ripple allowed in the current
Vhysteresis = Vswing R2 / (R2 + R3)We can solve this for the ratio of the resistances:
Vswing -- the voltage swing at the output of the comparator
R2 / (R2 + R3) < Iripple R1 / VswingFor example, if R1 is 0.5 ohms and we wish to regulate the current to within 10 milliamps, using a comparator with TTL compatable outputs and a voltage swing of 4 volts, the ratio must be no greater than .00125.
Note that the sum R2 + R3 determines the loading on Vref, assuming that the input resistance of the comparator is effectively infinite. Typically, therefore, this sum is made quite large.
One problem with the circuit given in Figure 4.10 is that it does not limit the current through the motor in dynamic braking or slow decay modes. Even if the current through the sense resistor vastly exceeds the desired current, switches B and D will remain closed in dynamic braking mode, and if the reference voltage is variable, rapid drops in the reference voltage will not be enforced by this control system.
The designers of the Allegro 3952 chip faced this problem, and passed the solution back to the user, providing a MODE input to determine whether the chopper alternated between running and fast decay mode or running and slow decay mode. Note that this chip uses a fixed off-time set by a one-shot, and therefore, switching between the two decay modes will change the precision of the current regulator. Given that such a change in precision is acceptable, we can modify the circuit from Figure 4.10 to automatically thrown the system into fast-decay mode if the running or dynamic braking current exceeds the set-point of the comparator by too great a margin. Figure 4.11 illustrates how this can be done using a second comparator:
Figure 4.11As shown in Figure 4.11, the lower comparator directly senses the voltage across R1, while the upper comparator senses a higher voltage, determined by a resistor network. This network should hold the negative inputs of the two comparators just far enough apart to guarantee that, as the voltage across R1 rises, the top comparator will always open the top switches before the bottom comparator opens the bottom switches, and as the voltage across R1 falls, the bottom comparator will always close the bottom switches before the top comparator closes the top switches.
As a result, this system has two basic steady-state running modes. If the motor winding is drawing power, one of the bottom switches will remain closed while the opposite switch on the top is used to chop the power to the motor winding, alternating the state of the system between running and slow-decay mode.
If the motor winding is generating power, the top switches will remain open and the bottom switches will do the chopping, alternating between fast-decay and slow-decay modes as needed to keep the current within limits.
If the two comparators have accuracies on the order of a millivolt with hysteresis on the order of 5 millivolts, it is reasonable to use a 5 millivolt difference between the top and bottom comparator. If we use the 5 volt logic supply as the pull-up supply for the resistor network, and we assume a nominal operating threshold of around 0.5 volts, the resistor network should have a ratio of 1:900; for example, a 90k resistor from +5 and a 100 ohm resistor between the two comparator inputs.
The basic idea described in this section is also applicable to unipolar stepping motor controllers, although in this context, it is somewhat easier to apply if the reference voltage is measured with respect to the unregulated motor power supply. Figure 4.12 illustrates a practical example, using the forward voltage drop across an ordinary silicon diode as the reference voltage.
The circuit shown in Figure 4.12 uses a 2.4K resistor to provide a bias current of 10ma to the reference diode. A small capacitor should be added across the reference diode if the motor power supply is minimally regulated.
The 0.6 ohm value used for the current sensing resistor sets the regulator to 1 amp, assuming that the reference voltage is 0.6 volts. The 1000 to 1 ratio on the feedback network around the comparator sets the allowed ripple in the regulated current to around 8 ma.
The comparator shown in Figure 4.12 can be powered from the minimally regulated motor power supply, but only if it is able to operate with the inputs very close to its positive supply voltage. Although I have not tried it, the Mitsubishi M5249L comparator appears to be ideally suited to this job; it can work from a positive supply of up to 40 volts, and the input voltages are allowed to slightly exceed the positive supply voltage! The output of this comparator is open collector, so the hysteresis network shown in the figure also acts as a pull-up network, providing a pull-up current of a few milliamps. The diode to +5 shown in the figure clamps the comparator output to the logic supply voltage, protecting the and gate inputs from overvoltage.
The feedback loops of all of the current limiters given above use the voltage drop across a small resistor to measure the current. This is an excellent choice for small motors, but it poses difficulties for large high-current motors! There are other current sensing technologies appropriate for such settings, most notably those that deliver only a fraction of the motor current to the sensing resistor, and those that measure the current by sensing the magnetic field around the conductor.
National Semiconductor had incorporated a very clever current sensor into a number of their H-bridges. This delivers a current to the sense resistor that is proportional to the current through the motor winding, but far lower. For example, on the LMD18200 H-bridge, the sense resistor receives exactly 377 microamps per ampere flowing through the motor winding.
The key to the current sensing technology used in the National Semiconductor line of H-bridges is found in the internal structure of the DMOS power switching transistors they use. These transistors are composed of thousands of small MOSFET transistor cells wired in parallel. A small but representative fraction of these cells, typically 1 in 4000, is used to extract the sense current while the remainder of the cells control the motor current. The data sheet for the National LMD18245 H-bridge contains an excellent writeup on how this is done.
When very high currents are involved, precluding use of an integrated H-bridge, an appealing and well established current sensing technology involves the use of a split ferrite core and a hall effect sensor, as illustrated in Figure 4.13:
Figure 4.13Simple linear Hall effect sensors require a small regulated bias current between two of their terminals, and they generate a DC voltage proportional to the magnetic field on a third terminal. The magnetic field across the gap sawed in the ferrite core is proportional to the current through the wire, and therefore, the voltage reported by the Hall effect sensor will be proportional to the current.
Allegro Microsystems and others make a full lines of Hall effect sensors, but pre-calibrated hall effect current sensors are available; these include the split core, the hall effect sensor, and auxiliary components, all mounted on a small PC board or potted as a unit. Newark Electronics lists a few sources of these, including Honeywell, F. W. Bell and LEM Instruments.
An intriguing new current sensor is just becoming available, as of 1998, based on a thin-film magnetoresistive sensor; the sensitivity of this technology eliminates the need for the ferrite core and the result is a very compact current sensor. The NT series sensors made by F. W. Bell use this technology.