

The L298N is a dual H-bridge motor driver IC designed to control the direction and speed of DC motors and stepper motors. It is widely used in robotics and automation projects due to its ability to drive two motors simultaneously with a maximum current of 2A per channel. The L298N is a versatile and cost-effective solution for motor control, making it a popular choice among hobbyists and professionals alike.








The L298N motor driver module is based on the L298N IC and typically includes additional components like a voltage regulator and terminal blocks for easy wiring. Below are the key technical details:
The L298N module typically has the following pins and terminals:
| Pin Name | Description |
|---|---|
| ENA | Enables motor A (PWM input for speed control) |
| IN1 | Input 1 for motor A (direction control) |
| IN2 | Input 2 for motor A (direction control) |
| ENB | Enables motor B (PWM input for speed control) |
| IN3 | Input 1 for motor B (direction control) |
| IN4 | Input 2 for motor B (direction control) |
| Pin Name | Description |
|---|---|
| VCC | Motor power supply (5V to 35V) |
| GND | Ground connection |
| 5V | Logic power supply (5V) |
| OUT1 | Output 1 for motor A |
| OUT2 | Output 2 for motor A |
| OUT3 | Output 1 for motor B |
| OUT4 | Output 2 for motor B |
Note: Some L298N modules include a jumper to enable the onboard 5V regulator. If the jumper is in place, the module can provide 5V logic power from the motor supply voltage.
Power Connections:
VCC pin (5V to 35V).GND pin.5V pin for logic power.Motor Connections:
OUT1 and OUT2 for motor A, and OUT3 and OUT4 for motor B.Control Connections:
ENA and ENB pins to PWM-capable pins on your microcontroller for speed control.IN1 and IN2 to control the direction of motor A, and IN3 and IN4 for motor B.Logic Power:
5V pin from an external source.Below is an example of how to control a DC motor using the L298N and an Arduino UNO:
// Define control pins for motor A
const int ENA = 9; // PWM pin for speed control
const int IN1 = 8; // Direction control pin 1
const int IN2 = 7; // Direction control pin 2
void setup() {
// Set motor control pins as outputs
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
}
void loop() {
// Rotate motor A forward at 50% speed
analogWrite(ENA, 128); // Set speed (0-255)
digitalWrite(IN1, HIGH); // Set direction
digitalWrite(IN2, LOW);
delay(2000); // Run for 2 seconds
// Rotate motor A backward at 75% speed
analogWrite(ENA, 192); // Set speed (0-255)
digitalWrite(IN1, LOW); // Set direction
digitalWrite(IN2, HIGH);
delay(2000); // Run for 2 seconds
// Stop the motor
analogWrite(ENA, 0); // Set speed to 0
delay(2000); // Wait for 2 seconds
}
Note: Adjust the
ENApin value (0-255) to control the motor speed.
Motor Not Running:
Overheating:
Erratic Motor Behavior:
No Output Voltage:
Can the L298N drive stepper motors? Yes, the L298N can control bipolar stepper motors by using both H-bridge channels.
What is the maximum motor voltage supported? The L298N supports motor supply voltages from 5V to 35V.
Do I need external diodes? Most L298N modules include built-in flyback diodes, but verify this in your specific module's datasheet.
Can I control more than two motors? No, the L298N can control only two DC motors or one stepper motor. For more motors, use additional L298N modules.
By following this documentation, you can effectively use the L298N motor driver in your projects!