Stepper Motor

In this lesson, you will learn a fun and easy way to drive a stepper motor. The stepper we are using comes with its own driver board making it easy to connect to our UNO.

Component Required:

1 x Arduino Uno R3

1 x 830 tie-points breadboard

1 x ULN2003 stepper motor driver module

1 x Stepper motor

1 x 9V1A Adapter

1 x Power supply module

6 x F-M wires (Female to Male DuPont wires) 1 x M-M wire (Male to Male jumper wire)

Stepper Motor:

A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence.

The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. One of the most significant advantages of a stepper motor is its ability to be accurately controlled in an open loop system. Open loop control means no feedback information about position is needed.

This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. Your position is known simply by keeping track of the input step pulses.

ULN2003 Driver Board

Connection Diagram:

Wiring schematic:

Code

After wiring**,** install the Stepper.zip library

#include <Stepper.h>
const int stepsPerRevolution = 1500;
// change this to fit the number of steps per revolution
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
void setup()
{
  // set the speed at 20 rpm:
  myStepper.setSpeed(20);
  // initialize the serial port:
  Serial.begin(9600);
}
void loop() { // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);// step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution); delay(500);
}

Last updated