Hardware Reference
In-Depth Information
Solution
If your stepper motor has five or six wires, it's a
unipolar
stepper and is wired differently
than the bipolar. Here, we'll use a
ULN2003 Darlington Transistor Array IC
to drive the
motor.
Here's what you will need:
▪ Breadboard and jumper wires (see
“Prototyping Equipment”
)
▪ 3 V to 5 V unipolar stepper motor (see
“Miscellaneous”
)
▪ ULN2003 Darlington Transistor Array IC (see
“Integrated Circuits”
)
Wire, as shown in
Figure 4-11
.
NOTE
The IC in
Figure 4-11
is illustrated upside down from the way it is usually displayed. That is,
the notch for pin 1 is on the bottom. This made drawing the diagram much cleaner.
Also, notice the
banded
wire running the
P9_7
(5 V) to the UL2003A. The stepper motor I'm
using runs better at 5 V, so I'm using the Bone's 5 V power supply. The signal coming from the
GPIO pins is 3.3 V, but the U2003A will step them up to 5 V to drive the motor.
Figure 4-11. Unipolar stepper motor wiring
The code for driving the motor is in
unipolarStepperMotor.js
; however, it is almost identic-
al to the bipolar stepper code (
Example 4-4
)
, so
Example 4-5
shows only the lines that you
need to change.