The L298N is a dual H-bridge motor driver module that lets you control the direction and speed of two DC motors independently, or one stepper motor.
It acts like a bridge between your Arduino (low power) and the motors (higher power).
⚙️ Features
| Feature | Details |
|---|---|
| Voltage input | 5V – 35V (motor power) |
| Logic voltage | 5V (from Arduino or onboard reg) |
| Max current | ~2A per channel (peak) |
| Channels | 2 (A & B – for 2 DC motors) |
| Can control | Direction & Speed (PWM) |
| Extras | Built-in 5V regulator |
🔌 Pinout Breakdown
| Pin | Purpose |
|---|---|
| IN1 / IN2 | Control motor A direction |
| IN3 / IN4 | Control motor B direction |
| ENA / ENB | PWM speed control (A/B) |
| 12V / +V | Motor power supply (e.g. battery) |
| GND | Common ground |
| 5V | Logic power out (if jumper is on) |
đź§ Pro tip: If you’re powering motors with >12V, remove the 5V jumper and power logic separately from Arduino.
🔄 How H-Bridge Works
An H-bridge is a circuit that can reverse the polarity of voltage applied to a load (motor), allowing it to spin forward or backward 🚗↔️
IN1 HIGH, IN2 LOW => Motor spins forward
IN1 LOW, IN2 HIGH => Motor spins backward
IN1 = IN2 => Brake or stop
Speed is controlled by sending PWM to ENA (for motor A) or ENB (motor B).
🛠️ Arduino Code Example (1 Motor)
// Motor A
const int IN1 = 7;
const int IN2 = 8;
const int ENA = 9; // Must be PWM-capable
void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENA, OUTPUT);
}
void loop() {
// Forward
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
analogWrite(ENA, 150); // Speed: 0–255
delay(2000);
// Reverse
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
analogWrite(ENA, 200);
delay(2000);
// Stop
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
analogWrite(ENA, 0);
delay(1000);
}
đź§Ş Use Cases
âś… 2WD/4WD robots
âś… Line followers
âś… Tank-style robots
âś… Stepper motor control
âś… Conveyor belts, sliders
⚠️ Limitations
⚠️ Gets hot — consider a heatsink 🥵
⚠️ Not ideal for high-current motors (>2A)
⚠️ A bit bulky compared to modern alternatives (like DRV8833)
đź”§ Alternatives
| Driver | Pros |
|---|---|
| L9110S | Smaller, less current |
| DRV8833 | Efficient, compact |
| TB6612FNG | Cooler, faster switching |


