Skip to content

All items ship from our office in Colorado USA - $4.95 Flat-Rate US shipping & free shipping on orders over $75!

L298N Dual H-Bridge DC & Stepper Motor Driver Module User Guide

L298N Dual H-Bridge DC & Stepper Motor Driver Module User Guide - Envistia Mall

📋 Overview

The L298N Dual H-Bridge Motor Driver Module is a high-voltage, high-current motor driver designed to accept standard TTL logic levels and drive inductive loads such as DC motors, stepper motors, relays, and solenoids. It features two independent H-bridge channels, each capable of delivering up to 2A of continuous current, making it ideal for controlling two DC motors or one 2-phase stepper motor.

The module works by using an H-bridge circuit — a configuration of four switches that lets you reverse the polarity of the voltage applied to a motor. By controlling which switches are open or closed, you can make the motor spin forward, backward, or stop. Combine that with PWM (Pulse Width Modulation) on the enable pins, and you've got full speed and direction control from your Arduino or other microcontroller.

Whether you're building a robot, a motorized camera slider, or just experimenting with motor control, this module is a great starting point. It's affordable, well-documented, and compatible with virtually any microcontroller that can output 5V logic signals.

⚠️ Important: If your motor supply voltage exceeds 12V, you must remove the 5V regulator jumper to avoid damaging the onboard regulator. In this case, you'll need to supply 5V separately to the +5V pin. The module has an internal voltage drop of approximately 2V, so plan your supply voltage accordingly.


📊 Specifications

Driver Chip L298N Dual H-Bridge
Motor Supply Voltage (Vcc) +5V to +35V DC
Logic Voltage (Vss) +4V to +5.5V DC (not required when onboard 5V regulator is enabled)
Peak Output Current 2A per channel (bridge)
Control Signal Input 4.5–5.5V (HIGH), 0V (LOW)
Maximum Power Consumption 20W
Internal Voltage Drop ~2V (e.g., 12V supply delivers ~10V to motors)
Onboard 5V Regulator Yes (enabled/disabled via jumper; input must be 6–12V when enabled)
Motor Outputs 2 channels (Motor A and Motor B) via screw terminals
Control Inputs IN1, IN2 (Motor A); IN3, IN4 (Motor B); ENA, ENB (Enable/PWM)
Storage Temperature −25°C to +130°C
Dimensions Approx. 43 × 43 × 27 mm (1.7 × 1.7 × 1.1 inches) L × W × H
Weight ~26g

📌 Pinout

Power Terminals (Screw Terminal Block)

+12V (Vcc) Motor power supply input (+5V to +35V). Must be at least 6V when the onboard 5V regulator is enabled.
GND Common ground — connect to your Arduino GND and motor power supply ground.
+5V Dual-purpose pin: OUTPUT when regulator jumper is installed (provides 5V to power your Arduino); INPUT when jumper is removed (you must supply 5V here for logic circuitry).

Motor Output Terminals (Screw Terminal Blocks)

OUT1 & OUT2 Motor A output terminals — connect your first DC motor or one coil of a stepper motor here.
OUT3 & OUT4 Motor B output terminals — connect your second DC motor or the other coil of a stepper motor here.

Control Pins (Header Pins)

ENA Enable pin for Motor A. With jumper installed: motor runs at full speed. With jumper removed: connect to a PWM pin on your Arduino to control speed. Connecting to GND disables the motor.
IN1 Direction control input 1 for Motor A.
IN2 Direction control input 2 for Motor A.
IN3 Direction control input 1 for Motor B.
IN4 Direction control input 2 for Motor B.
ENB Enable pin for Motor B. Functions the same as ENA but for Motor B.

🔋 Power Configuration

The L298N module offers flexible power options depending on your motor voltage. Understanding the 5V regulator jumper is key to setting it up correctly.

Option 1: Onboard 5V Regulator Enabled (Jumper Installed)

This is the simplest configuration and works well for most beginner projects.

  • Install the jumper on the 5V regulator pins (it comes installed by default).
  • Connect your motor power supply (6V to 12V) to the +12V and GND screw terminals.
  • The +5V pin becomes an OUTPUT — you can use it to power your Arduino (connect to Arduino 5V pin).
  • No separate 5V supply is needed for the module's logic circuitry.

