Stepper Motor

Interfacing Stepper Motor with Arduino Uno

Stepper motors are increasingly taking their position in the world of electronics. Starting from a normal Surveillance camera to a complicated CNC machine/Robot these Stepper Motors are used everywhere as actuators since they provide accurate controlling. In this tutorial, we will learn about the most commonly/cheaply available stepper motor 28-BYJ48 and how to interface it with Arduino using the ULN2003 stepper module.

All steppers motors do not rotate, they step and so they also known as step motors. Meaning, they will move only one step at a time. These motors have a sequence of coils present in them and these coils have to be energized in a particular fashion to make the motor rotate.

More details: ULN2003 | DC Motor | Servo Motor

Components

Arduino Unox 1
Stepper Motorx 1
ULN2003 Modulex 1
Jumper Wirex 11
Bread Boardx 1

Steps:

  1. Connect the Stepper Motor pins as shown in the image. Connect the wires as shown with the help of Color Code.
    Red –> +5V
    Black –> GND
    Orange –> GPIO-08
    Yellow –> GPIO-09
    Pink –> GPIO-10
    Blue –> GPIO-11
  2. Make sure VCC and GND not short.
  3. Upload the code mentioned for Arduino UNO.
  4. Open the Serial Monitor to see the readings.

Circuit:

Code:

/*the code is written for Arduino UNO, but can run on any
Arduino Board with required modification */

#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;
//initializing the value for rotation
		
void setup() {
  Serial.begin(9600);
  //Set serial out if we want debugging

  stepper.setSpeed(200);
  //setting the speed
}
		
void loop() {
  if (Serial.available() > 0){
    val = Serial.parseInt();
    stepper.step(val);
    Serial.println(val); //for debugging
  }
}		

Helpful Resources:

ULN2003 | DC Motor | Servo Motor

Related Projects:

Stepper-Speed Control | Robotic Arm

Follow us on:

Source: Platforuma

Leave a Comment

Your email address will not be published. Required fields are marked *

EXTRA ₹999 OFF on Lock-Down Live Learning!

Join Now!
X myStickymenu