

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, automation, and other motor control applications due to its ability to drive two motors simultaneously. With a current handling capacity of up to 2A per channel and a wide operating voltage range, the L298N is a versatile and reliable choice for motor control in various projects.








The L298N IC is often used in a module form, which includes additional components like a voltage regulator and terminal blocks for easier connections. Below is the pin configuration for the L298N module:
| Pin Name | Type | Description |
|---|---|---|
| IN1 | Input | Controls the direction of Motor A (High/Low). |
| IN2 | Input | Controls the direction of Motor A (High/Low). |
| IN3 | Input | Controls the direction of Motor B (High/Low). |
| IN4 | Input | Controls the direction of Motor B (High/Low). |
| ENA | Input (PWM) | Enables and controls the speed of Motor A (PWM signal). |
| ENB | Input (PWM) | Enables and controls the speed of Motor B (PWM signal). |
| OUT1 | Output | Connects to one terminal of Motor A. |
| OUT2 | Output | Connects to the other terminal of Motor A. |
| OUT3 | Output | Connects to one terminal of Motor B. |
| OUT4 | Output | Connects to the other terminal of Motor B. |
| Vcc | Power Input | Motor power supply (5V to 46V). |
| GND | Power Ground | Ground connection for the circuit. |
| 5V | Power Output | Provides 5V output (used when the onboard regulator is active). |
Note: The onboard voltage regulator allows the module to provide 5V output when the input voltage (Vcc) is greater than 7V. If using a 5V power source, the jumper on the module should be removed.
Power Connections:
Vcc terminal (5V to 46V).GND terminal.Motor Connections:
OUT1 and OUT2.OUT3 and OUT4.Control Connections:
IN1, IN2, IN3, and IN4 for direction control.ENA and ENB for speed control.Logic Power:
5V pin.Below is an example of how to control a DC motor using the L298N module and an Arduino UNO:
IN1 → Arduino pin 8IN2 → Arduino pin 9ENA → Arduino pin 10 (PWM)OUT1 and OUT2 → DC motor terminalsVcc → External motor power supply (e.g., 12V)GND → Common ground (Arduino and power supply)// Define control pins for Motor A
const int IN1 = 8; // Direction control pin 1
const int IN2 = 9; // Direction control pin 2
const int ENA = 10; // Speed control (PWM pin)
void setup() {
// Set motor control pins as outputs
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENA, OUTPUT);
}
void loop() {
// Rotate motor forward at 50% speed
digitalWrite(IN1, HIGH); // Set IN1 high
digitalWrite(IN2, LOW); // Set IN2 low
analogWrite(ENA, 128); // Set ENA to 50% duty cycle (128/255)
delay(2000); // Run motor for 2 seconds
// Rotate motor backward at 75% speed
digitalWrite(IN1, LOW); // Set IN1 low
digitalWrite(IN2, HIGH); // Set IN2 high
analogWrite(ENA, 192); // Set ENA to 75% duty cycle (192/255)
delay(2000); // Run motor for 2 seconds
// Stop the motor
digitalWrite(IN1, LOW); // Set IN1 low
digitalWrite(IN2, LOW); // Set IN2 low
analogWrite(ENA, 0); // Set ENA to 0% duty cycle (stop)
delay(2000); // Wait for 2 seconds before repeating
}
Motors Not Running:
Overheating:
Erratic Motor Behavior:
No 5V Output:
Can the L298N drive stepper motors? Yes, the L298N can control stepper motors by using both H-bridge channels. Refer to stepper motor control examples for details.
What is the maximum motor voltage supported? The L298N supports motor voltages up to 46V.
Can I use the L298N with a 3.3V microcontroller? The L298N requires 5V logic levels, so a level shifter may be needed for compatibility with 3.3V microcontrollers.