⚠️ Important: The input voltage must be at least 6V for the regulator to function properly, and must not exceed 12V or you risk damaging the onboard regulator.

Option 2: Onboard 5V Regulator Disabled (Jumper Removed)

Use this configuration when your motor supply voltage exceeds 12V.

  • Remove the jumper from the 5V regulator pins.
  • Connect your motor power supply (up to 35V) to the +12V and GND screw terminals.
  • The +5V pin becomes an INPUT — you must connect a separate 5V power supply here to power the module's logic circuitry.
  • Connect the GND of your 5V supply to the module's GND terminal as well.

Voltage Drop

The L298N has an internal voltage drop of approximately 2V. This means if you supply 12V to the +12V terminal, the motors will receive approximately 10V. If you need a full 12V at the motor terminals, supply approximately 14V to the +12V input (with the regulator jumper removed).


🔌 Wiring: Controlling Two DC Motors with Arduino

This wiring configuration lets you independently control the speed and direction of two DC motors using an Arduino Uno.

Connections

L298N Pin Arduino Pin
ENA D9 (PWM)
IN1 D8
IN2 D7
IN3 D5
IN4 D4
ENB D3 (PWM)
+12V External motor power supply (+)
GND External power supply (−) AND Arduino GND
+5V Arduino 5V (only if regulator jumper is installed)
  • Motor A connects to the OUT1 and OUT2 screw terminals.
  • Motor B connects to the OUT3 and OUT4 screw terminals.
  • Remove the ENA and ENB jumpers to use PWM speed control from the Arduino.

💡 Tip: Always connect the Arduino GND and the motor power supply GND to the module's GND terminal. A common ground is essential for reliable operation.

L298N Motor Controller Showing Pinouts, jumpers & controls

🔧 Motor Direction Control

The direction of each motor is controlled by the logic state of the IN pins. Here's how it works:

Motor A (IN1 / IN2)

IN1 IN2 Motor A Action
HIGH LOW Spins forward (direction 1)
LOW HIGH Spins backward (direction 2)
LOW LOW Motor stops (coast)
HIGH HIGH Motor stops (brake)

Motor B (IN3 / IN4)

IN3 IN4 Motor B Action
HIGH LOW Spins forward (direction 1)
LOW HIGH Spins backward (direction 2)
LOW LOW Motor stops (coast)
HIGH HIGH Motor stops (brake)

💡 Tip: "Forward" and "backward" are relative — they depend on how you've wired the motor to the output terminals. If the motor spins the wrong way, simply swap the two motor wires at the screw terminal.


🚀 Step 1: DC Motor Direction and Speed Control

This sketch demonstrates how to control the direction and speed of a single DC motor (Motor A) using the L298N module. The motor will spin forward at full speed, then backward at half speed, then stop — repeating in a loop.

/*
 * L298N DC Motor Control — Direction & Speed
 * Envistia Mall - Product Support
 *
 * Controls Motor A direction and speed using
 * the L298N dual H-bridge driver module.
 *
 * Connections:
 *   L298N ENA -> Arduino D9 (PWM)
 *   L298N IN1 -> Arduino D8
 *   L298N IN2 -> Arduino D7
 *   Motor A   -> L298N OUT1 & OUT2
 */

// Motor A control pins
const int enA = 9;   // ENA - PWM speed control
const int in1 = 8;   // IN1 - direction
const int in2 = 7;   // IN2 - direction

void setup() {
  // Set all motor control pins as outputs
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
}

void loop() {
  // --- Spin forward at full speed ---
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 255);  // Full speed (0-255)
  delay(3000);

  // --- Spin backward at half speed ---
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  analogWrite(enA, 128);  // Half speed
  delay(3000);

  // --- Stop the motor ---
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  analogWrite(enA, 0);
  delay(2000);
}

How to Use:

  1. Wire the L298N to your Arduino as shown in the connections table above. Remove the ENA jumper to enable PWM speed control.
  2. Connect a DC motor to the OUT1 and OUT2 screw terminals.
  3. Connect your motor power supply to the +12V and GND terminals.
  4. Upload the sketch to your Arduino using the Arduino IDE.
  5. The motor will spin forward for 3 seconds at full speed, then backward for 3 seconds at half speed, then stop for 2 seconds before repeating.

