In this article, you will learn about the L298N motor driver module in detail. But first, we must answer some basic questions like what is a motor driver, why is it used in a circuit, and what is an H-bridge configuration, etc.
What is a Motor Driver Module?
Image Source: sproboticworks
A motor driver module is a simple circuit used for controlling a DC motor. It is commonly used in autonomous robots and RC cars (L2938N and L293D are the most regularly utilized motor driver chips). A motor driver module takes the low voltage input from a controller like Arduino. This input logic controls the direction of DC motors connected to the driver. To put it in simple words, you can control the direction of DC motors by giving appropriate logic to the motor driver module.
The motor driver module consists of a motor driver IC, which is the heart of the module. The IC alone can control the DC motor but using the module makes the interfacing with Arduino easy.
Why do we need a motor driver module?
All microcontrollers operate on low-level voltage/current signals, unlike motors. For instance, the Arduino or PIC microcontroller can output a maximum voltage of 5V or 3.3V. But a decent DC motor needs at least 5V or 12V. Also, the output current limit of Arduino is relatively very low.
Hence the output of Arduino is not enough to power up the motors. To solve this problem the use of a motor driver is essential. We bridge the gap between the Arduino and motor by introducing a motor driver between them. And to supply the voltage/current required to operate the motor, an external supply is connected to the motor driver module.
What is an L298N Motor Driver?
The L298N motor driver is based on the H-bridge configuration (an H-bridge is a simple circuit that lets us control a DC motor to go backward or forward.), which is useful in controlling the direction of rotation of a DC motor.
It is a high current dual full H-bridge driver that is constructed to receive standard TTL logic levels. It can also be used to control inductive loads e.g. relays, solenoids, motors (DC and stepping motor), etc. An H-bridge schematic looks like this:
Image Source: Wikipedia
The direction of rotation of the motor depends upon the switch positions.
Image Source: Wikipedia
When S1 and S4 are ON and S2 and S3 are OFF, the left side of the motor terminal is more +ve than the other terminal. This causes clockwise rotation of the motor.
When S2 and S3 are ON and S1 and S4 are OFF, the right side of the motor terminal is more +ve than the left terminal. This causes anticlockwise rotation of the motor.
The H-bridge configuration is commonly used to switch the direction of the motor. However, it can also be utilized to ‘brake’ the motor. Which causes the motor to stop instantly as the motor’s terminals are shorted, or to let the motor ‘free rush’ to a stop (coasts), as the motor is viably separated from the circuit.
The table below sums up activity, with S1-S4 corresponding to the diagram above:
|1||0||0||1||Motor turn right|
|0||1||1||0||Motor turn left|
NOTE: L298N has two such h-bridge circuits meaning you can control up to two DC motor using it.
Features of the L298N Motor Driver Module:
- Operating supply voltage up to 46 V
- Total DC current up to 4 A. 2A per channel
- Low saturation voltage
- Overtemperature protection
- Logical input voltage up to 1.5 V
- High noise immunity
L298N Motor Driver Module pinout:
The L298N Motor Driver module consists of an L298 IC Dual H-bridge, 5V 78M05 Voltage Regulator, resistors, capacitor, Power LED, 5V jumper.
2 DC motor output pins, 12-volt external motor power supply, motor direction control pins (IN1, IN2, IN3, IN4), motor output enable pins (ENA, ENB), and a heat sink.
|VCC pin supplies power to the motor. Voltage anywhere between 5 to 35V can be applied. Remember, if the 5V-EN jumper is in place, you need to supply 2 extra volts than the motor’s actual voltage requirement, in order to run the motor at its maximum speed.
GND is the common ground pin.
5V pin supplies power to the switching logic circuitry inside the L298N IC. If the 5V-EN jumper is in place, this pin acts as output and can be used to power up the Arduino. If the 5V-EN jumper is removed, you need to connect it to the 5V pin on Arduino.
ENA pins are utilized to control the speed of Motor A. Supplying this pin with HIGH logic makes the Motor A rotate, supplying it with LOW logic causes the motor to stop. Removing the jumper and connecting this pin to the PWM input let us control the speed of the Motor A.
IN1 & IN2 pins are used to control the direction of Motor A. If IN1 is HIGH and IN2 is LOW, Motor A spins in a certain direction. To change the direction, make IN1 LOW and IN2 HIGH. If both the inputs are either HIGH or LOW, the Motor A stops.
IN3 & IN4 pins are used to control the direction of the Motor B. If IN3 is HIGH and IN4 is LOW, Motor B spins in a certain direction. To change the direction, make IN3 LOW and IN4 HIGH. If both the inputs are either HIGH or LOW, the Motor B stops.
ENB pin can be used to control the speed of Motor B. Supplying this pin with the HIGH signal makes the Motor B turn, supplying it LOW cause the motor to stop. Eliminating the jumper and interfacing this pin to PWM information let us control the speed of Motor B.
OUT1 & OUT2 pins are connected to Motor A.
OUT3 & OUT4 pins are connected to Motor B.
PINOUT of L298N Motor Driver IC:
|L298N IC pins||Name||Function|
|1,15||Sense A, Sense B||Between this pin and the ground, a sense resistor is connected to control the current of the load.|
|2,3||Out 1, Out 2||Outputs of the Bridge A; the current that flows through the load connected between these two pins is monitored at pin 1.|
|4||VS||Supply Voltage for the Power Output Stages. A non-inductive 100nF capacitor must be connected between this pin and ground.|
|5,7||Input 1, Input 2||TTL Compatible Inputs of the Bridge A.|
|6,11||Enable A, Enable B||TTL Compatible Enable Input: the L state disables the bridge A(enable A) and/or the bridge B (enable B).|
|9||VSS||Supply Voltage for the Logic Blocks. (A100nF capacitor must be connected between this pin and ground.)|
|10,12||Input 3, Input 4||TTL Compatible Inputs of the Bridge B.|
|13,14||Out 3, Out 4||Outputs of the Bridge B. The current that flows through the load connected between these two pins is monitored at the pin.|
Where to Buy L298N Motor driver?
You can easily find this motor driver module in your local electronics store. For online purchases, we recommend this best deal on Amazon:
L298N motor driver IC Datasheet:
Click this link to view the DATASHEET.
You can find detailed information on L298N IC in the datasheet given above. Specifications and information like Absolute maximum ratings, Block diagram, and suggested circuits can be found in the datasheet.
Circuit Connection of L29N with Arduino UNO:
Circuit connections of Arduino with L298N
Image Source: hackster.io
1 thought on “L298N Motor Driver Pin Diagram, Working, Datasheet & Arduino Connection”