Skip to content
A

Motor

Controlling DC Motor L298N with Arduino Uno

What is the DC Motor L298N?

A geared DC motor paired with the ubiquitous L298N dual H-bridge driver — the standard starting point for wheeled robots.

Specifications

MotorBrushed DC gear motor — the common yellow "TT motor" spec is ~200 RPM at 6V, ~1:48 gear ratio
DriverL298N dual H-bridge, 2A per channel
ControlOne direction pair (IN1/IN2) plus one PWM speed pin (ENA) per motor
SupplyMotor voltage 5V-35V DC on the driver's VMS terminal, separate from the MCU's own power

DC Motor L298N Pinout

PinNameDescription
1OUT1 / OUT2Motor leads — connect directly to the L298N's motor A output terminal, polarity sets default spin direction
2ENAPWM input on the driver — controls motor speed
3IN1 / IN2Direction inputs on the driver — set which way current flows through the motor
412V / GNDMotor supply voltage and ground, into the driver's VMS/GND terminal

This entry covers the motor + L298N pairing as a unit — see the L298N Driver page for the full breakdown of every driver pin if you're wiring more than one motor.

Setting Up DC Motor L298N with Arduino Uno

Wiring

Component pinArduino Uno pinNote
ENAD9 (PWM)Controls speed via analogWrite — remove the ENA jumper on the L298N board if it has one, or PWM won't take effect
IN1D7
IN2D8
12V / GNDSeparate motor power supply — GND shared with the ArduinoDo not power the motor from the Arduino's 5V pin — L298N motor supply is a separate higher-current rail

Example code

C++

Motor supply grounds and logic grounds must be tied together (Arduino GND to L298N GND), even though the 12V motor rail is otherwise separate — skipping this common ground is a frequent reason for erratic or no motor response.

Related Guides & Projects