L298N Motor Driver

Dual full-bridge (H-bridge) driver built on the STMicroelectronics L298 IC that lets a microcontroller run two DC motors or one bipolar stepper at up to 2A per channel.

L298N Motor Driver: Dual H-bridge driver

What is the L298N Motor Driver?

The L298N is a dual full-bridge driver based on the STMicroelectronics L298 IC. It takes low-current logic signals from a 5V microcontroller and switches the higher current and higher voltage a motor needs, well beyond what a GPIO pin can source. Each of its two H-bridges drives one DC motor in either direction, or the two bridges together drive a single bipolar stepper's two coils.

The L298 accepts a motor supply (VS) up to 46V and delivers up to 2A of continuous current per channel, with a non-repetitive peak of 3A. A separate logic supply (VSS) of 4.5 to 7V powers the internal control logic. The common breakout module adds an onboard 5V regulator so a single motor supply can also feed the logic. Direction is set with the IN pins, and speed is controlled by feeding PWM to the enable pins (ENA and ENB).

Because the output stage uses bipolar Darlington transistors, roughly 2V is dropped across the driver, so the motor sees noticeably less than the supply voltage. Under sustained load the chip dissipates real heat and relies on the module's heatsink, which is why the L298N is a workhorse for hobby robotics but not the most efficient choice for battery-critical designs.

L298N Motor Driver pinout

PinFunctionType
OUT1 OUT1FreeFree
OUT2 OUT2FreeFree
OUT3 OUT3FreeFree
OUT4 OUT4FreeFree
VMS 12V / VSPowerPower in
GND GNDPowerPower in
5V 5V / VSSPowerPower in
ENA ENADigital · PWMDigital input
IN1 IN1DigitalDigital input
IN2 IN2DigitalDigital input
IN3 IN3DigitalDigital input
IN4 IN4DigitalDigital input
ENB ENBDigital · PWMDigital input

Specifications

Operating voltage
5 V (max 46 V)
Interface
gpio
Dimensions
44 × 29.5 × 43.5 mm

Verified from the Tinkered component library · STMicroelectronics.

Circuit requirements

  • Keep the motor supply and logic supply separate: VS (the 12V / VS terminal) feeds the motors and can go up to 46V on the IC, while VSS / 5V powers the logic at 4.5 to 7V.
  • Tie the driver GND to the microcontroller GND so both share a common ground reference. Without a shared ground the IN inputs have no reference and the outputs behave erratically.
  • The bare L298 has no internal freewheeling diodes. Add fast external flyback diodes across the outputs for inductive loads (the datasheet application circuit shows eight). Many breakout modules include them, so verify before relying on it.
  • Account for the internal voltage drop of about 2V across the bridge: a 12V supply delivers only around 10V to the motor, so size the supply above the motor's rated voltage.
  • Set direction with IN1/IN2 and IN3/IN4, and feed PWM to ENA/ENB for speed. Plan for up to 2A continuous per channel and fit a heatsink for sustained high current.
  • On the popular module, leave the 5V-regulator jumper installed only for motor supplies at or below about 12V; above that, remove the jumper and feed regulated 5V into the 5V pin instead, or the onboard regulator overheats.

Board compatibility

The L298N Motor Driver connects to any of the microcontrollers supported in Tinkered. Mind the 5 V logic level on 3.3 V boards.

Common L298N Motor Driver mistakes

Skipping the common ground

The driver GND must connect to the microcontroller GND. Powering the motors from one supply and the logic from USB without joining the grounds leaves the IN inputs with no reference, so motors twitch, stall, or ignore commands.

Assuming the motor gets the full supply voltage

The L298's Darlington output stage drops roughly 2V, so a 12V rail delivers only about 10V to the motor. If a motor seems weak, remember to size the supply above the motor's rated voltage to compensate.

Ignoring the enable pins

Nothing moves until the enable pin for that channel is high. Use ENA and ENB for PWM speed control and the IN pins for direction. Trying to PWM the direction inputs while enable is fixed high gives poor speed control.

Mishandling the onboard 5V jumper

On the module the 5V-enable jumper lets the onboard regulator power the logic from the motor supply, but only up to about 12V. Above that, remove the jumper and supply 5V externally. Never feed 5V into the 5V pin while the jumper is still installed.

Forgetting flyback protection on the bare IC

The L298 chip provides no freewheeling diodes of its own. Inductive kickback from motor coils can damage the output transistors, so add fast external diodes if your module does not already include them.

L298N Motor Driver datasheet

Official L298N Motor Driver datasheetSTMicroelectronics

Popular L298N Motor Driver projects

Two-wheel Arduino robot car

Drive two geared DC motors from one L298N for a differential-drive robot, using the IN pins for direction and ENA/ENB PWM for per-wheel speed.

Bipolar stepper control

Wire a NEMA-17 or similar bipolar stepper's two coils across the two bridges (OUT1/OUT2 and OUT3/OUT4) to step the motor for positioning and CNC-style projects.

PWM speed-controlled fan or pump

Run a single DC motor through one bridge and vary its speed with PWM on the enable pin for adjustable cooling fans, water pumps, or conveyors.

Reversible linear actuator or conveyor

Use one H-bridge to reverse a DC gearmotor on demand, giving open/close or forward/back control for doors, blinds, and small conveyors.

Build with the L298N Motor Driver.

Drop the L298N Motor Driver into a circuit, write firmware, and simulate it in your browser, then deploy to real hardware. All in one editable Tinkered project.