🚀 Step 2: Controlling Two DC Motors Independently

This sketch controls both Motor A and Motor B independently — useful for building a two-wheel-drive robot where each motor drives one wheel.

/*
 * L298N Dual DC Motor Control
 * Envistia Mall - Product Support
 *
 * Controls two DC motors independently for
 * basic robot movement: forward, backward,
 * turn left, turn right, and stop.
 *
 * Connections:
 *   L298N ENA -> Arduino D9 (PWM)
 *   L298N IN1 -> Arduino D8
 *   L298N IN2 -> Arduino D7
 *   L298N IN3 -> Arduino D5
 *   L298N IN4 -> Arduino D4
 *   L298N ENB -> Arduino D3 (PWM)
 *   Motor A   -> L298N OUT1 & OUT2
 *   Motor B   -> L298N OUT3 & OUT4
 */

// Motor A
const int enA = 9;
const int in1 = 8;
const int in2 = 7;

// Motor B
const int enB = 3;
const int in3 = 5;
const int in4 = 4;

void setup() {
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}

// --- Movement Functions ---
void moveForward(int speed) {
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enA, speed);
  analogWrite(enB, speed);
}

void moveBackward(int speed) {
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  analogWrite(enA, speed);
  analogWrite(enB, speed);
}

void turnLeft(int speed) {
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enA, speed);
  analogWrite(enB, speed);
}

void turnRight(int speed) {
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  analogWrite(enA, speed);
  analogWrite(enB, speed);
}

void stopMotors() {
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  analogWrite(enA, 0);
  analogWrite(enB, 0);
}

void loop() {
  moveForward(200);   // Forward at ~78% speed
  delay(2000);

  stopMotors();
  delay(500);

  turnRight(180);     // Turn right
  delay(1000);

  stopMotors();
  delay(500);

  moveBackward(200);  // Backward
  delay(2000);

  stopMotors();
  delay(500);

  turnLeft(180);      // Turn left
  delay(1000);

  stopMotors();
  delay(2000);
}

How to Use:

  1. Wire both motors and the L298N to your Arduino as shown in the connections table. Remove both the ENA and ENB jumpers.
  2. Upload the sketch to your Arduino.
  3. The robot will move forward, turn right, move backward, turn left, and stop — demonstrating all basic movements.
  4. Adjust the speed values (0–255) and delay times to suit your project.

🚀 Step 3: Controlling a Stepper Motor

The L298N can also drive a 2-phase (4-wire) bipolar stepper motor. This example uses the built-in Arduino Stepper library for simple step control.

/*
 * L298N Stepper Motor Control
 * Envistia Mall - Product Support
 *
 * Controls a bipolar stepper motor using the
 * Arduino Stepper library and L298N driver.
 *
 * Connections:
 *   L298N IN1 -> Arduino D8
 *   L298N IN2 -> Arduino D9
 *   L298N IN3 -> Arduino D10
 *   L298N IN4 -> Arduino D11
 *   Stepper Coil A -> L298N OUT1 & OUT2
 *   Stepper Coil B -> L298N OUT3 & OUT4
 *   ENA & ENB jumpers: INSTALLED (full current)
 */

#include <Stepper.h>

// Change this to match your stepper motor
// (e.g., 200 for a 1.8-degree stepper)
const int stepsPerRevolution = 200;

// Initialize the Stepper library
// Pins entered in the sequence: IN1, IN3, IN2, IN4
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

void setup() {
  // Set the motor speed (RPM)
  myStepper.setSpeed(60);
  Serial.begin(9600);
  Serial.println("Stepper Motor Test");
}

void loop() {
  // Rotate one full revolution clockwise
  Serial.println("Clockwise...");
  myStepper.step(stepsPerRevolution);
  delay(1000);

  // Rotate one full revolution counter-clockwise
  Serial.println("Counter-clockwise...");
  myStepper.step(-stepsPerRevolution);
  delay(1000);
}

How to Use:

  1. Keep the ENA and ENB jumpers installed (stepper motors need full current to hold position).
  2. Connect your stepper motor's two coils to OUT1/OUT2 and OUT3/OUT4. Check your stepper motor's datasheet to identify the coil pairs.
  3. Upload the sketch and open the Serial Monitor at 9600 baud.
  4. The motor will rotate one full revolution clockwise, pause, then one full revolution counter-clockwise.
  5. Adjust stepsPerRevolution to match your motor (commonly 200 for 1.8° steppers or 48 for 7.5° steppers).

