← All parts
L298N Motor Driver
L298N
STMicroelectronicsMotor driver
The L298N is a dual full-bridge (H-bridge) driver that runs two DC motors or one bipolar stepper, each direction-controlled with two inputs and speed-controlled by PWM on the enable pin. The common module adds an onboard 5V regulator.
In stock
Specifications
0No specs listed.
Pinout
13| Pin | Name | Functions | Notes |
|---|---|---|---|
| ENA | ENA | PWM | PWM speed for motor A (jumper on = full speed) |
| IN1 | IN1 | GPIO | Motor A direction input 1 |
| IN2 | IN2 | GPIO | Motor A direction input 2 |
| IN3 | IN3 | GPIO | Motor B direction input 1 |
| IN4 | IN4 | GPIO | Motor B direction input 2 |
| ENB | ENB | PWM | PWM speed for motor B (jumper on = full speed) |
| OUT1 | OUT1 | — | Motor A terminal 1 |
| OUT2 | OUT2 | — | Motor A terminal 2 |
| OUT3 | OUT3 | — | Motor B terminal 1 |
| OUT4 | OUT4 | — | Motor B terminal 2 |
| +12V | VS | POWER | Motor supply 6-35V |
| GND | GND | GND | Common ground (share with MCU) |
| +5V | VSS | POWER | Logic 5V (output from onboard regulator, or input if jumper removed) |
Interactive pinout
Highlight:
L298N
Click a pin to copy its name · tap a tag above to spotlight a bus.
Logic level & voltage
The L298N is a dual H-bridge motor driver with separate logic and motor-supply rails; its logic inputs work with typical 5 V (and commonly 3.3 V) microcontroller signals on most modules.
Typical uses
- Driving two DC motors or one stepper
- Robot drive-base motor control
- Speed control via PWM on the enable pins
Wiring notes & gotchas
- It drops ~2 V across the bridge — supply the motor rail higher than the motor's rating, or use a MOSFET driver for efficiency.
- Tie the module/MCU grounds together.
- Remove the 5 V-enable jumper when feeding logic 5 V externally; keep flyback handled by the internal diodes.
Commonly used with
3Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
arduino
// L298N dual H-bridge - drive one DC motor — community starter example
#if defined(ESP32)
#define ENA 25
#define IN1 26
#define IN2 27
#else
#define ENA 9 // Uno PWM pin
#define IN1 8
#define IN2 7
#endif
void setup() {
pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
}
void loop() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); // forward
analogWrite(ENA, 200); // speed 0..255
delay(2000);
digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); // reverse
delay(2000);
}MicroPython
python
# L298N dual H-bridge - one DC motor (ESP32) — community starter example
from machine import Pin, PWM
import time
ena = PWM(Pin(25), freq=1000)
in1 = Pin(26, Pin.OUT)
in2 = Pin(27, Pin.OUT)
def drive(forward, duty): # duty 0..1023
in1.value(1 if forward else 0)
in2.value(0 if forward else 1)
ena.duty(duty)
while True:
drive(True, 600); time.sleep(2)
drive(False, 600); time.sleep(2)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| +12V (VS) | - | - | Motor supply 7-35 V (NOT from the board 5 V) |
| GND | GND | GND | Common ground between motor supply and MCU |
| +5V (VSS) | +5V | 5V | Logic 5 V (or jumper lets the board regulate it) |
| ENA | D9 | GPIO25 | PWM speed for motor A |
| IN1 | D8 | GPIO26 | |
| IN2 | D7 | GPIO27 | |
| OUT1/OUT2 | - | - | Motor A terminals |