USBasp/Arduino stepper controller

This is a 10Pin project, using USBasp hardware connected it to a inexpensive 28BYJ-48 Stepper and ULN2003 driver from eBay, and an Arduino sketch to control the stepper.

10P Stepper 1

28BYJ-48 Stepper & UNL2003 Driver

Connections

ICSP Pin Arduino Pin Driver Board
MISO D12 IN 1
SCK D13 IN 4
RST D10 IN 2
MOSI D11 IN 3
VCC N/A +
GND N/A

Arduino Code

#include <Stepper.h>

const int stepsPerRevolution = 2048; 
Stepper myStepper(stepsPerRevolution,12,10,11,13);           
void setup() {
 pinMode(12, OUTPUT);
 pinMode(13, OUTPUT);
 pinMode(10, OUTPUT);
 pinMode(11, OUTPUT);
 myStepper.setSpeed(6);
}
void loop() {
 myStepper.step(stepsPerRevolution);
 delay(500);
 myStepper.step(-stepsPerRevolution);
 delay(500);
}

Notes

The 28BYJ-48 Stepper has 2048 steps per revolution.  With the example code above the stepper  cannot do more than about 14 RPM.  With the above code, the stepper will rotate 360 degrees in one direction pause for 1/2 second and then rotate 360 degrees in the opposite direction.

More Info

See the Project Ten Pin for more information.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>