Skip to content
motors / l298n.md

L298N Motor Driver Module

ST L298N dual H-bridge — drives two DC motors (up to 2 A each) or one bipolar stepper. 12 V max recommended motor supply; logic from a separate 5 V rail (onboard 5 V regulator can power the MCU at < 12 V Vin).

In stock ST 1 files · 470 KB

Specs

Spec Value
Channels 2× H-bridge
Output current 2 A continuous per channel, 3 A peak
Motor voltage 5 – 35 V
Logic voltage 4.5 – 7 V (use 5 V)
Onboard regulator 5 V LM7805, disable if Vin > 12 V
Diode protection Yes (8 schottky on PCB)
PWM frequency Up to ~30 kHz on EN inputs

Pinout (module)

Pin Function
OUT1, OUT2 Motor A terminals
OUT3, OUT4 Motor B terminals
12 V Motor supply (5–35 V)
GND Common ground
5 V Onboard regulator output (or input if 5 V jumper off)
ENA, ENB Channel enable / PWM
IN1, IN2 Motor A direction
IN3, IN4 Motor B direction

Wiring (Arduino Uno, one DC motor)

L298N Arduino
ENA D9 (PWM)
IN1 D8
IN2 D7
GND GND
12V external 12 V supply (+)
GND external 12 V supply (–)
OUT1, OUT2 motor + / −

Keep the onboard 5 V jumper on if motor supply ≤ 12 V — then the module sources 5 V to the Arduino. Above 12 V, jumper OFF and power the Arduino separately.

Code — forward / reverse / stop

const int ENA = 9, IN1 = 8, IN2 = 7;

void setup() {
  pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
}

void forward(int pwm)  { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);  analogWrite(ENA, pwm); }
void backward(int pwm) { digitalWrite(IN1, LOW);  digitalWrite(IN2, HIGH); analogWrite(ENA, pwm); }
void stopMotor()       { analogWrite(ENA, 0); }

void loop() {
  forward(180);  delay(2000);
  stopMotor();   delay(500);
  backward(180); delay(2000);
  stopMotor();   delay(500);
}

Voltage drop

The L298N drops ~1.8–3 V across each H-bridge. With a 12 V supply your motor sees ~9 V. For higher efficiency / lower voltage use a MOSFET driver (DRV8833, TB6612FNG).

Schematic

L298N reference circuit on page 6 of the datasheet PDF. Module schematic is a near-direct copy of the datasheet application example.

Last updated: 2026-05-13 · Source on GitHub