Are you looking to add motor control to your Arduino projects? The L298N motor driver might be just what you need. This module is a popular choice for hobbyists and professionals alike, offering an easy way to control DC and stepper motors. From student projects to final year projects in engineering, the L298N is versatile and reliable. In this article, we’ll dive deep into the L298N, covering its description, pin configuration, uses, features, and more.

The L298N motor driver is a dual H-bridge motor driver module that allows for the control of the speed and direction of two DC motors or one stepper motor.
The L298N motor driver is a powerful module capable of simultaneously driving two DC motors or one stepper motor. It uses the H-bridge configuration, allowing full control over the motor’s direction and speed. The module can be easily interfaced with Arduino and other microcontrollers, making it a popular choice for various robotics and automation projects.
Voltage Requirements
The L298N can handle motor supply voltages from 5V to 35V, making it suitable for various applications.
Current Rating
Each channel of the L298N can provide up to 2A continuous current, with a peak current of up to 3A. This allows it to drive most small to medium-sized motors efficiently.
Supported Motors
The L298N is compatible with both DC motors and stepper motors, providing flexibility for various types of projects.
One thing to know: the L298N drops about 2V inside the chip, so a 12V supply gives roughly 10V at the motor. That is normal for this module — if your motor runs slower than expected, that voltage drop is the reason, not a fault.
The L298N has several pins and terminals for connecting power, control signals, and motors. Here’s a breakdown of the key pins:
12V: This pin is for the motor power supply, connected to a power source that matches the voltage requirements of the motors (for example a 12V adapter or battery pack).
GND: This is the ground pin. The Arduino GND and the motor supply GND must be connected together (common ground) — without it, the control signals have no reference and the motors will not run properly.
5V: This is the regulated 5V output from the module’s onboard regulator. When the 5V jumper is fitted (the default), the module makes 5V from the motor supply and this pin can power the Arduino. When the motor supply is above 12V, remove the 5V jumper and feed 5V into this pin from a separate source instead — otherwise the regulator overheats.
IN1, IN2, IN3, IN4: These pins are used to control the direction of the motors. IN1 and IN2 control the first motor, while IN3 and IN4 control the second motor.
OUT1, OUT2, OUT3, OUT4: These are the output pins connected to the motors. OUT1 and OUT2 connect to the first motor, and OUT3 and OUT4 connect to the second motor.
ENA, ENB: These are the enable pins for the motors. ENA enables the first motor, and ENB enables the second motor. These pins can be used to control the speed of the motors via PWM (Pulse Width Modulation). With the jumpers fitted, the motors run at full speed; remove the jumpers and connect ENA/ENB to PWM pins on the Arduino for speed control.

