Stepper Motor Control using Arduino

Description
     
          Stepper Motor Control using Arduino is a simple project where a Bipolar Stepper Motor is controlled using Arduino UNO. Stepper Motor is a type of brushless DC Motor that converts electrical pulses into distinct mechanical movements i.e. the shaft of a stepper motor rotates in discrete steps. When a computer controls these steps, we can get precise position and speed control. In this project, we are going to design a simple system to control a stepper motor using Arduino. Okey, let's start.
 
Components Required

 1. Arduino UNO   * 1
 2. ULN2003 Stepper Motor Driver   * 1
 3. 28-BYJ48 Stepper Motor   * 1
 4. Bread Board  * 1
 5. Power Supply  
 6. Jumper Wires     

Circuit Diagram














Program

// 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() {
  Serial.begin(9600);
  stepper.setSpeed(200);
}

void loop() {

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

}