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 maximum current of 2A per channel. The L298N is a versatile and cost-effective solution for motor control, making it a popular choice among 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
  • CNC machines: Operating stepper motors
  • DIY projects: Building remote-controlled cars or robotic arms

Technical Specifications

The L298N motor driver module is based on the L298N IC and typically includes additional components like a voltage regulator and terminal blocks for easy wiring. Below are the key technical details:

Key Specifications

  • Operating Voltage (Logic): 5V
  • Motor Supply Voltage (Vmotor): 5V to 35V
  • Maximum Current (Per Channel): 2A
  • Number of Channels: 2 (dual H-bridge)
  • Control Logic Levels: TTL-compatible
  • Power Dissipation: 25W (with proper heat sinking)
  • Built-in Protection: Thermal shutdown and overcurrent protection

Pin Configuration and Descriptions

The L298N module typically has the following pins and terminals:

Control Pins

Pin Name Description
ENA Enables motor A (PWM input for speed control)
IN1 Input 1 for motor A (direction control)
IN2 Input 2 for motor A (direction control)
ENB Enables motor B (PWM input for speed control)
IN3 Input 1 for motor B (direction control)
IN4 Input 2 for motor B (direction control)

Power and Motor Connections

Pin Name Description
VCC Motor power supply (5V to 35V)
GND Ground connection
5V Logic power supply (5V)
OUT1 Output 1 for motor A
OUT2 Output 2 for motor A
OUT3 Output 1 for motor B
OUT4 Output 2 for motor B

Note: Some L298N modules include a jumper to enable the onboard 5V regulator. If the jumper is in place, the module can provide 5V logic power from the motor supply voltage.

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the motor power supply to the VCC pin (5V to 35V).
    • Connect the ground of the power supply to the GND pin.
    • If using the onboard 5V regulator, ensure the jumper is in place and use the 5V pin for logic power.
  2. Motor Connections:

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

    • Connect the ENA and ENB pins to PWM-capable pins on your microcontroller for speed control.
    • Use IN1 and IN2 to control the direction of motor A, and IN3 and IN4 for motor B.
  4. Logic Power:

    • If not using the onboard regulator, provide 5V logic power to the 5V pin from an external source.

Important Considerations and Best Practices

  • Use a heat sink on the L298N IC to prevent overheating during high-current operation.
  • Ensure the motor supply voltage matches the motor's rated voltage.
  • Avoid exceeding the maximum current rating of 2A per channel.
  • Use flyback diodes if your module does not include them to protect the IC from voltage spikes.

Example Code for Arduino UNO

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

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

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

void loop() {
  // Rotate motor A forward at 50% speed
  analogWrite(ENA, 128);  // Set speed (0-255)
  digitalWrite(IN1, HIGH); // Set direction
  digitalWrite(IN2, LOW);
  delay(2000); // Run for 2 seconds

  // Rotate motor A backward at 75% speed
  analogWrite(ENA, 192);  // Set speed (0-255)
  digitalWrite(IN1, LOW);  // Set direction
  digitalWrite(IN2, HIGH);
  delay(2000); // Run for 2 seconds

  // Stop the motor
  analogWrite(ENA, 0);  // Set speed to 0
  delay(2000); // Wait for 2 seconds
}

Note: Adjust the ENA pin value (0-255) to control the motor speed.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motor Not Running:

    • Cause: Incorrect wiring or insufficient power supply.
    • Solution: Double-check all connections and ensure the power supply voltage matches the motor's requirements.
  2. Overheating:

    • Cause: Excessive current draw or inadequate heat dissipation.
    • Solution: Use a heat sink or fan to cool the IC, and ensure the motor's current rating is within the L298N's limits.
  3. Erratic Motor Behavior:

    • Cause: Noise or interference in the control signals.
    • Solution: Use decoupling capacitors near the power supply and keep control signal wires short.
  4. No Output Voltage:

    • Cause: Jumper for the onboard 5V regulator is missing or incorrectly placed.
    • Solution: Verify the jumper placement or provide an external 5V logic supply.

FAQs

  • Can the L298N drive stepper motors? Yes, the L298N can control bipolar stepper motors by using both H-bridge channels.

  • What is the maximum motor voltage supported? The L298N supports motor supply voltages from 5V to 35V.

  • Do I need external diodes? Most L298N modules include built-in flyback diodes, but verify this in your specific module's datasheet.

  • Can I control more than two motors? No, the L298N can control only two DC motors or one stepper motor. For more motors, use additional L298N modules.

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