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 robust component, making it ideal for applications such as robotic arms, motorized vehicles, conveyor belts, and other motor-driven systems.

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

Technical Specifications

  • Operating Voltage: 5V to 46V
  • Output Current: Up to 2A per channel
  • Logic Voltage: 5V
  • Logic Current: 36mA
  • Power Dissipation: 25W (with proper heat sinking)
  • Control Inputs: TTL-compatible
  • Number of Channels: 2 (dual H-bridge)
  • Built-in Protection: Thermal shutdown and overcurrent protection

Pin Configuration and Descriptions

The L298N module typically comes with a breakout board for easier use. Below is the pin configuration for the module:

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. Connect to one terminal of Motor A.
OUT2 Output Motor A output 2. Connect to the other terminal of Motor A.
OUT3 Output Motor B output 1. Connect to one terminal of Motor B.
OUT4 Output Motor B output 2. Connect to the other terminal of Motor B.
VCC Power Input Motor power supply (5V to 46V).
GND Power Ground Ground connection.
5V Power Output Provides 5V output (useful for powering logic circuits if the motor voltage
exceeds 7V).

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the motor power supply to the VCC pin (ensure it matches the motor's voltage rating).
    • Connect the GND pin to the ground of your power supply and the ground of your control circuit.
    • If your motor power supply is greater than 7V, you can use the 5V pin to power your control logic.
  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:

    • Use the IN1 and IN2 pins to control the direction of Motor A.
    • Use the IN3 and IN4 pins to control the direction of Motor B.
    • Use the ENA and ENB pins to enable/disable the motors or control their speed using a PWM signal.
  4. Logic Control:

    • Connect the control pins (IN1, IN2, IN3, IN4, ENA, ENB) to a microcontroller or other control circuit.

Important Considerations and Best Practices

  • Always use a heat sink with the L298N to prevent overheating during operation.
  • Ensure the motor power supply voltage matches the motor's specifications.
  • Use external diodes for additional protection if driving inductive loads.
  • Avoid exceeding the maximum current rating of 2A per channel to prevent damage to the IC.

Example: Using L298N with Arduino UNO

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

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

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

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

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

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

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

  // Stop motor
  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
}

Troubleshooting and FAQs

Common Issues

  1. Motor Not Running:

    • Check the power supply connections to ensure proper voltage and current.
    • Verify that the control pins are correctly connected to the microcontroller.
    • Ensure the ENA or ENB pins are enabled (set high or receiving a PWM signal).
  2. Overheating:

    • Ensure a heat sink is attached to the L298N IC.
    • Check that the motor's current draw does not exceed 2A per channel.
  3. Erratic Motor Behavior:

    • Verify that the ground connections between the motor driver, power supply, and control circuit are properly connected.
    • Check for loose or faulty wiring.

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive stepper motors by controlling the sequence of the H-bridge inputs. However, additional software logic is required to generate the correct stepping sequence.

Q: Can I use the L298N with a 3.3V microcontroller?
A: The L298N is designed for 5V logic levels. If using a 3.3V microcontroller, level shifters may be required for reliable operation.

Q: What is the purpose of the 5V pin on the module?
A: The 5V pin provides a regulated 5V output when the motor power supply exceeds 7V. It can be used to power the control logic or other low-power components.

Q: How do I control motor speed with the L298N?
A: Motor speed can be controlled by applying a PWM signal to the ENA or ENB pins. The duty cycle of the PWM signal determines the motor speed.