← 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

0

No specs listed.

Pinout

13
PinNameFunctionsNotes
ENAENA
PWM
PWM speed for motor A (jumper on = full speed)
IN1IN1
GPIO
Motor A direction input 1
IN2IN2
GPIO
Motor A direction input 2
IN3IN3
GPIO
Motor B direction input 1
IN4IN4
GPIO
Motor B direction input 2
ENBENB
PWM
PWM speed for motor B (jumper on = full speed)
OUT1OUT1
Motor A terminal 1
OUT2OUT2
Motor A terminal 2
OUT3OUT3
Motor B terminal 1
OUT4OUT4
Motor B terminal 2
+12VVS
POWER
Motor supply 6-35V
GNDGND
GND
Common ground (share with MCU)
+5VVSS
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

3

Starter 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

PinArduino Uno R3ESP32 DevKitC (WROOM-32)Notes
+12V (VS)--Motor supply 7-35 V (NOT from the board 5 V)
GNDGNDGNDCommon ground between motor supply and MCU
+5V (VSS)+5V5VLogic 5 V (or jumper lets the board regulate it)
ENAD9GPIO25PWM speed for motor A
IN1D8GPIO26
IN2D7GPIO27
OUT1/OUT2--Motor A terminals

Related parts

1