Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use L298N Dual H-Bridge Motor Driver: Examples, Pinouts, and Specs

Image of L298N Dual H-Bridge Motor Driver
Cirkit Designer LogoDesign with L298N Dual H-Bridge Motor Driver in Cirkit Designer

Introduction

The L298N is a dual H-bridge motor driver module designed to control the direction and speed of two DC motors or one stepper motor. It is widely used in robotics, automation, and other motor control applications due to its versatility and ease of use. The module can handle motor supply voltages ranging from 5V to 35V and supports a maximum current of 2A per channel. Its compact design and onboard features make it a popular choice for hobbyists and professionals alike.

Explore Projects Built with L298N Dual H-Bridge Motor Driver

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32-Controlled Dual Stepper Motor Driver System
Image of project carseten: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
This circuit consists of two L298N DC motor drivers controlled by an ESP32 microcontroller to drive two bipolar stepper motors. The ESP32 uses its GPIO pins to send control signals to the motor drivers, which in turn power the stepper motors with a 12V supply from either a battery or a power supply. The circuit is designed for precise control of stepper motors, likely for applications requiring synchronized movements, such as robotics or CNC machines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Controlled Fire Detection and GSM Notification System
Image of l298n motor driver test: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
This circuit is designed to control multiple DC motors using an L298N motor driver, which is interfaced with an Arduino UNO microcontroller. The Arduino controls the direction and speed of the motors, as well as a servo motor, and can activate a water pump via a relay module. Additionally, the circuit includes flame and smoke sensors for safety monitoring, and a SIM800L module for potential communication capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Controlled Dual Motor Driver with Optical Encoder Feedback
Image of Copy of Mobile Robot System with Speed and Position Control Using ESP32: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
This circuit is designed to control two DC motors using an L298N Dual Motor Driver Module, which receives PWM control signals from an ESP32 microcontroller. The motors' rotational movement can be monitored by two Optical Encoder Sensor Modules connected to the ESP32. Power is supplied by a 4 x AAA battery mount, with the battery's positive terminal connected to the motor driver's 12V input and the negative terminal to the common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Line Following Robot with L298N Motor Driver and KY-033 Sensors
Image of obstacle-avoiding robot: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
This circuit is designed to control a two-wheeled robot using an L298N motor driver, powered by two 18650 Li-ion batteries. It includes two KY-033 line tracking sensors for navigation and a 74HC04 inverter to process sensor signals and control the motor driver inputs.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with L298N Dual H-Bridge Motor Driver

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of project carseten: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
ESP32-Controlled Dual Stepper Motor Driver System
This circuit consists of two L298N DC motor drivers controlled by an ESP32 microcontroller to drive two bipolar stepper motors. The ESP32 uses its GPIO pins to send control signals to the motor drivers, which in turn power the stepper motors with a 12V supply from either a battery or a power supply. The circuit is designed for precise control of stepper motors, likely for applications requiring synchronized movements, such as robotics or CNC machines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of l298n motor driver test: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
Arduino-Controlled Fire Detection and GSM Notification System
This circuit is designed to control multiple DC motors using an L298N motor driver, which is interfaced with an Arduino UNO microcontroller. The Arduino controls the direction and speed of the motors, as well as a servo motor, and can activate a water pump via a relay module. Additionally, the circuit includes flame and smoke sensors for safety monitoring, and a SIM800L module for potential communication capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Copy of Mobile Robot System with Speed and Position Control Using ESP32: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
ESP32-Controlled Dual Motor Driver with Optical Encoder Feedback
This circuit is designed to control two DC motors using an L298N Dual Motor Driver Module, which receives PWM control signals from an ESP32 microcontroller. The motors' rotational movement can be monitored by two Optical Encoder Sensor Modules connected to the ESP32. Power is supplied by a 4 x AAA battery mount, with the battery's positive terminal connected to the motor driver's 12V input and the negative terminal to the common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of obstacle-avoiding robot: A project utilizing L298N Dual H-Bridge Motor Driver in a practical application
Battery-Powered Line Following Robot with L298N Motor Driver and KY-033 Sensors
This circuit is designed to control a two-wheeled robot using an L298N motor driver, powered by two 18650 Li-ion batteries. It includes two KY-033 line tracking sensors for navigation and a 74HC04 inverter to process sensor signals and control the motor driver inputs.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Robotics: Driving wheels or tracks of robots
  • Automation: Controlling conveyor belts or actuators
  • DIY Projects: Building RC cars, robotic arms, or CNC machines
  • Stepper Motor Control: Driving stepper motors for precise positioning

Technical Specifications

