Controlling High Current Stepping Motors

Copyright, Peter H. Anderson
Department of Electrical Engineering
Morgan State University, Baltimore, MD 21239
Oct 31, 96

Figures 1, 2 and 3


This section deals with controlling high current stepping motors using such n-channel FETs as Harris's IRF530 and IRF540 devices. Other discussions in Volume 1 and in this Volume have focused on the control of steppers, but all have assumed a maximum cur rent per winding of nominally 500 mA which is the rating of the Allegro ULN2803A octal driver. This discussion focuses on driving motors requiring 5 or 10 amps per winding. Although confined to high current steppers, the drivers may also be used to cont rol such high current devices as lamps, automobile headlights and DC motors.

Availability of Parts.

The IRF530 and 540 devices may be inexpensively obtained from B.G. Micro for $0.99 and $1.99, respectively. A full line of power FETs is available from Digikey. The 4N35 optoisolator and heat sinks for the FETs may be obtained from a variety of sources including Jameco, Hosfelt and Circuit Specialists. A typical cost for the four driver circuits required for controlling one high current stepper is in the range of $5.00 to $10.00.


A driver which is capable of interfacing with TTL is illustrated in Figure #1.

When the TTL output is at logic zero, the optoisolator is on and thus voltage V_gs is less than 2.0 Volts and the FET is off. When the TTL output is at logic one, the output of the optoisolator is off, V_gs rises to +12V, turning on the FET, thus energ izing the associated winding.

One disadvantage of this approach is that if the TTL outputs assume a false logic one, or if the external +5 V supply is lost, the optoisolator is off and the driver is on. When using four such drivers to control a high current stepper, the result might be undesirable; an unconnected cable or an unpowered PC might well cause current to flow in all windings for an indefinite period of time. (Anticipating and designing to avoid such trouble conditions are your responsibility as a electrical engineer).

Thus, in Figure #2, the driver has been revised to avoid this. If TTL output "OFF" is at a logic one, as would be the case with a disconnected cable, or, if the external +5V source is off, the associated optoisolator is off which turns on the NPN transis tor (2N2222 or 2N3904 or similar) which pulls the V_gs down to nominally 1.0 Volt, thus holding the FET in an off condition. The series diode permits this mechanism to be used on all four drivers associated with driving a stepping motor as shown in Figur e #3.

Note that the FET is on, only if TTL output X is at logic zero and TTL output OFF is at logic zero and there is an external source of +5VDC.

Figure #3 illustrates an arrangement to control a high current stepper using four such drivers connected to the parallel port Note that the lower four bits are used to control which winding is energized. For normal operation, Data bit 7 is at zero. All drivers are turned off when bit 7 is at logic one.


A simple program is shown in STEP_HI.C.

/* Program HI_STEP.C
** Uses functions to turn specified motor in specified direction at 
** defined speed for specified duration.
** Peter H. Anderson, Oct 30, '96

#include <stdio.h>
#include <dos.h>
#include <sys\timeb.h>

#define DATA 0x03bc

#define CW 1
#define CCW 0

int data = 0x00;

void turn_motor (int dir, int time, int duration);
void advance_one_step(int dir);
void pause_motor(int time);

void main (void)

   turn_motor(CW, 50, 5000);
   /* turn motor CW slow for 5 secs */

   turn_motor(CW, 25, 5000);
   /* turn motor CW, fast for 5 secs */

   pause_motor(5000);         /* pause for 5 secs */

   turn_motor(CCW, 50, 5000);
   /* turn motor CCW slow for 5 secs */
   turn_motor(CCW, 25, 5000);
   /* turn motor CCW faster for 5 secs */

   outportb(DATA, 0x80);  /* stop motor - Bit 7 to one */

void turn_motor(int dir, int time, int duration)
   struct timeb t_curr, t_start;
   int t_diff;

      t_diff = (int) (1000.0 *(t_curr.time - t_start.time)
             + (t_curr.millitm - t_start.millitm));
   while (t_diff < duration);

void pause_motor (int duration)
   struct timeb t_curr, t_start;
   int t_diff;

      t_diff = (int) (1000.0 * (t_curr.time - t_start.time)
             + (t_curr.millitm - t_start.millitm));
   while (t_diff < duration);

