Motor
Controlling L298N Driver Motor with Arduino Uno
What is the L298N Driver?
L298N Driver practical reference
The most widely used motor driver in the hobbyist world — a dual H-bridge board that can independently drive two brushed DC motors (or one bipolar stepper) with direction and PWM speed control, and includes an onboard 5V regulator for powering logic from the motor supply.
Key specifications
- Driver IC: L298N dual H-bridge
- Motor supply voltage: 5 V - 35V DC, fed to the board's 12V/VMS terminal
- Logic voltage: 5 V — from the onboard regulator when the 5V-EN jumper is in place, or from an external 5V source if you've removed it (required if VMS > 12V, to avoid overheating the onboard regulator)
- Max current: 2A per channel continuous, ~3A peak with a heatsink fitted
- Channels: Drives 2 independent DC motors, or 1 bipolar stepper motor
Pinout and connection notes
Setting IN1/IN2 (or IN3/IN4) to the same logic level brakes that motor; opposite levels drive it forward or reverse. Remove the 5V-EN jumper and supply logic power separately whenever VMS exceeds 12V.
- ENA: PWM speed control for motor A — jumper removed lets you drive this from a PWM pin; jumper in place runs motor A at full speed whenever enabled
- IN1: Direction control, motor A
- IN2: Direction control, motor A
- IN3: Direction control, motor B
- IN4: Direction control, motor B
- ENB: PWM speed control for motor B
- OUT1 / OUT2: Motor A output terminals
- OUT3 / OUT4: Motor B output terminals
- 12V / VMS: Motor supply voltage, 5V-35V DC
- GND: Common ground — must be shared between the motor supply, the board, and the MCU
- 5V: Regulated 5V output (only if the 5V-EN jumper is fitted and VMS ≤ 12V) — can power the MCU logic side
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up L298N Driver with Arduino Uno
Library
None — built-in digitalWrite/analogWrite by —
No library needed; uses core Arduino functions only.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| IN1 | D8 | Motor A direction bit 1. |
| ENA | D9 | PWM speed control for motor A. |
| IN2 | D7 | Motor A direction bit 2. |
| IN3 | D12 | Motor B direction bit 1. |
| ENB | D10 | PWM speed control for motor B. |
| IN4 | D13 | Motor B direction bit 2. |
| GND | GND | Common ground between Arduino, L298N logic, and motor supply — do not skip this. |
| +12V / GND (motor supply) | — | Separate battery/supply for the motors — do NOT power motors from the Arduino 5V pin. |
Swipe sideways to see every column →
- The L298N's onboard 5V regulator can only supply the logic side, and only if the motor supply is under ~12V and the regulator jumper is in place — for anything above that, or with larger motors, power the Arduino separately and just share GND.
- Never power DC motors directly from an Arduino digital pin or its 5V rail — the L298N (or any H-bridge driver) exists specifically because motors draw far more current and generate back-EMF spikes that a microcontroller pin cannot survive.
- IN1/IN2 control direction for motor A, IN3/IN4 for motor B; ENA/ENB must be PWM pins for speed control, or tied HIGH for full-speed-only operation.
Related Components
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.