💡 Tip: If the stepper motor vibrates but doesn't rotate, the coil wires may be connected incorrectly. Try swapping the two wires on one of the output terminal pairs (OUT1/OUT2 or OUT3/OUT4).


💡 Tips and Best Practices

  • Heat management: The L298N chip can get hot under heavy loads. The module includes a heatsink, but if you're running motors near the 2A limit continuously, consider adding airflow or reducing the duty cycle.
  • Flyback protection: The L298N has built-in flyback diodes to protect against voltage spikes from inductive loads (motors). No external diodes are needed.
  • Common ground: Always connect the ground of your Arduino, the L298N module, and your motor power supply together. Without a common ground, the logic signals won't be referenced correctly.
  • PWM frequency: The default Arduino PWM frequency on pins 3, 9, 10, and 11 (~490 Hz or ~980 Hz) works well with the L298N. Higher frequencies can reduce audible motor whine.
  • Motor stall current: Be aware that a stalled motor draws significantly more current than a running motor. If a motor stalls, it can exceed the 2A per-channel rating and trigger thermal shutdown or damage the driver.
  • Wire gauge: Use appropriately thick wires for the motor power connections. Thin jumper wires can cause voltage drops and overheating at higher currents.

🛠️ Troubleshooting

Problem Possible Cause & Solution
Motor doesn't spin Check that the Enable pin (ENA/ENB) is HIGH or has a jumper installed. Verify IN1/IN2 are not both the same state. Confirm motor power supply is connected and adequate.
Motor spins in the wrong direction Swap the two motor wires at the output screw terminal, or swap the IN1/IN2 (or IN3/IN4) logic in your code.
Motor runs but is slow or weak Check for voltage drop — the L298N drops ~2V internally. Increase your supply voltage. Also verify PWM duty cycle is high enough.
L298N chip gets very hot Normal under load, but if excessive, reduce motor current draw, add cooling, or check for a short circuit in the motor wiring.
Arduino resets when motor starts The motor is drawing too much current from the Arduino's power supply. Use a separate power supply for the motors and connect only the grounds together.
Stepper motor vibrates but doesn't rotate Coil wires are likely swapped. Identify the correct coil pairs using a multimeter (wires with continuity belong to the same coil) and reconnect.
5V output not working Ensure the regulator jumper is installed and the +12V input is at least 6V. If input exceeds 12V, the regulator may have been damaged.

⚠️ Important Notes

  • Do not exceed 35V on the +12V motor supply terminal.
  • Do not exceed 2A continuous current per motor channel.
  • If motor supply voltage exceeds 12V, you must remove the 5V regulator jumper and provide an external 5V supply to the +5V pin.
  • The ~2V internal voltage drop means motors receive less voltage than the supply. Account for this when selecting your power supply.
  • Do not connect or disconnect motors while the module is powered on — this can cause voltage spikes.
  • This module is not suitable for high-precision stepper motor applications. For microstepping and precise positioning, consider a dedicated stepper driver such as the A4988 or DRV8825.

🎯 Typical Applications

  • Two-wheel and four-wheel drive robots
  • Motorized camera sliders and pan/tilt mechanisms
  • Conveyor belt systems
  • Automated blinds and curtain controllers
  • CNC and 3D printer prototyping (basic stepper control)
  • PWM-controlled LED brightness for high-power LED arrays
  • Relay and solenoid drivers
  • Science fair and educational motor control projects

🏪 Where to Buy

This module is available at Envistia Mall.

  • 📦 Fast US Shipping
  • 🔄 Hassle-Free Returns
  • 📧 Responsive Customer Support

📚 Additional Resources


Sold and supported by Envistia Mall. Ships from the USA. The manufacturer and Envistia LLC (dba Envistia Mall) are not responsible for any damages or losses resulting from the use of this product. Always follow proper electrical safety practices when working with electronic components. Specifications are based on manufacturer data and are subject to change without notice.

Share this guide:
in

🛒 Related Products

Find the components mentioned in this guide in our store.

Browse Products →