Maker Pro

Interfacing Stepper Motor with Arduino Uno

February 04, 2020 by rasika Joshi

The project is about how to interface Stepper Motor with Arduino Uno.



1 Arduino IDE

The project is about how to interface Stepper Motor with Arduino Uno.

About Project

Stepper Motor (28-BYJ48) 

Not like a normal DC motor, this one has five wires of all superior colors coming out of it. Steppers motors do not rotate, they step and so they also understood as step motors. Which means, they will move only one step at a time.

These motors have an order of coils present in them and these coils need to be energized in a specific pattern to make the motor rotate. 

When each coil is being energized the motor takes a step and a sequence of energization will make the motor take constant steps, thus making it rotate.

We know that this is a four-phase stepper motor after it had four coils in it. Now, the gear ratio is presented to be 1:64. 

This means the shaft that you notice outside will make one absolute rotation only if the motor inside rotates for 64 times. 

This is due to the gears that are connected in between the motor and output shaft, these gears serve in improving the torque.

Another important parameter is Stride Angle: 5.625°/64. This means that the motor when operates in an 8-step sequence will move 5.625 degrees for each step and it will take 64 steps (5.625*64=360) to finish one complete rotation.

Calculating the Steps per Revolution

In Arduino, we will be exploring the motor in a 4-step sequence so the trail angle will be 11.25° since it is 5.625° for 8 step sequence it will be 11.25° (5.625*2=11.25).

Steps per revolution = 360/step angle

Here, 360/11.25 = 32 steps per revolution.

Why we need Driver modules for Stepper motors?

Most stepper motors will explore only with the guidance of a driver module. This is because the controller module will not be capable to give sufficient current from its I/O pins for the motor to work. So we will use an outside module like the ULN2003 module as a stepper motor driver. 

(Know more about such an IoT Devices)

There are various types of a driver module and the rating of one will change depends upon the type of motor used. The primary origin for all driver modules will be to source/sink enough current for the motor to operate.

Interfacing Stepper motor with arduino.jpg
// Arduino stepper motor control code

#include <Stepper.h> // Include the header file

// change this to the number of steps on your motor
#define STEPS 32

// create an instance of the stepper class using the steps and pins
Stepper stepper(STEPS, 8, 10, 9, 11);

int val = 0;

void setup() {

void loop() {

  if (Serial.available()>0)
    val = Serial.parseInt();
    Serial.println(val); //for debugging


Related Content


You May Also Like