Stepper Motor

In this project, you'll learn how to control a stepper motor with the Arduino.

A stepper motor can turn complete circles in either directions in increments of one step at a time. A ULN2003 Darlington driver chip is needed to control the motor.
Parts needed:
  • Arduino
  • Stepper motor
  • ULN2003 Darlington driver IC
  • Wires
  • Breadboard
Stepper motor
1 Making the connections

The stepper motor has five connection wires: red, orange, yellow, pink and blue. These five wires are already connected to the ULN2003 Darlington driver chip.

From the ULN2003 Darlington driver chip, six connections are made to the Arduino:
  • Connect IN1 to pin 8 on the Arduino.
  • Connect IN2 to pin 9 on the Arduino.
  • Connect IN3 to pin 10 on the Arduino.
  • Connect IN4 to pin 11 on the Arduino.
  • Connect GND or - to GND on the Arduino.
  • Connect VCC or + to 5V on the Arduino.
Servo motor connections
2 Create a new BareMinimum program and type in this code.
void motor(int orange, int yellow, int pink, int blue) {
  // each call will rotate the motor one step
  digitalWrite(8, orange);
  digitalWrite(9, yellow);
  digitalWrite(10, pink);
  digitalWrite(11, blue);

void setup() {
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);

void loop() {
  for(int i=0; i<512; i++){  // clockwise
  for(int i=0; i<512; i++){  // counter clockwise
3 Run the program and you should see the stepper motor turning clockwise and counter clockwise.