A microcontroller that normally operates on 5V or 3.3V cannot be directly used to control a DC motor operating on higher voltage and current rating. This is why we commonly use Motor Driver modules like the L293D Motor Driver Module and the L298N Motor Driver Module. While the L293D motor driver module can be used for basic low current application the L298N Motor driver module is a high current motor driver with some additional features that are commonly used with Arduino and Raspberry Pi for Robotics applications.
The L298N Motor Driver module is based on the L298 Dual Full-Bridge Driver IC and can control the speed and direction of two DC motors (Motor A and Motor B) simultaneously. The voltage rating of these motors can be between 5V to 35V and the peak current value can be up to 2A. The pinout diagram of the L298N Motor Driver Module is shown below.
The motors to be controlled (Motor A and B) are connected to screw terminals. The voltage required to power the motor is provided to the Motor Power and Ground screw terminal, the voltage range should be between 7V to 35V. The L298 IC requires 5V to operate, this is why we have a built-in 5V Linear Regulator. If the operating voltage of the motor is less than or equal to 12V than the built-in regulator will power the driver IC, and this regulated 5V can also be obtained as an output voltage from the 5V screw terminal which can be used to power your microcontrollers like Arduino. If the operating voltage of the motor is greater than 12V then the built-in regulator will not be able to handle it, so we have to disconnect the regulator by removing the 5V Select Jumper pin and provide a separate 5V power as an input voltage to the 5V screw terminal to power our L298N Driver IC.
The pins Enable A and Enable B are used to set the speed of the motor. By default, there will be jumper pins connected to both Enable A and B to make them high (5V), this way the motors will rotate at maximum speed. You can adjust the speed of the motors by removing the jumper and providing a variable voltage between 0V to 5V by using a PWM signal.
Finally, the four input pins Input 1, 2, 3, and 4 are used to control the direction of the motor. For example, if Input 1 and Input 2 are made High and Low, respectively, then Motor A will rotate in clockwise. If they are made Low and High, then the motor will rotate counterclockwise. The same logic applied for Input 3 and 4 with Motor B.
Specifications of L298N Motor Driver IC:
- Input Voltage: 3.2V to 40Vdc
- Driver: L298N Dual H Bridge DC Motor Driver
- Operating voltage: DC 5V – 35V
- Peak Current: 2 Amps
- Speed Control: PWM
- Control Signal input Low voltage range: 0.3V ≤ Vin ≤ 1.5V
- Control Signal input High voltage range: 2.3 ≤ Vin ≤ Vss
- Enable signal input low voltage range: 0.3V ≤ Vin ≤ 1.5V (enable signal inactive)
- Enable signal input high voltage range: 2.3V ≤ Vin ≤ Vss (enable signal active)
- Maximum power consumption: 20W (when the temperature T = 75℃)
- Onboard +5V regulated Output supply
The basic dimensions of the L298N Motor Driver module are shown below.
Additional Resources: