This simple circuit and program listing allows the Maximite microcomputer (SILICON CHIP,
March-May 2011) to control a stepper motor. It could be expanded to
allow for the control of multiple motors, with four of the Maximite’s
external I/O pins used to control each motor with identical driver
circuits. A ULN2003 Darlington transistor array (IC1) switches current
through the stepper motor’s two windings in either direction. When one
of the four Maximite output pins (8, 12, 16 & 20, corresponding to
I/Os 19, 17, 15 & 13) goes high, the corresponding output pin on IC1
goes low, sinking current through a motor winding. Conversely, when
these pins are high, the corresponding Darlington transistor is off and
so no current flows through that portion of the winding.
The centre tap of each motor winding is connected to a current source comprising PNP
Darlington transistor Q1 and some resistors. The maximum current is
determined by the resistive divider driving its high-impedance base,
setting the base voltage to around 9.1V when it is fully on. By adding
Q1’s base-emitter voltage (1.4V at 0.5A, as per the data sheet) we can
determine that there will be around 1.5V across the 3.3O resistor (12V –
10.5V), resulting in a current of 1.5V ÷ 3.3O = ~450mA. Transistor Q1
must be fitted with a medium-sized flag heatsink (Jaycar HH8504,
Altronics H0637) or larger to handle its maximum dissipation of (10.5V –
4.9V) x 450mA = 2.5W.
When one of the Darlington transistors switches off and current flow
through the corresponding motor winding ceases, the inductive winding
generates a back-EMF current which causes the voltage across that winding to spike. IC1 has internal “free-wheeling” diodes from each output to the COM pin, which is connected to the +12V supply. The back-EMF
current flows back into the power supply and the voltage spikes are
clamped at about 12.7V, so that the Darlington transistors do not suffer
collector reverse breakdown, which might damage them.
A 470µF capacitor provides supply bypassing for the motor while a
47kO pull-up resistor and toggle switch/pushbutton S1 drives input pin 9
of the Maximite, allowing manual control of the motor direction. Table 1
shows the sequence in which the output pins are driven to turn the
motor forward; the steps are run backwards for reverse operation. The
delay between the steps determines the speed at which the motor rotates.
The source code of the sample program is available for download from
the SILICON CHIP website (maximite_stepper_motor.bas).