L298N is a very popular driver to control the motors of the robot. In this column, we will use interface ARDUINO with Motor Driver L298N. One Motor Driver can control two motors.
Key Features of L298N Motor Driver
This motor driver can operate till 35V.
- L298N works on the principle of Dual H Bridge.
- It contains a 5v voltage regulator with it.
- The maximum current it can handle is 2amp.
- The maximum power consumption of the driver is 20W.
- L298N can control the speed of the motors.
- It has different ports to connect the battery, motors, and ARDUINO.
Connection of Motor Driver with Arduino
- The Motor Driver has two pairs of ports on either side as shown in the image below. These ports are connected to the pair of DC Motors.
- On the front side, it contains three green phoenix connectors- 12v VCC, GND and 5v output.
- There are six pairs of mail buck pins- INPUT 1, INPUT2, INPUT3, INPUT4, ENABLE A, and ENABLE B.
- INPUT 1 & 2 pins are the positive and negative terminals of Motor 1.
- INPUT 3 & 4 pins are the positive and negative terminals of Motor 2.
- ENABLE A & B are the PWM pins and these pins are connected to the Arduino to control the speed of the Motor 1 & 2.
How does the Dual H-Bridge Works
The H bridge is an electronic circuit that switches the polarity of the voltage that is applied to the load. These circuits are often used in robotics and other applications to allow DC motors to run forward or backward
Arduino Code Explanation
If everything is correctly done, then the motor output will be-
- Initially, MOTOR 1 is rotated in a clockwise direction.
- After 3 seconds it is rotated in an anticlockwise direction.
- Now after 3 seconds MOTOR 2 will rotate in the anticlockwise direction.
- Then after 3 seconds, again the MOTOR 1 is rotated in the clockwise direction.
- After 3 seconds MOTOR 2 is rotated in the clockwise direction.
Follow me on Instagram
By @robotic_electronics –