ULN2003 Stepper Driver Board and 12V 28BYJ-48 Motor Test
Description
The ULN2003 Stepper Driver Board is a great match for the 28BYJ-48 Unipolar Stepper Motor. Here are some quick instructions to get you started.
Equipment
Arduino UNO or similar
ULN2003 Stepper Motor Driver Board
12V 28BYJ-48 Stepper Motor
Connections
Connect GND and Vcc on the ULN2003 Driver Board to GND and 5VDC on the Arduino (just for the initial test).
Connect Arduino pins 8, 9, 10, 11 to IN1, IN2, IN3, IN4 on the ULN2003 Driver Board respectively.
Upload the example code. Note that the sequence of the pins in the code is 8,10,9,11. If this is different the stepper will just sit and vibrate.
The stepper should rotate slowly in one direction and then in the other.
To test the full strength and speed of the stepper motor connect a separate 12VDC power supply to the Vcc and GND on the ULN2003 Stepper Driver Board. Make sure the GND is common to both the Arduino and the ULN2003 Driver Board.
The 28BYJ-48 Stepper is an inexpensive, strong but slow motor.
Example Code
/*
Stepper Motor Control - one revolution
This program is an example of how to drive the 28BYJ-48 12VDC unipolar stepper motor using the ULN2003 Stepper Driver Board
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
Modifications to the original program:
- One complete revolution is 2048 steps for the 28BYJ-48 stepper motor
- The speed needed to be reduced to 4
depending on how much voltage you are using or the
motor will just vibrate and not move.
- The sequence wiring sequence has been changed to 8, 10, 9, 11 in order
to allow a straight connection from the Arduino pins 8, 9, 10, 11 to IN1, IN2, IN3, IN4 respectively.
Created 11 Mar. 2007
by Tom Igoe
Modified August 28, 2012
by Bentley Born
*/
#include <Stepper.h>
const int stepsPerRevolution = 2048; //this has been changed to 2048 for the 28BYJ-48
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,10,9,11); //note the modified sequence
void setup() {
// set the speed (needed to be reduced for the 28BYJ-48):
myStepper.setSpeed(4);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(1000);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(1000);
}