STEPPER MOTOR CONTROL BY L298N MOTOR DRIVER MODULE USING ARDUINO UNO

Stepper Motor Control By L298N  Motor Driver Using Arduino Uno

STEPPER MOTOR CONTROL BY L298N MOTOR DRIVER MODULE USING ARDUINO UNO

If you want a make cnc machine  or want to make a robot or work on a project. where the motor is controlled very precisely.
so you should use a stepper motor.  
Stepper motor is known as step motor. it is type of brush less electric dc motor. 
which moves a discrete steps according to steps resolution of stepper motor.
They have multiple coils and each coils are energized separately  that rotator is moved step by step at time.

Schematics Diagram:- 

Schematics diagram of stepper motor, l298n motor driver module and arduino uno


Circuit Diagram:-

Circuit diagram of stepper motor, l298n motor driver module and arduino uno


Interface Stepper Motor With L298n Motor Driver Module And Arduino Uno

Nema 17 bipolar stepper motor work on 12v and it is 200 steps per resolution and it is can work on 60 rpm .
there are four wires red, green , blue and yellow. The red wire is A+ and green wire is A- and blue wire is B+
and also yellow wire of stepper motor is B-.So here red wire (A+) and green wire (A-) of stepper motor is connected to Output motor A of l298n motor driver module (If want to know about the L298n Motor Driver Module click on this link. )
and blue wire (B+) and yellow wire (B-) of stepper motor is connected to Output motor B of L298n motor driver module.
and  here do not need ENA and ENB of l298n motor driver module so jumper pin is placed on enable pin. Here only we need four input pin IN1, IN2, IN3 and IN4 of motor driver module.
so IN1, IN2, IN3, and IN4 input  pins  of l298n motor driver module is connected to digital pin D11, D10, D9, and D8 of Arduino uno.


Code:-




Firstly You will have to download stepper motor library so open the Arduino IDE on your computer. Goto -> sketch ->include Library -> Manage libraries -> type stepper motor on search bar-> Select version and install it.



 And again goto -> File -> Examples -> Stepper -> stepper_one Resolution


#include <Stepper.h>

// change this to fit the number of steps per revolution
// for your motor

const int stepsPerRevolution = 200;  


// initialize the stepper library on pins 8 through 11:

Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() 
{
  // set the speed at 60 rpm:

  myStepper.setSpeed(60);

  // 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);
}






Post a Comment

0 Comments