The L298N module is built around the L298N IC, which is a high-power dual H-bridge driver. Below are the key technical details:

Key Specifications

Parameter Value
Motor Supply Voltage 5V to 35V
Logic Voltage 5V
Maximum Current (per channel) 2A
Number of Channels 2
Control Logic Levels High (5V), Low (0V)
Power Dissipation 25W (with proper heat sink)
Dimensions ~43mm x 43mm x 27mm

Pin Configuration and Descriptions

The L298N module has several pins and terminals for motor control and power supply. Below is a detailed description:

Power and Motor Terminals

Pin/Terminal Description
VCC Motor power supply (5V to 35V)
GND Ground connection
5V Logic power supply (optional, if jumper removed)
OUT1 Output for Motor 1 (positive terminal)
OUT2 Output for Motor 1 (negative terminal)
OUT3 Output for Motor 2 (positive terminal)
OUT4 Output for Motor 2 (negative terminal)

Control Pins

Pin Description
ENA Enable pin for Motor 1 (PWM input for speed control)
IN1 Input 1 for Motor 1 (direction control)
IN2 Input 2 for Motor 1 (direction control)
ENB Enable pin for Motor 2 (PWM input for speed control)
IN3 Input 3 for Motor 2 (direction control)
IN4 Input 4 for Motor 2 (direction control)

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the motor power supply to the VCC terminal (5V to 35V).
    • Connect the ground of the power supply to the GND terminal.
    • If the logic circuit requires 5V, you can use the onboard 5V regulator by keeping the 5V jumper in place. If an external 5V logic supply is used, remove the jumper and connect the external 5V to the 5V pin.
  2. Motor Connections:

    • Connect the terminals of Motor 1 to OUT1 and OUT2.
    • Connect the terminals of Motor 2 to OUT3 and OUT4.
  3. Control Connections:

    • Connect the ENA and ENB pins to PWM-capable pins of a microcontroller (e.g., Arduino) for speed control.
    • Connect IN1, IN2, IN3, and IN4 to digital pins of the microcontroller for direction control.
  4. Programming:

    • Use the microcontroller to send PWM signals to ENA and ENB for speed control.
    • Set the logic levels of IN1/IN2 and IN3/IN4 to control the direction of the motors.

Example Arduino Code

Below is an example of how to control two DC motors using an Arduino UNO and the L298N module:

// Define control pins for Motor 1
#define ENA 9  // PWM pin for speed control
#define IN1 8  // Direction control pin 1
#define IN2 7  // Direction control pin 2

// Define control pins for Motor 2
#define ENB 10 // PWM pin for speed control
#define IN3 6  // Direction control pin 1
#define IN4 5  // Direction control pin 2

void setup() {
  // Set motor control pins as outputs
  pinMode(ENA, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(ENB, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

void loop() {
  // Motor 1: Forward at 50% speed
  analogWrite(ENA, 128); // Set speed (0-255)
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);

  // Motor 2: Reverse at 75% speed
  analogWrite(ENB, 192); // Set speed (0-255)
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);

  delay(2000); // Run motors for 2 seconds

  // Stop both motors
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);

  delay(2000); // Wait for 2 seconds
}

Important Considerations

  • Heat Dissipation: The L298N IC can get hot during operation. Use a heat sink or active cooling for high-current applications.
  • Power Supply: Ensure the motor power supply voltage matches the motor's specifications.
  • Current Limitations: Do not exceed 2A per channel to avoid damaging the module.
  • Jumper Settings: The onboard 5V regulator is enabled by default. Remove the jumper if using an external 5V logic supply.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Check all power and ground connections.
    • Verify that the ENA and ENB pins are receiving PWM signals.
    • Ensure the motor power supply voltage is within the specified range.
  2. Overheating:

    • Use a heat sink or fan to cool the L298N IC.
    • Reduce the motor load or current draw.
  3. Erratic Motor Behavior:

    • Check for loose or faulty connections.
    • Verify the logic levels on IN1, IN2, IN3, and IN4.
  4. No Output on 5V Pin:

    • Ensure the 5V jumper is in place.
    • If using an external 5V supply, remove the jumper to avoid conflicts.

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive a bipolar stepper motor by controlling the two H-bridge channels.

Q: Can I use the L298N with a 3.3V microcontroller?
A: The L298N is designed for 5V logic levels. Use a level shifter or ensure the control signals are compatible.

Q: What is the maximum motor voltage I can use?
A: The maximum motor supply voltage is 35V. Ensure your motor is rated for this voltage.

Q: How do I control motor speed?
A: Use PWM signals on the ENA and ENB pins to control the speed of the motors.