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

How to Use L298N: Examples, Pinouts, and Specs

Image of L298N
Cirkit Designer LogoDesign with L298N in Cirkit Designer

Introduction

The L298N is a dual H-bridge motor driver designed to control the direction and speed of DC motors and stepper motors. It is a versatile and robust component capable of driving two motors simultaneously, with each channel supporting up to 2A of current. The L298N is widely used in robotics, automation, and other motor control applications due to its ease of use and compatibility with microcontrollers like Arduino.

Explore Projects Built with L298N

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO Controlled Robot with Bluetooth and Ultrasonic Sensor
Image of vhjv: A project utilizing L298N in a practical application
This is a robotic control circuit featuring an Arduino UNO microcontroller that interfaces with two SG90 servo motors for movement, an HC-SR04 ultrasonic sensor for distance measurement, and an HC-05 Bluetooth module for wireless communication. The L298N motor driver is incorporated for potential motor control, and the system is powered through a standard power jack.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-CAM Controlled Surveillance Robot with Wi-Fi and Servo Pan/Tilt Mechanism
Image of sam: A project utilizing L298N in a practical application
This circuit is designed to control a mobile platform with four DC motors for movement, two servos for directional control, and an ESP32-CAM module for wireless video streaming. The L298N motor driver interfaces with the ESP32-CAM to drive the motors based on commands received over WiFi, allowing for remote directional control. The ESP32-CAM also handles the servo positioning and streams live video, enabling the user to control and monitor the platform remotely through a web interface.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Line Following Robot with ATmega328P and L298N Motor Driver
Image of Arduino-Controlled Line Following Robot with Dual DC Motors and L298N Driver: A project utilizing L298N in a practical application
This circuit is a line-following robot controller. It uses a Nano 3.0 ATmega328P microcontroller to read inputs from a line sensor and control two DC motors via an L298N motor driver. Power is supplied by a 9V battery regulated through an XL4015 DC buck converter.
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 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

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 vhjv: A project utilizing L298N in a practical application
Arduino UNO Controlled Robot with Bluetooth and Ultrasonic Sensor
This is a robotic control circuit featuring an Arduino UNO microcontroller that interfaces with two SG90 servo motors for movement, an HC-SR04 ultrasonic sensor for distance measurement, and an HC-05 Bluetooth module for wireless communication. The L298N motor driver is incorporated for potential motor control, and the system is powered through a standard power jack.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of sam: A project utilizing L298N in a practical application
ESP32-CAM Controlled Surveillance Robot with Wi-Fi and Servo Pan/Tilt Mechanism
This circuit is designed to control a mobile platform with four DC motors for movement, two servos for directional control, and an ESP32-CAM module for wireless video streaming. The L298N motor driver interfaces with the ESP32-CAM to drive the motors based on commands received over WiFi, allowing for remote directional control. The ESP32-CAM also handles the servo positioning and streams live video, enabling the user to control and monitor the platform remotely through a web interface.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Arduino-Controlled Line Following Robot with Dual DC Motors and L298N Driver: A project utilizing L298N in a practical application
Battery-Powered Line Following Robot with ATmega328P and L298N Motor Driver
This circuit is a line-following robot controller. It uses a Nano 3.0 ATmega328P microcontroller to read inputs from a line sensor and control two DC motors via an L298N motor driver. Power is supplied by a 9V battery regulated through an XL4015 DC buck converter.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of obstacle-avoiding robot: A project utilizing L298N 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 and Use Cases

  • Robotics: Driving wheels or robotic arms
  • Automation: Conveyor belts, automated gates, and other motorized systems
  • DIY Projects: Remote-controlled cars, drones, and hobbyist robots
  • Stepper Motor Control: For precise positioning in CNC machines or 3D printers

Technical Specifications

Key Technical Details

  • Operating Voltage: 5V to 46V
  • Output Current: Up to 2A per channel (continuous)
  • Peak Current: 3A per channel (short duration)
  • Logic Voltage: 5V
  • Control Logic Levels: High (1) = 2.3V to 5V, Low (0) = 0V to 1.5V
  • Power Dissipation: 25W (with proper heat sinking)
  • Built-in Protection: Thermal shutdown and overcurrent protection
  • Dimensions: Typically 43mm x 43mm (for the module version)

