FORGE
Left
Simplified coil wiring
schemes for unipolar
(left) and bipolar
(right) stepper
motors. Bipolar
motors are often
used in 3D printers
and laser cutters
Figure 1
Wiring up the
28BYJ-48 circuit to
the Arduino and driver
is simple – six wires
and one plug to fit
complicated, needing two full H-bridges to be able to
reverse the current direction in each coil. Fortunately,
due to the huge growth in 3D printing and CNC
machinery, there are some relatively inexpensive
solutions available to drive bipolar steppers. The
Allegro A4988-based ‘stepstick’ driver board is a very
popular, inexpensive choice (£1–2 on eBay). As to
the motors themselves, the NEMA 17-sized bipolar
steppers, commonly used in 3D printers, can be
found on eBay from £5.
28BYJ-48 USAGE
The 28BYJ-48 is a small, low power, 5 V stepper with
32 full steps per rotor revolution. The rotor shaft
is connected to a 64:1 reduction gearbox which
transforms it into a 2048 step motor, and gives it a
reasonable amount of torque for a low power motor.
It’s ideal for small robots, hobby projects, and
educational use because it’s small, cheap, easy to
wire, and can run from the Arduino 5 V rail, with no
extra external PSU.
The main disadvantage is that the gearbox slows
down the maximum output shaft rotational speed to
at least 8 rpm.
Connect up your wiring according to the
circuit diagram – Figure 1, below.
Using the Arduino IDE on your computer,
flash the sketch Nano_stepper_28BYJ-48.ino
(hsmag.cc/xLXbny) to your Arduino, and make
sure that the jumper on the ULN2003 driver board is
attached (this connects the motor to the +5 V rail).
If everything goes according to plan, your motor
should rotate alternately 360° clockwise, then 360°
anti-clockwise, with one second pauses, until you
remove the power.
CRACKING THE CODE
Next up comes the coding:
#include <Stepper.h>
#define Steps_per_motor_revolution 32
#define Steps_per_output_revolution 32 * 64
int Steps_travel;
Lines 1–4 load the built-in Arduino Stepper
library and initialise some variables. Note that
motor_revolution and output_revolution are not the
same thing as we have a 64:1 reduction gearbox.
Stepper small_stepper(Steps_per_motor_revolution,
11, 9, 10, 8);
YOU’LL NEED
28BYJ-48 stepper
motor and
ULN3008 driver
(eBay)
NEMA 17-style
bipolar stepper
motor
A4988 ‘stepstick’
driver board
(eBay)
8–12 V power
source
Arduino Nano or
compatible board
Breadboard
and wires
100 μF
electrolytic
capacitor
ROTOR
ROTOR
UNIPOLAR BIPOLAR
5 Wire 4 Wire