PC-Based Stepper Motor Controller

Ashutosh M. Bhatt

0
1289

This stepper motor controller is perhaps the cheapest, smallest and simplest. A pair of H-bridges with a software program written in ‘C++’ is used to control the bipolar stepper motor with a step resolution of 18 degree per pulse.

The controller is a combination of driver and switching circuits. The driver is the actual circuit that drives the stepper motor and the switching circuit decides how the motor should be driven. So, it is basically the switching circuit that controls the motor. The transistors (T1 through T8) act as switches. The switching of these transistors is controlled by the software via data pins D0 through D7.

You can control three parameters of the stepper motor: speed, direction and number of steps. To vary the speed of the motor, you have to vary the pulse repetition frequency (PRF). To change the direction of the motor, you have to change the sequence of pulses applied to its coils. By limiting the number of applied pulses, you can restrict the motor to complete the desired number of steps.

Fig. 1: Circuit of PC-based stepper motor controller
Fig. 1: Circuit of PC-based stepper motor controller

Specifications of the stepper motor
Stepper motors of various ratings/specifications are available in the market for different applications. Here, the stepper motor is taken from an 8.9cm (3.5-inch) floppy drive. It’s a bipolar stepper motor rated at 5V DC with step resolution of 18o per pulse. The motor has two coils inside and four terminals (colour-coded, but not always) for external connections. Stepper motors rated at 5V and up to 1 ampere of current and different step size (e.g., 1.8º per pulse) may also be used with this circuit and control software.

Circuit description
H-Bridge driver. H-Bridge is a standard, well-known circuit widely used as stepper motor driver. It is a bridge connection of four transistors (see Fig. 1). Because there are two coils in the bipolar stepper motor, two H-bridge circuits, one for each coil, have been used. One H-bridge is formed by transistors T1 through T4 and the other bridge is formed by transistors T5 through T8.

Fig. 2: Pin details ofBD139 transistor andregulator IC 7805
Fig. 2: Pin details ofBD139 transistor andregulator IC 7805

Transistors T1 through T8 are BD139 type and should be used with heat-sinks. Pin details of BD139 and regulator IC 7805 are shown in Fig. 2. The bases of all the eight transistors are connected to data pins (D0 through D7) of the 25-pin, D-type male connector through 1-kilo-ohm current limiting resistors R1 through R8.

The bases of transistors T1 and T4 are connected to parallel-port pins 2 (D0) and 3 (D1) through resistors R1 and R2, respectively, and the bases of transistors T2 and T3 are connected to parallel-port pins 4 (D2) and 5 (D3) through resistors R3 and R4, respectively. The red and orange terminals of the first coil (COIL1) are connected to the first H-bridge section as shown in Fig. 1.

The bases of transistors T5 and T8 are connected to pins 6 (D4) and 7 (D5) through resistors R5 and R6, respectively, and the bases of transistors T6 and T7 are connected to pins 8 (D6) and 9 (D7) through resistors R7 and R8, respectively. The yellow and green terminals of the second coil (COIL2) are connected to the second H-bridge section as shown in Fig. 1.

Power supply. The power supply section is shown in Fig. 3. It consists of a 230V AC to 9V AC, 1A secondary transformer (X1), filter, bridge rectifiers and 5V DC regulator 7805 (IC1). The regulated 5V DC is connected to the H-bridge circuits. The circuit ground is shorted to pins 18 through 25 of the D-type parallel-port connector. When switch S1 is closed, LED1 glows to indicate the presence of power in the circuit.

Fig. 3: Power supply for the circuit
Fig. 3: Power supply for the circuit

Operation
Specific sequence of pulses are given to the red and orange terminals of COIL1 and yellow and green terminals of COIL2 to rotate the motor either in clockwise or anticlockwise direction as explained in the following paragraph.

Direction control. In Tables I and II, ‘0’ indicates low logic and ‘1’ indicates high logic. We know that the current flows from high to low. Changing the direction of rotation is nothing but changing the direction of current that flows through the coils.

Speed control. To vary the speed, you have to vary the pulse repetition frequency (PRF). The PRF of 20 Hz means 20 pulses will be given to the stepper motor in one second. Since the step resolution of the motor is 18o/pulse, the motor will rotate 20x18o =360o (one complete revolution) in one second. So the speed of the motor is one revolution per second (RPS) or 60 RPM. Now if you increase the PRF from 20 Hz to 40 Hz, the RPS will also double to 2 RPS (120 RPM).

LEAVE A REPLY

Please enter your comment!
Please enter your name here