Pin Configuration and Descriptions

The L298N module typically has the following pins:

Pin Name Type Description
IN1 Input Motor A control input 1. Used to set the direction of Motor A.
IN2 Input Motor A control input 2. Used to set the direction of Motor A.
IN3 Input Motor B control input 1. Used to set the direction of Motor B.
IN4 Input Motor B control input 2. Used to set the direction of Motor B.
ENA Input (PWM) Enable pin for Motor A. Can be used for speed control via PWM signal.
ENB Input (PWM) Enable pin for Motor B. Can be used for speed control via PWM signal.
OUT1 Output Motor A output 1. Connects to one terminal of Motor A.
OUT2 Output Motor A output 2. Connects to the other terminal of Motor A.
OUT3 Output Motor B output 1. Connects to one terminal of Motor B.
OUT4 Output Motor B output 2. Connects to the other terminal of Motor B.
12V Power Input External power supply for the motors (5V to 46V).
5V Power Output Regulated 5V output (can power a microcontroller if the jumper is in place).
GND Ground Common ground for the module and external power supply.

Note: The module often includes a jumper for the ENA and ENB pins. If the jumper is in place, the motors will run at full speed by default.

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the 12V pin to an external power source (e.g., a battery or power supply) that matches the voltage requirements of your motors.
    • Connect the GND pin to the ground of your power source and microcontroller.
    • If your microcontroller operates at 5V, you can use the 5V pin on the L298N module to power it (ensure the jumper is in place).
  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 IN1, IN2, IN3, and IN4 pins to the digital output pins of your microcontroller.
    • For speed control, connect the ENA and ENB pins to PWM-capable pins on your microcontroller.
  4. Programming:

    • Use your microcontroller to send HIGH or LOW signals to the IN pins to control the direction of the motors.
    • Send a PWM signal to the ENA and ENB pins to control the speed of the motors.

Example Code for Arduino UNO

The following example demonstrates how to control two DC motors using the L298N and an Arduino UNO:

// Define motor control pins
const int IN1 = 7;  // Motor A direction control pin 1
const int IN2 = 6;  // Motor A direction control pin 2
const int ENA = 5;  // Motor A speed control (PWM)
const int IN3 = 4;  // Motor B direction control pin 1
const int IN4 = 3;  // Motor B direction control pin 2
const int ENB = 2;  // Motor B speed control (PWM)

void setup() {
  // Set motor control pins as outputs
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENB, 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: Backward 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
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);

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

Important Considerations and Best Practices

  • Heat Dissipation: The L298N can get hot during operation, especially at higher currents. Use a heat sink or active cooling to prevent overheating.
  • Power Supply: Ensure the external power supply voltage matches the requirements of your motors.
  • Current Limits: Do not exceed the 2A continuous current rating per channel to avoid damaging the module.
  • Jumper Settings: If using PWM for speed control, remove the jumpers on the ENA and ENB pins.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Check all power and ground connections.
    • Verify that the IN pins are receiving the correct HIGH/LOW signals.
    • Ensure the ENA and ENB pins are properly connected or the jumpers are in place.
  2. Motors Running in the Wrong Direction:

    • Swap the connections of the motor terminals (OUT1/OUT2 or OUT3/OUT4).
    • Reverse the HIGH/LOW signals sent to the IN pins.
  3. Overheating:

    • Add a heat sink or fan to the L298N module.
    • Reduce the load on the motors or use motors with lower current requirements.
  4. Microcontroller Resetting:

    • Ensure the power supply can handle the combined current draw of the motors and the L298N module.
    • Use a separate power supply for the motors and the microcontroller, connecting their grounds.

FAQs

  • Can the L298N drive stepper motors? Yes, the L298N can control stepper motors by energizing the coils in the correct sequence. This requires additional programming.

  • What is the purpose of the 5V pin? The 5V pin provides a regulated 5V output that can power a microcontroller. However, it should not be used if the motor supply voltage exceeds 12V.

  • Can I use the L298N with a 3.3V microcontroller? Yes, but you may need level shifters to ensure proper logic levels for the control pins.