Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

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

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

Introduction

The L298N Dual H-Bridge Motor Driver, manufactured by Handson Technology (Part ID: Motor Driver), is a versatile and robust motor driver module. It is designed to control the direction and speed of two DC motors or one stepper motor using Pulse Width Modulation (PWM) signals. The module is capable of handling up to 2A per channel and operates with a supply voltage range of 5V to 35V, making it suitable for a wide range of motor control applications.

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 ESP32-Controlled Dual Stepper Motor Driver System: 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.

Open Project in Cirkit Designer
Image of Arduino-Controlled Fire Detection and GSM Notification System: 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.

Open Project in Cirkit Designer
Image of ESP32-Controlled Dual Motor Driver with Optical Encoder Feedback: 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.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The following table outlines the key technical details of the L298N Dual H-Bridge Motor Driver:

Parameter Value
Supply Voltage (Vcc) 5V to 35V
Logic Voltage (Vss) 5V
Maximum Current (per channel) 2A
Number of Channels 2
Control Signals PWM, Direction (IN1, IN2, IN3, IN4)
Output Type H-Bridge
Heat Dissipation Built-in heatsink
Dimensions 43mm x 43mm x 27mm

Pin Configuration and Descriptions

The L298N module has several pins and terminals for power, control, and motor connections. The table below describes each pin:

Pin/Terminal Description
Vcc Power supply for motors (5V to 35V).
GND Ground connection.
5V Regulated 5V output (can be used to power logic circuits if Vcc > 7V).
IN1, IN2 Control inputs for Motor A. IN1 and IN2 determine the direction of rotation.
IN3, IN4 Control inputs for Motor B. IN3 and IN4 determine the direction of rotation.
ENA Enable pin for Motor A. Can be connected to a PWM signal for speed control.
ENB Enable pin for Motor B. Can be connected to a PWM signal for speed control.
OUT1, OUT2 Motor A output terminals.
OUT3, OUT4 Motor B output terminals.

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 motor power supply is greater than 7V, the onboard voltage regulator will provide 5V to the 5V pin, which can be used to power external logic circuits.
  2. Motor Connections:

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

    • Connect the control pins (IN1, IN2, IN3, IN4) to the microcontroller's GPIO pins.
    • Connect the enable pins (ENA, ENB) to PWM-capable GPIO pins for speed control.
  4. Logic Power:

    • If the motor power supply is less than 7V, connect an external 5V power source to the 5V pin to power the logic circuitry.

Important Considerations and Best Practices

Example: Controlling a DC Motor with Arduino UNO

Below is an example Arduino sketch to control the speed and direction of a single DC motor using the L298N module:

// Define control pins for Motor A
const int IN1 = 9;  // Direction control pin 1
const int IN2 = 8;  // Direction control pin 2
const int ENA = 10; // PWM pin for speed control

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

void loop() {
  // Rotate motor forward at 50% speed
  digitalWrite(IN1, HIGH); // Set IN1 high
  digitalWrite(IN2, LOW);  // Set IN2 low
  analogWrite(ENA, 128);   // Set PWM duty cycle to 50% (128/255)

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

  // Rotate motor backward at 75% speed
  digitalWrite(IN1, LOW);  // Set IN1 low
  digitalWrite(IN2, HIGH); // Set IN2 high
  analogWrite(ENA, 192);   // Set PWM duty cycle to 75% (192/255)

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

  // Stop the motor
  digitalWrite(IN1, LOW);  // Set IN1 low
  digitalWrite(IN2, LOW);  // Set IN2 low
  analogWrite(ENA, 0);     // Set PWM duty cycle to 0 (stop)

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

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Ensure the power supply voltage is within the specified range (5V to 35V).
    • Verify that the control pins are correctly connected to the microcontroller.
    • Check if the enable pins (ENA, ENB) are receiving a valid PWM signal.
  2. Overheating:

    • Use a heatsink or active cooling if the module becomes too hot during operation.
    • Reduce the motor load or current draw if possible.
  3. Erratic Motor Behavior:

    • Ensure proper grounding between the motor driver, power supply, and microcontroller.
    • Check for loose or faulty connections.
  4. No Output on 5V Pin:

    • The onboard voltage regulator only provides 5V if the motor power supply (Vcc) is greater than 7V.

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive a single stepper motor by controlling the two H-bridges. You will need to sequence the control signals (IN1, IN2, IN3, IN4) appropriately.

Q: Can I use the L298N with a 3.3V microcontroller?
A: Yes, but ensure the logic voltage levels are compatible. You may need level shifters if the microcontroller's GPIO pins cannot reliably drive the L298N's inputs.

Q: What is the maximum current the module can handle?
A: The L298N can handle up to 2A per channel, but active cooling is recommended for currents above 1A.