The ENA and ENB pins are used to enable the motors and control their speed using PWM signals from the Arduino. These pins must be connected to PWM-capable digital pins on the Arduino.
Ensure that the power supply for the motors is adequate and that the GND pins of the L298N and Arduino are connected to a common ground.
Connect your motors to the OUT1, OUT2, OUT3, and OUT4 pins. Ensure the connections are secure to prevent any loose connections.
| Component | Purpose | Price / link |
|---|---|---|
| L298N motor driver | Motor driver (dual H-bridge) | Rs 375 |
| Arduino Uno | Main controller | Arduino UNO R3 DIP — Rs 1,200 |
| DC gear motor | Wheels (×2) | Rs 165 each |
| NEMA 17 stepper motor | Stepper option (bipolar, 4-wire) | Rs 670 |
| 12V 2A adapter | Motor power supply | Rs 275 |
| Jumper wires | Connections | Rs 180 |
| Breadboard | Prototyping | MB102 — Rs 250 |
// L298N motor driver — two DC motors with speed control
const int in1 = 8; // Motor A direction
const int in2 = 9; // Motor A direction
const int in3 = 10; // Motor B direction
const int in4 = 11; // Motor B direction
const int ena = 5; // Motor A speed (PWM)
const int enb = 6; // Motor B speed (PWM)
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(ena, OUTPUT);
pinMode(enb, OUTPUT);
}
void loop() {
// Both motors forward at 200/255 speed
digitalWrite(in1, HIGH); digitalWrite(in2, LOW);
digitalWrite(in3, HIGH); digitalWrite(in4, LOW);
analogWrite(ena, 200); analogWrite(enb, 200);
delay(2000);
// Both motors backward
digitalWrite(in1, LOW); digitalWrite(in2, HIGH);
digitalWrite(in3, LOW); digitalWrite(in4, HIGH);
analogWrite(ena, 200); analogWrite(enb, 200);
delay(2000);
// Stop
digitalWrite(in1, LOW); digitalWrite(in2, LOW);
digitalWrite(in3, LOW); digitalWrite(in4, LOW);
delay(1000);
}How the code works: IN1/IN2 set motor A’s direction (HIGH/LOW = forward, LOW/HIGH = backward, LOW/LOW = stop) and IN3/IN4 do the same for motor B. ENA and ENB take a PWM value (0–255) that sets the speed. Remove the ENA/ENB jumpers on the module first, otherwise the PWM signal has no effect and the motors run at full speed.
For a complete robot car that uses this driver, see our obstacle-avoidance robot car guide — it uses the same L298N wiring with an HC-SR04 ultrasonic sensor.
The L298N is perfect for controlling the speed and direction of DC motors in various projects.
The L298N can drive one bipolar stepper motor (4-wire, two coils) — one coil on OUT1/OUT2 and the other on OUT3/OUT4. Use the Arduino Stepper library with the four IN pins. Note: the common 28BYJ-48 stepper is unipolar (5-wire) and is normally driven by its own ULN2003 driver board, not by the L298N. For an L298N stepper, use a bipolar motor such as the NEMA 17.
Use the L298N to control the movement of robots, providing precise control over speed and direction.
Ideal for student projects, the L298N motor driver helps in learning about motor control and electronics.
For final-year projects, the L298N offers a robust solution for complex motor control applications.
Check the power connections and ensure that the control pins are correctly connected and programmed. The most common cause is a missing common ground between the Arduino and the motor supply.
Ensure adequate cooling and heat dissipation for the L298N module. Consider using a heatsink if necessary. The module’s large black heatsink is there for a reason — at 2A per channel it gets hot.
Verify that the power supply is sufficient for the motors being used. Check for loose connections. Remember the ~2V drop: a 12V supply gives about 10V at the motor.
Use heatsinks and ensure proper ventilation to prevent the module from overheating.
Make sure your power supply meets the voltage and current requirements of the motors and the L298N module. A 12V 2A adapter is enough for two small DC gear motors; bigger motors need a bigger supply.
Use proper fuses and protection circuits to prevent damage to your electronics.
Follow safety guidelines to avoid short circuits and other hazards. Never connect or disconnect motors while the power is on.
The L298N can handle higher currents compared to the L293D, making it more suitable for larger motors. The L293D (used on the L293D motor shield) is limited to about 600 mA per channel, while the L298N handles up to 2A per channel. The L293D shield is easier to use (it plugs straight onto the Arduino); the L298N is the choice when the motors need more current.
Consider alternatives like the DRV8833 or the BTS7960 for more advanced features and higher-power applications. Both are available on order — message us on WhatsApp.
You can control more than two motors by cascading multiple L298N modules.
Advanced users can modify the firmware to unlock additional features and optimize performance.
The L298N motor driver (Rs 375), Arduino UNO R3 DIP (Rs 1,200), DC gear motor (Rs 165 each), NEMA 17 stepper motor (Rs 670), 12V 2A adapter (Rs 275), jumper wires (Rs 180) and MB102 breadboard (Rs 250) are available at QKZEE Technologies, Shop 20, 1st Floor, Al-Khalil Center, Hall Road, Lahore, and online at qkzeetech.com with delivery all over Pakistan — see the links above. The DRV8833 and BTS7960 drivers are available on order — message us on WhatsApp.
If the motors do not move, or only one motor runs, message us — tell us whether the 12V supply is connected, whether the Arduino GND and the L298N GND are joined, and whether the ENA/ENB jumpers are removed, and we will help you find the fault.
Chat on WhatsApp Watch on YouTube
Why do the motors not move even though the code uploaded?
The most common cause is a missing common ground: the Arduino GND and the L298N GND must be joined. The second most common cause is no motor power — check the 12V supply is connected and switched on.
Why do the motors run at full speed even though I set a PWM value?
The ENA/ENB jumpers are still fitted. Remove them and connect ENA/ENB to PWM pins (5 and 6 in the code) — with the jumpers on, the enable pins are tied to 5V and the motors run at full speed regardless of the code.
Why is the motor slower than I expected?
The L298N drops about 2V inside the chip, so a 12V supply gives roughly 10V at the motor. That is normal for this module.
Why does the L298N get hot?
At 2A per channel it dissipates several watts as heat — that is what the big black heatsink is for. Make sure air can flow around it, and do not run it at full current for long without ventilation.
Can the L298N drive a 28BYJ-48 stepper motor?
Not directly — the 28BYJ-48 is a unipolar (5-wire) stepper and is normally driven by its own ULN2003 driver board. The L298N drives bipolar steppers (4-wire, two coils), such as the NEMA 17.
Can I power the Arduino from the L298N?
Yes, when the 5V jumper is fitted and the motor supply is 12V or less — the module’s onboard regulator makes 5V that can power the Arduino. Above 12V, remove the jumper and feed 5V separately.
The L298N motor driver is a versatile and reliable component for adding motor control to your Arduino projects. Its ease of use, affordability, and robust performance make it a favorite among hobbyists and professionals alike. Whether you’re working on home automation, robotics, or simple motor control, the L298N is an excellent choice. Plus, if you’re in Lahore or shopping at Hall Road, you’ll find it to be one of Pakistan’s best solutions for motor control.