Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Motors & Motion
  4. ›L298N motor driver

Component guide · Beginner · 5 min read

L298N motor driver

Pinout, Wiring and Code

By Geekobot Learning Team · Updated 29 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhat the L298N motor driver isL298N motor driver pinoutWiring the L298N motor driverExample codeSetup and tuningWhat you needAlternatives and when to choose themTry itCommon mistakesFAQsParts and next steps
Short answer

The L298N module drives two DC motors (or one bipolar stepper) in both directions with speed control. Feed motor power of 5 to 35 V into the 12V terminal, connect IN1 to IN4 to your board for direction and ENA/ENB to PWM pins for speed. It handles about 2 A per channel but loses roughly 2 V inside the chip, so it runs warm.

Key specs at a glance

Driver chip
L298N dual full H-bridge (STMicroelectronics)
Motor supply
5 to 35 V on the 12V terminal
Current
About 2 A per channel peak, 1 A continuous is comfortable
Voltage drop
About 1.8 to 3 V lost across the bridge
Logic
5 V logic, inputs accept 3.3 V on most modules
On-board regulator
78M05 gives 5 V out when the 5V-EN jumper is on (motor supply up to 12 V)
01

What the L298N motor driver is

The L298N is a classic dual H-bridge. Each half of the module controls one motor: two input pins set the direction and an enable pin switches the bridge on, so a PWM signal on the enable pin sets the speed. The large heatsink is there because the L298N uses bipolar transistors, which waste around 2 V as heat.

It is the most common first motor driver for two-wheel robots and line followers because it is tough, has screw terminals and needs no soldering. For battery robots where every volt counts, a MOSFET driver such as the TB6612FNG is more efficient.

02

L298N motor driver pinout

The pins on the L298N motor driver and what each one does.

PinFunction
12V (VS)Motor supply, 5 to 35 V
GNDCommon ground for motor supply and controller
5V5 V output from the on-board regulator (jumper on), or 5 V logic input (jumper off)
ENA / ENBEnable for motor A / B. Jumper on = full speed; remove the jumper and apply PWM for speed
IN1, IN2Direction inputs for motor A
IN3, IN4Direction inputs for motor B
OUT1, OUT2Motor A terminals
OUT3, OUT4Motor B terminals
PinFunction
12V (VS)
Motor supply, 5 to 35 V
GND
Common ground for motor supply and controller
5V
5 V output from the on-board regulator (jumper on), or 5 V logic input (jumper off)
ENA / ENB
Enable for motor A / B. Jumper on = full speed; remove the jumper and apply PWM for speed
IN1, IN2
Direction inputs for motor A
IN3, IN4
Direction inputs for motor B
OUT1, OUT2
Motor A terminals
OUT3, OUT4
Motor B terminals
03

Wiring the L298N motor driver

Remove the ENA and ENB jumpers to control speed. Always join the module GND to the controller GND, otherwise the inputs float and the motors behave randomly. With a motor supply of 12 V or less you can leave the 5V-EN jumper on and power an Uno from the module's 5V pin.

L298N motor driver pinArduino UnoESP32
ENAD9 (PWM)GPIO 25
IN1D8GPIO 26
IN2D7GPIO 27
IN3D5GPIO 14
IN4D4GPIO 12
ENBD3 (PWM)GPIO 13
GNDGNDGND
12VMotor battery +Motor battery +
ENA
Arduino Uno:
D9 (PWM)
ESP32:
GPIO 25
IN1
Arduino Uno:
D8
ESP32:
GPIO 26
IN2
Arduino Uno:
D7
ESP32:
GPIO 27
IN3
Arduino Uno:
D5
ESP32:
GPIO 14
IN4
Arduino Uno:
D4
ESP32:
GPIO 12
ENB
Arduino Uno:
D3 (PWM)
ESP32:
GPIO 13
GND
Arduino Uno:
GND
ESP32:
GND
12V
Arduino Uno:
Motor battery +
ESP32:
Motor battery +
04

Example code

Positive numbers turn the motor one way, negative the other, 0 stops it. On an ESP32 use analogWrite from core 3.x or ledcWrite for the enable pins.

Drive motor A forward, stop, reverse (Arduino) · Arduino C++Verify & upload in Electrolark
const int ENA = 9, IN1 = 8, IN2 = 7;

void motorA(int speed) {           // -255..255
  digitalWrite(IN1, speed > 0);
  digitalWrite(IN2, speed < 0);
  analogWrite(ENA, abs(speed));
}

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

void loop() {
  motorA(200);  delay(2000);       // forward
  motorA(0);    delay(1000);       // coast
  motorA(-200); delay(2000);       // reverse
  motorA(0);    delay(1000);
}
05

Setup and tuning

Speed range

small motors often do not start below a PWM value of about 80 to 120 because of the voltage drop. Find the lowest value that moves your robot and map your speed range from there.

Supply voltage

add about 2 V to the motor's rated voltage. A 6 V BO motor runs at full speed with a 7.4 V (2S) pack or 8 V.

Braking

IN1 = IN2 = HIGH with ENA HIGH brakes the motor; ENA LOW lets it coast.

Heat

above 1 A continuous per channel, add airflow or switch to a MOSFET driver.

