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 IC designed to control the direction and speed of DC motors and stepper motors. It is widely used in robotics and automation projects due to its ability to drive two motors simultaneously with a current capacity of up to 2A per channel. The L298N is a versatile and reliable component, making it a popular choice for hobbyists and professionals alike.

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 tracks of robots
  • Automation: Controlling conveyor belts or actuators
  • DIY Projects: Building remote-controlled cars or robotic arms
  • Stepper Motor Control: Precise positioning in CNC machines or 3D printers

Technical Specifications

The L298N motor driver module is based on the L298N IC and typically comes with additional components like a heat sink and terminal blocks for easy connections. Below are the key technical details:

Key Technical Details

  • Operating Voltage: 5V to 46V
  • Maximum Current: 2A per channel (4A total with both channels)
  • Logic Voltage: 5V
  • Control Logic Levels: High (1) = 2.3V to 5V, Low (0) = 0V to 1.5V
  • Power Dissipation: 25W (with proper heat dissipation)
  • Built-in diodes for back EMF protection
  • Dimensions (module): ~43mm x 43mm x 27mm

Pin Configuration and Descriptions

The L298N module typically has the following pins and terminals:

Control Pins

Pin Name Description
ENA Enables motor A (High = Enabled, Low = Disabled)
IN1 Input 1 for motor A (controls direction when combined with IN2)
IN2 Input 2 for motor A (controls direction when combined with IN1)
ENB Enables motor B (High = Enabled, Low = Disabled)
IN3 Input 1 for motor B (controls direction when combined with IN4)
IN4 Input 2 for motor B (controls direction when combined with IN3)

Power and Motor Terminals

Pin Name Description
VCC Power supply for motors (5V to 46V)
GND Ground connection
5V Logic voltage output (can power external microcontroller if jumper is set)
OUT1, OUT2 Motor A output terminals
OUT3, OUT4 Motor B output terminals

Usage Instructions

The L298N motor driver is straightforward to use in a circuit. Below are the steps and considerations for using it effectively:

Connecting the L298N

  1. Power Supply: Connect the motor power supply to the VCC terminal and ground to the GND terminal. Ensure the voltage matches the motor's requirements.
  2. Logic Power: If using a 5V microcontroller (e.g., Arduino), you can use the onboard 5V pin to power the logic circuit. Ensure the jumper is set to enable this feature.
  3. Motor Connections: Connect the motor terminals to OUT1 and OUT2 for motor A, and OUT3 and OUT4 for motor B.
  4. Control Pins: Connect the control pins (ENA, IN1, IN2, etc.) to the microcontroller's GPIO pins.

Controlling a DC Motor with Arduino

Below is an example of how to control a single DC motor using the L298N and an Arduino UNO:

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

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

void loop() {
  // Rotate motor A forward
  digitalWrite(IN1, HIGH);  // Set IN1 high
  digitalWrite(IN2, LOW);   // Set IN2 low
  analogWrite(ENA, 150);    // Set speed (0-255)

  delay(2000);              // Run for 2 seconds

  // Rotate motor A backward
  digitalWrite(IN1, LOW);   // Set IN1 low
  digitalWrite(IN2, HIGH);  // Set IN2 high
  analogWrite(ENA, 150);    // Set speed (0-255)

  delay(2000);              // Run for 2 seconds

  // Stop motor A
  digitalWrite(IN1, LOW);   // Set IN1 low
  digitalWrite(IN2, LOW);   // Set IN2 low
  analogWrite(ENA, 0);      // Set speed to 0

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

Important Considerations

  • Heat Dissipation: The L298N 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.
  • Back EMF Protection: The L298N has built-in diodes to protect against back EMF, but additional protection may be needed for high-inductance motors.

Troubleshooting and FAQs

Common Issues

  1. Motor Not Running:

    • Check the power supply connections and ensure the voltage is within the operating range.
    • Verify that the ENA pin is set to HIGH or receiving a PWM signal.
    • Ensure the motor connections are secure and correct.
  2. Overheating:

    • Ensure the heat sink is properly attached and consider adding a cooling fan.
    • Reduce the motor load or current if possible.
  3. Erratic Motor Behavior:

    • Check for loose connections or poor solder joints.
    • Verify that the control signals from the microcontroller are correct.
  4. No Output on 5V Pin:

    • Ensure the jumper is set to enable the onboard 5V regulator.
    • Verify that the input voltage to VCC is at least 7V (required for the onboard regulator).

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive bipolar stepper motors by controlling the two H-bridges. You will need to sequence the control signals appropriately.

Q: Can I use the L298N with a 3.3V microcontroller?
A: The L298N is designed for 5V logic levels. You may need a level shifter to interface with a 3.3V microcontroller.

Q: What is the maximum current the L298N can handle?
A: The L298N can handle up to 2A per channel, but proper heat dissipation is required to avoid overheating.

Q: Can I control the speed of the motor?
A: Yes, you can control the motor speed by providing a PWM signal to the ENA or ENB pins.

By following this documentation, you can effectively use the L298N motor driver in your projects.