void advance_one_step(int dir)
    static int patts[8] = {0x01, 0x03, 0x02, 0x06, 
                           0x04, 0x0c, 0x08, 0x09};
    static int index = 0;
       if(index == 8)
          index = 0;
    outportb(DATA, patts[index]);

Thermal Considerations.

The limiting factor in the amount of current which may be switched is a thermal consideration. The following discussion is intended to aid you in selecting the appropriate device for your application.

The drain to source resistance (r_ds) for various FETs is shown in the following table;

     IRF510, 511    0.6 Ohms
     IRF512, 513    0.8 Ohms

     IRF520, 521    0.3 Ohms
     IRF522, 523    0.4 Ohms

     IRF530, 531    0.18 Ohms
     IRF532, 533    0.25 Ohms

     IRF540, 541    0.085 Ohms
     IRF542, 543    0.11 Ohms

(Note that the difference between the first and second device on each of the above lines is the maximum voltage between the drain and source. For the first it is 100VDC and for the second it is 60V).

The maximum junction temperature (T_J_max) is 150 degrees C.

Various thermal conductivities for all devices;

     Junction to Ambient (R_theta_ja)        80 degrees C /W
     Junction to Case    (R_theta_jc)        1.0 degrees C/W
     Case to Sink        (R_theta_cs)        1.0 degrees C/W

No Heat Sink.

For a device with no heat sink, the maximum power that may be dissipated by the device is;

     P_max = (T_J_max - T_ambient) / R_theta_ja

Thus the maximum current (I_max) or minimum r_ds may be calculated using the relationship

     P_max = I_max^2 * r_ds

     I_max = sqrt(P_max / r_ds)
or   r_ds_min = P_max / I_max^2

For example, assume T_ambient is 30 degrees C. P_max is then;

     P_max = (150 - 30) / 80 = 1.5W

Assuming, the application requires 5A, r_ds_min is calculated;

     r_ds_min = 1.5 / (5.0^2) = 0.06 Ohms    

Gee! None of the above devices will do the job. In fact, for an ambient temperature of 30 degrees C, the maximum current which an IRF540 will handle is;

     I_max = sqrt(1.5/0.085) = 4.2 A

One might argue that the winding is only operated 50 percent of the time, and this is true if the motor is not halted while holding current is maintained.

Heat Sink.

Inexpensive ($0.50) heat sinks having a thermal conductivity (R_theta_sa) of 11 degrees C / Watt are available for TO-220 packages. Let's revisit the same problem using such a heat sink.

The thermal conductivity of the junction to ambient (formerly 80 degrees C / Watt) is now;

     R_theta_ja = R_theata_jc + R_theta_cs + R_theta_sa
                = 1.0 + 1.0 + 11 = 13 degrees C /W

The maximum power is then;

     P_max = P_max = (150 - 30) / 13 = 9.2W

Assuming, the application requires 5A, r_ds_min is calculated;

     r_ds_min = 9.2 / (5.0^2) = 0.369 Ohms   

Note that the IRF520 or 521 will do the job.

Note that with the inexpensive heat sink, a IRF540 can handle a current of;

     I_max = sqrt(9.2/0.085) = 8.54 A

The reader may well ask, why the manufacturer rates the IRF540 at 27A. They assume a T_ambient of 25 degrees C and a perfect heat sink, that is; that you can keep the temperature of the case at 25 degrees C.

As a note, I have had students investigate the effect of blowing air using a small 4 inch muffin fan across a TO-220 package with a typical heat sink from a distance of six inches. The result is impressive. We have found we can drop the effective therma l conductivity of the heat sink to 2.0 degrees C / Watt. Thus, for a T_ambient of 30 degrees C, P_max = (150 - 30) / 4 = 30 Watts. The I_max for an IRF540 is then sqrt(30/0.085) = 18.75 Watts. However, my students are undergraduate students and we are not specially equipped to do this type of thing and you should confirm the effect of circulating air in your application. I can say that I have reviewed enough lab reports to conclude there is an improvement in the thermal conductivity over the no heat sink and no air case of better than 50. It always makes me wonder how long my Pentium would last if the fan were to fail!