Steppers

the L298N can drive a small bipolar stepper using all four inputs and the Arduino Stepper library, but it has no current limiting, so use a stepper driver for NEMA17 motors.

06

What you need

Shop this list4 of 5 found in our store · ₹4,47,181

  • L298N dual H-bridge motor driver module: the driver this guide coversL298N Dual H-Bridge Motor Driver Module₹128
  • Uno R3 development board: the controller used in the wiring tableFind this part
  • BO DC gear motor 3-12 V: a typical small robot motorBO DC Gear Motor 3–12V₹49
  • 18650 battery holder: for a battery-powered buildBattery Holder₹45
  • Dupont jumper wires: for the signal connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
07

Alternatives and when to choose them

  • ✓TB6612FNG: MOSFET driver, almost no voltage loss, 1.2 A per channel, best for small battery robots.
  • ✓DRV8833: tiny, runs from 2.7 to 10.8 V, ideal for N20 motors and single-cell builds.
  • ✓BTS7960: one motor up to tens of amps, for wheelchairs, e-bikes and large robots.
  • ✓L293D shield: plugs onto an Uno and runs four DC motors plus two servos, but only 0.6 A per motor.
08

Try it: Motor power torque calculator

Change the values and the diagram and results update as you type.

09

Common mistakes to avoid

  • !No common ground between the L298N and the controller, so the motors twitch or do not move.
  • !Leaving the ENA/ENB jumpers on and wondering why analogWrite does not change speed.
  • !Feeding more than 12 V with the 5V-EN jumper on, which overheats the on-board regulator.
  • !Expecting full motor voltage: a 6 V supply only gives the motor about 4 V.
10

Frequently asked questions

Can the L298N run on 5 V?

It will work, but the motor only sees about 3 V because of the internal drop, so small motors run slowly. Use 7 to 12 V, or a TB6612FNG for 5 V systems.

Does the L298N work with ESP32 and 3.3 V logic?

Yes on most modules: the inputs switch at about 2.3 V, so 3.3 V signals work. Power the logic side from 5 V and share GND.

How much current can it handle?

About 2 A per channel peak. For continuous use keep it at or below about 1 A per motor, or the chip overheats even with the heatsink.

Why does my L298N get hot?

It is a bipolar driver that turns about 2 V times the motor current into heat. That is normal; add airflow or use a MOSFET driver for higher currents.

Can it drive a stepper motor?

Yes, a small bipolar stepper using all four inputs. It has no current limit, so for NEMA17 motors a dedicated stepper driver is safer and quieter.

What do the 5V-EN and ENA jumpers do?

5V-EN connects the on-board 5 V regulator. ENA and ENB tie the enable pins high for full speed; remove them to use PWM speed control.

Parts for this guide

  • L298N Dual H-Bridge Motor Driver Module
    ₹128View
  • Uno R3 Development Board (No Cable)
    ₹359View
  • BO DC Gear Motor 3–12V
    ₹49View
  • 18650 Battery Holder
    ₹29View
  • Dupont Jumper Wires (40 pcs)
    ₹49View
Shop DC Motor Drivers

Calculators

Motor power torque calculatorPwm duty cycle calculator

Terms in this guide

H-bridgeA circuit of four switches that can drive a motor in both directions.Stall currentThe current a motor draws when its shaft is blocked; the maximum it will draw.

Projects that use it

Put this into practice: 35 step-by-step builds in our project library use parts from this guide.

Intermediate · 3–4 hoursLine follower robot with L298N and TCRT5000View projectIntermediate · 3–4 hoursObstacle-avoiding robotView projectIntermediate · 3 hoursTable-edge avoiding robotView project
Browse all 35 projects

Keep learning

ComparisonBeginnerMotor Drivers ExplainedA motor driver lets a low-power microcontroller control the speed and direction of motors using an H-bridge.4 min read · Motors & MotionComponent guideBeginnerDC Motors ExplainedA brushed DC motor spins when current flows through it: voltage sets the speed and the load sets the current it draws.4 min read · Motors & MotionBuying guideBeginnerHow to Choose a Motor for a Robot or ProjectPick the right motor: DC gear motors, servos, steppers and BLDC compared by speed, torque, precision and driver, with wheel torque sizing and examples.3 min read · Motors & MotionConcept explainerBeginnerPWM ExplainedPWM (pulse-width modulation) switches a pin fully on and off very quickly; the share of time it is on, the duty cycle, sets the average power.3 min read · Electronics FundamentalsHow-toIntermediatePower Planning for RobotsList every load with its normal and stall current, then pick a battery that can supply the total peak and last long enough.3 min read · Robotics

Sources

  • L298 dual full-bridge driver datasheet (STMicroelectronics)
  • Arduino analogWrite reference

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the L298N motor driver isL298N motor driver pinoutWiring the L298N motor driverExample codeSetup and tuningWhat you needAlternatives and when to choose themTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹222

L298N Dual H-Bridge Motor Driver Module · BO DC Gear Motor 3–12V · Battery Holder

Run itChange the inputs and watch the output

motorA(200) for 2 s, coast 1 s, motorA(-200) for 2 s, coast 1 s.

Motor A fwd 78%
78 %ENA duty

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question