![]() ![]()
#L298N STEPPER MOTOR DRIVER CONTROLLER BOARD MODULE MANUAL CODE#To see the demonstration of the above code, upload the code to Arduino. #L298N STEPPER MOTOR DRIVER CONTROLLER BOARD MODULE MANUAL SERIAL#Additionally, we will print the type of rotation in the serial monitor as well. Between the two types of rotations we will have a delay of 0.5 second. Likewise, to rotate the motor anti-clockwise we will pass the steps per revolution with a negative sign inside the step() method. Hence the motor will rotate at steps of 200 per revolution. Inside the loop() function, we will first rotate the motor clockwise by using the step() method and passing the steps per revolution as the argument inside it. In our case we are setting the stepper motor speed to 60 revolutions per minute. We will use the setSpeed() method on the motor instance and pass the speed of the motor in rpm as an argument inside it. Inside the setup() function, Serial.begin() is used to establish the serial connection between the development board at a baud rate of 115200. It is IN1, IN3, IN2, and IN4 for the stepper motor. Make sure you specify the input pins in their correct sequence. Now we will create an instance of the Stepper library called motor() and pass the steps per revolution and the individual motor input pins as arguments. However, you can use any other suitable Arduino digital pins as well. As you can see we have used the digital pins 9,8,7 and 6 to connect with IN1, IN2, IN3 and IN4 respectively. ![]() Next, we will define the input pins of the motor connections with the Arduino board. const int steps_per_rev = 200 //Set to 200 for NIMA 17 and set to 48 for 28BYJ-48 If using 28BYJ-48 instead set the value to 48. This is the number of steps our motor requires to move one complete revolution. The next step is to define the steps per revolution. This library provides useful functions that make it easy to control the stepper motor. ![]() Serial.println("Rotating Anti-clockwise.") įirstly, we will include the Stepper.h library. Stepper motor(steps_per_rev, IN1, IN2, IN3, IN4) We have used GPIO9, GPIO8, GPIO7 and GPIO6 respectively to connect with each of the input pins of the motor driver.Ĭonst int steps_per_rev = 200 //Set to 200 for NIMA 17 Then, we have connected the input pins IN1, IN2, IN3 and IN4 with digital pins of the Arduino UNO. We are keeping the 5V Enable jumper in its place as it will power up the L298N motor driver. To avoid damage the voltage stabilizing chip, please use an external 5V logic. Likewise, the red wire is B+ and the blue wire is B- hence they will connect with OUT3 and OUT4 respectively.Ĭonnect positive terminal of 12V power supply with 12V terminal and negative terminal of power supply with common ground. Can drive one 2-phase stepper motor, one 4-phase stepper motor or two DC motors. In our case, black wire is A+ and green wire is A- hence they will connect with OUT1 and OUT2 respectively. Connect the stepper motor’s coloured wires with correct output pins of the driver module. This will enable us to properly connect the motor with the OUT1, OUT2, OUT3 and OUT4 pins of the driver module. The diagram below shows all the components consisting inside the module.Īrduino UNO with L298N Motor Driver and Stepper Motorįor which ever stepper motor you are using refer to its datasheet to find the correct coloured wires to differentiate the A+, A-, B+ and B- wires. The L298N motor driver module consists of an L298N motor driver IC, 78M05 5V regulator, 5V jumper enable, power LED, heat sink, resistors, and capacitors all combined in an integrated circuit. This module is mainly used in robotics and in controlling dc and stepping motors. This module can use the built-in 78M05 to take power by driving the power section, but in order to avoid damage to the regulator chip, when use is greater than the drive voltage of 12V, use an external 5V logic supply. ![]() Thus, it is perfect for two-wheeled robots. This module uses ST's L298N chip as the main driver, driving ability, low heat, strong anti-interference ability. It is widely used in controlling robots as we can connect up to four motors at once but if we want to control the speed and direction as well then it allows two dc motors or a single stepper motor to be connected. The L298N motor driver module is very easy to use with Arduino and relatively inexpensive as well.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |