![]() 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. 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. 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. Thus, it is perfect for two-wheeled robots. 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. ![]() The resistance of the coil is 1.5 Ohm per coil.Total inductance by each phase will be 2.8 mH.Total steps for each resolution will be 200. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |