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

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

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

L298N Motor Driver H-Bridge Documentation

1. Introduction

The L298N Motor Driver H-Bridge, manufactured by STMicroelectronics (Part ID: L298N), is a robust and versatile dual H-Bridge motor driver. It is designed to control the direction and speed of DC motors and stepper motors, making it an essential component in robotics, automation, and motor control applications. The L298N can drive two motors simultaneously, supporting bidirectional control and pulse-width modulation (PWM) for speed regulation.

Common Applications:

  • Robotics (e.g., controlling robot wheels)
  • Conveyor belt systems
  • Automated gates and doors
  • CNC machines and 3D printers
  • DIY motorized projects
  • Stepper motor control in precision systems

2. Technical Specifications

The L298N is a high-power motor driver capable of handling significant current and voltage levels. Below are its key specifications and pin configuration details.

Key Technical Details:

Parameter Value
Operating Voltage 5V to 46V
Output Current (per channel) 2A (continuous), 3A (peak)
Logic Voltage 5V
Power Dissipation 25W (with proper heat sinking)
Control Logic Levels High: 2.3V to 5V, Low: 0V to 1.5V
Number of Channels 2 (dual H-Bridge)
PWM Frequency Up to 20 kHz
Operating Temperature Range -25°C to +130°C

Pin Configuration and Descriptions:

The L298N module typically includes additional components like a voltage regulator and terminal blocks for easy wiring. Below is the pinout for the L298N IC and its corresponding module.

L298N IC Pinout:

Pin Name Description
1 Enable A Enables/Disables Motor A (High = Enabled, Low = Disabled)
2 Input 1 Logic input to control Motor A direction (works with Input 2)
3 Input 2 Logic input to control Motor A direction (works with Input 1)
4 Output 1 Motor A output terminal 1
5 Output 2 Motor A output terminal 2
6 VSS (Logic) Logic voltage supply (5V)
7 Ground Common ground
8 VS (Motor) Motor power supply (up to 46V)
9 Output 3 Motor B output terminal 1
10 Output 4 Motor B output terminal 2
11 Input 3 Logic input to control Motor B direction (works with Input 4)
12 Input 4 Logic input to control Motor B direction (works with Input 3)
13 Enable B Enables/Disables Motor B (High = Enabled, Low = Disabled)
14 Ground Common ground

L298N Module Pinout:

Pin Description
ENA Enable pin for Motor A (connect to PWM for speed control)
IN1, IN2 Control pins for Motor A direction
OUT1, OUT2 Output terminals for Motor A
ENB Enable pin for Motor B (connect to PWM for speed control)
IN3, IN4 Control pins for Motor B direction
OUT3, OUT4 Output terminals for Motor B
12V (VS) Motor power supply (up to 46V)
5V Logic voltage supply (can be used to power external logic circuits)
GND Common ground

3. Usage Instructions

Connecting the L298N to a Circuit:

  1. Power Supply:

    • Connect the motor power supply (up to 46V) to the 12V (VS) pin.
    • Connect the logic power supply (5V) to the 5V pin.
    • Ensure all grounds (GND) are connected to a common ground.
  2. Motor Connections:

    • Connect the motor terminals to OUT1 and OUT2 for Motor A, and OUT3 and OUT4 for Motor B.
  3. Control Pins:

    • Use IN1 and IN2 to control the direction of Motor A.
    • Use IN3 and IN4 to control the direction of Motor B.
    • Use ENA and ENB for enabling/disabling motors or for speed control via PWM.
  4. Direction Control Logic:

    • Set IN1 HIGH and IN2 LOW to rotate Motor A in one direction.
    • Set IN1 LOW and IN2 HIGH to rotate Motor A in the opposite direction.
    • Similarly, use IN3 and IN4 for Motor B.
  5. Speed Control:

    • Connect a PWM signal to ENA (for Motor A) or ENB (for Motor B) to control speed.

Important Considerations:

  • Use a heat sink or cooling fan for high-current applications to prevent overheating.
  • Ensure the motor power supply voltage matches the motor's rated voltage.
  • Avoid exceeding the maximum current rating to prevent damage to the IC.

4. Example Arduino Code

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

// Define motor control pins
#define ENA 9  // PWM pin for Motor A speed control
#define IN1 8  // Motor A direction control pin 1
#define IN2 7  // Motor A direction control pin 2
#define ENB 10 // PWM pin for Motor B speed control
#define IN3 6  // Motor B direction control pin 1
#define IN4 5  // Motor B 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 A: Forward at 50% speed
  digitalWrite(IN1, HIGH);  // Set IN1 HIGH
  digitalWrite(IN2, LOW);   // Set IN2 LOW
  analogWrite(ENA, 128);    // Set ENA to 50% duty cycle (128/255)

  // Motor B: Reverse at 75% speed
  digitalWrite(IN3, LOW);   // Set IN3 LOW
  digitalWrite(IN4, HIGH);  // Set IN4 HIGH
  analogWrite(ENB, 192);    // Set ENB to 75% duty cycle (192/255)

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

  // Stop both motors
  analogWrite(ENA, 0);      // Set ENA to 0% duty cycle (stop Motor A)
  analogWrite(ENB, 0);      // Set ENB to 0% duty cycle (stop Motor B)

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

5. Troubleshooting and FAQs

Common Issues and Solutions:

  1. Motors Not Running:

    • Ensure the power supply is connected and providing sufficient voltage.
    • Verify that the ENA and ENB pins are set HIGH or receiving a PWM signal.
  2. Overheating:

    • Use a heat sink or cooling fan for high-current applications.
    • Check for short circuits or excessive current draw from the motors.
  3. Erratic Motor Behavior:

    • Ensure all ground connections are properly connected.
    • Verify the logic control signals are correct and stable.
  4. No Speed Control:

    • Confirm that the PWM signal is being sent to the ENA or ENB pins.
    • Check the Arduino code for errors in the analogWrite() function.

FAQs:

Q1: Can the L298N drive stepper motors?
Yes, the L298N can drive bipolar stepper motors by controlling the two H-Bridge channels.

Q2: Can I power the Arduino from the L298N module?
Yes, if the module has a 5V regulator, you can use the 5V pin to power the Arduino. Ensure the motor power supply is at least 7V.

Q3: What is the maximum PWM frequency supported?
The L298N supports PWM frequencies up to 20 kHz.


This documentation provides a comprehensive guide to using the L298N Motor Driver H-Bridge. For further details, refer to the official

Explore Projects Built with L298N Motor Driver 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!
L298N DC Motor Driver Controlled DC Motor System
Image of 275 GC: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
This circuit is designed to control a DC motor using an L298N motor driver module. The motor driver is powered by a DC power source and interfaces with the motor through its output pins, while resistors are used to manage the input signals to the driver.
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 Motor Driver 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
Battery-Powered Motor Control System with L298N and Pushbuttons
Image of Soccer Car Wired: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
This circuit controls four DC motors using an L298N motor driver, powered by a 18650 Li-Ion battery. The direction and operation of the motors are controlled by four pushbuttons, each connected to the motor driver's input pins through resistors.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 and L298N Motor Driver-Based Wi-Fi Controlled Robotic Car
Image of ESP 32 BT BOT: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
This circuit is a motor control system using an ESP32 microcontroller and an L298N motor driver to control four DC gear motors. The ESP32 provides control signals to the L298N, which in turn drives the motors, powered by a 12V battery, enabling bidirectional control of the motors for applications such as a robotic vehicle.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with L298N Motor Driver 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 275 GC: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
L298N DC Motor Driver Controlled DC Motor System
This circuit is designed to control a DC motor using an L298N motor driver module. The motor driver is powered by a DC power source and interfaces with the motor through its output pins, while resistors are used to manage the input signals to the driver.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of l298n motor driver test: A project utilizing   L298N Motor Driver 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 Soccer Car Wired: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
Battery-Powered Motor Control System with L298N and Pushbuttons
This circuit controls four DC motors using an L298N motor driver, powered by a 18650 Li-Ion battery. The direction and operation of the motors are controlled by four pushbuttons, each connected to the motor driver's input pins through resistors.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ESP 32 BT BOT: A project utilizing   L298N Motor Driver H-Bridge (Motor Driver) in a practical application
ESP32 and L298N Motor Driver-Based Wi-Fi Controlled Robotic Car
This circuit is a motor control system using an ESP32 microcontroller and an L298N motor driver to control four DC gear motors. The ESP32 provides control signals to the L298N, which in turn drives the motors, powered by a 12V battery, enabling bidirectional control of the motors for applications such as a robotic vehicle.
Cirkit Designer LogoOpen Project in Cirkit Designer