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 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
  • Control Logic Levels: Low (0V to 1.5V), High (2.3V to 5V)
  • Power Dissipation: 25W (with proper heat sinking)
  • Built-in Protection: Thermal shutdown and overcurrent protection
  • Number of Channels: 2 (dual H-bridge)
  • Motor Types Supported: DC motors and stepper motors

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 Controls the direction of Motor A (High/Low).
IN2 Input Controls the direction of Motor A (High/Low).
IN3 Input Controls the direction of Motor B (High/Low).
IN4 Input Controls the direction of Motor B (High/Low).
ENA Input (PWM) Enables and controls the speed of Motor A (PWM signal).
ENB Input (PWM) Enables and controls the speed of Motor B (PWM signal).
OUT1 Output Connects to one terminal of Motor A.
OUT2 Output Connects to the other terminal of Motor A.
OUT3 Output Connects to one terminal of Motor B.
OUT4 Output Connects to the other terminal of Motor B.
12V Power Input Connects to the motor power supply (up to 46V).
5V Power Output Provides 5V output (used to power logic circuits if no external 5V is supplied).
GND Ground Common ground for the circuit.

Note: The onboard 5V regulator is active only if the motor power supply voltage is greater than 7V.

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the motor power supply (e.g., 12V) to the 12V pin.
    • Connect the ground of the power supply to the GND pin.
    • If your microcontroller operates at 5V, you can use the 5V pin to power it (if the motor supply voltage is >7V).
  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 ENA and ENB pins to PWM-capable pins on your microcontroller to control motor speed.
    • Connect IN1, IN2, IN3, and IN4 to digital pins on your microcontroller to control motor direction.
  4. Logic Power:

    • If your microcontroller has its own 5V power supply, connect it to the 5V pin on the L298N module.

Example Arduino Code

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

// Define motor control pins
#define ENA 9  // PWM pin for Motor A speed control
#define IN1 8  // Direction control for Motor A
#define IN2 7  // Direction control for Motor A
#define ENB 10 // PWM pin for Motor B speed control
#define IN3 6  // Direction control for Motor B
#define IN4 5  // Direction control for Motor B

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

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

Important Considerations and Best Practices

  • Use a heat sink with the L298N to prevent overheating, especially when driving motors at high currents.
  • Ensure the motor power supply voltage matches the motor's rated voltage.
  • Avoid exceeding the maximum current rating (2A per channel) to prevent damage to the IC.
  • Use external diodes for additional protection if your motors generate significant back EMF.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Check all power connections and ensure the motor power supply is connected to the 12V pin.
    • Verify that the ENA and ENB pins are receiving a valid PWM signal.
  2. Motors Running in the Wrong Direction:

    • Swap the connections of IN1 and IN2 (or IN3 and IN4) to reverse the motor direction.
  3. Overheating:

    • Attach a heat sink to the L298N IC.
    • Reduce the motor load or use motors with lower current requirements.
  4. No Output on the 5V Pin:

    • Ensure the motor power supply voltage is greater than 7V for the onboard 5V regulator to function.

FAQs

  • Can the L298N drive stepper motors? Yes, the L298N can drive bipolar stepper motors by controlling the two H-bridge channels.

  • What is the maximum voltage the L298N can handle? The L298N can handle up to 46V on the motor power supply pin.

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

  • Why is my motor speed inconsistent? Check the PWM signal quality and ensure the power supply can provide sufficient current.