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

How to Use L298N Motor Driver: Examples, Pinouts, and Specs

Image of L298N Motor Driver
Cirkit Designer LogoDesign with L298N Motor Driver in Cirkit Designer

Introduction

The L298N Motor Driver, manufactured by QWER (Part ID: L298N), is an integrated circuit designed to control two DC motors or a single stepper motor. It supports bidirectional control and speed regulation using PWM (Pulse Width Modulation). With a current handling capacity of up to 2A per channel and an operating voltage range of 5V to 35V, the L298N is a versatile and reliable choice for robotics, automation, and motor control applications.

Explore Projects Built with L298N Motor Driver

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Line Following Robot with L298N Motor Driver and KY-033 Sensors
Image of obstacle-avoiding robot: A project utilizing L298N Motor Driver 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
ESP32-Controlled Dual Motor Driver for Robotic Vehicle
Image of ESP 32 BT BOT: A project utilizing L298N Motor Driver in a practical application
This circuit is designed to control four DC gearmotors using an L298N motor driver module, which is interfaced with an ESP32 microcontroller. The ESP32 uses its GPIO pins to send control signals to the L298N driver, enabling the independent operation of the motors, such as direction and speed control. Power is supplied by a 12V battery connected to the motor driver, with the ESP32 receiving its power through a voltage regulator on the L298N module.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 and L298N Motor Driver-Based Wi-Fi Controlled Robotic Car
Image of ESP 32 BT BOT: A project utilizing L298N Motor Driver in a practical application
This circuit is a motor control system using an ESP32 microcontroller and an L298N motor driver to control four DC gear motors. The ESP32 provides control signals to the L298N, which in turn drives the motors, powered by a 12V battery, enabling bidirectional control of the motors for applications such as a robotic vehicle.
Cirkit Designer LogoOpen Project in Cirkit Designer
L298N DC Motor Driver Controlled DC Motor System
Image of 275 GC: A project utilizing L298N Motor Driver in a practical application
This circuit is designed to control a DC motor using an L298N motor driver module. The motor driver is powered by a DC power source and interfaces with the motor through its output pins, while resistors are used to manage the input signals to the driver.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with L298N Motor Driver

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 obstacle-avoiding robot: A project utilizing L298N Motor Driver 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
Image of ESP 32 BT BOT: A project utilizing L298N Motor Driver in a practical application
ESP32-Controlled Dual Motor Driver for Robotic Vehicle
This circuit is designed to control four DC gearmotors using an L298N motor driver module, which is interfaced with an ESP32 microcontroller. The ESP32 uses its GPIO pins to send control signals to the L298N driver, enabling the independent operation of the motors, such as direction and speed control. Power is supplied by a 12V battery connected to the motor driver, with the ESP32 receiving its power through a voltage regulator on the L298N module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ESP 32 BT BOT: A project utilizing L298N Motor Driver in a practical application
ESP32 and L298N Motor Driver-Based Wi-Fi Controlled Robotic Car
This circuit is a motor control system using an ESP32 microcontroller and an L298N motor driver to control four DC gear motors. The ESP32 provides control signals to the L298N, which in turn drives the motors, powered by a 12V battery, enabling bidirectional control of the motors for applications such as a robotic vehicle.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of 275 GC: A project utilizing L298N Motor Driver in a practical application
L298N DC Motor Driver Controlled DC Motor System
This circuit is designed to control a DC motor using an L298N motor driver module. The motor driver is powered by a DC power source and interfaces with the motor through its output pins, while resistors are used to manage the input signals to the driver.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Robotics: Driving wheels or robotic arms
  • Automation systems: Conveyor belts, actuators
  • DIY projects: RC cars, drones, and other motorized devices
  • Stepper motor control for CNC machines or 3D printers

Technical Specifications

Below are the key technical details of the L298N Motor Driver:

Parameter Value
Manufacturer QWER
Part ID L298N
Operating Voltage 5V to 35V
Maximum Current 2A per channel
Logic Voltage 5V
PWM Frequency Up to 20 kHz
Number of Channels 2 (H-Bridge configuration)
Motor Types Supported DC motors, stepper motors
Operating Temperature -25°C to +130°C

Pin Configuration and Descriptions

The L298N Motor Driver has the following pin configuration:

Pin Name Pin Type Description
IN1 Input Control input for Motor A (logic HIGH or LOW)
IN2 Input Control input for Motor A (logic HIGH or LOW)
IN3 Input Control input for Motor B (logic HIGH or LOW)
IN4 Input Control input for Motor B (logic HIGH or LOW)
ENA Input (PWM) Enable pin for Motor A (connect to PWM for speed control)
ENB Input (PWM) Enable pin for Motor B (connect to PWM for speed control)
OUT1 Output Output to Motor A terminal 1
OUT2 Output Output to Motor A terminal 2
OUT3 Output Output to Motor B terminal 1
OUT4 Output Output to Motor B terminal 2
VCC Power Input Motor power supply (5V to 35V)
GND Ground Common ground
5V Power Output 5V output (used to power logic circuits if needed)

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 the motor power supply is above 7V, you can use the onboard 5V regulator to power the logic circuit by connecting the 5V pin to your microcontroller.
  2. Motor Connections:

    • For Motor A, connect its terminals to OUT1 and OUT2.
    • For Motor B, connect its terminals to OUT3 and OUT4.
  3. Control Connections:

    • Connect the IN1 and IN2 pins to your microcontroller to control Motor A's direction.
    • Connect the IN3 and IN4 pins to your microcontroller to control Motor B's direction.
    • Use the ENA and ENB pins for speed control by providing a PWM signal.
  4. Logic Power:

    • If using an external 5V logic power source, connect it to the 5V pin. Ensure the ground of the logic power source is connected to the GND pin.

Important Considerations

  • Heat Dissipation: The L298N can get hot during operation. Use a heatsink or active cooling for high-current applications.
  • Current Limitation: Ensure the motor's current does not exceed 2A per channel to avoid damage.
  • Flyback Diodes: The L298N has built-in flyback diodes to protect against voltage spikes caused by motor inductance.

Example: Connecting to an Arduino UNO

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

Circuit Connections

  • Connect ENA to Arduino pin 9 (PWM output).
  • Connect IN1 to Arduino pin 8.
  • Connect IN2 to Arduino pin 7.
  • Connect the motor terminals to OUT1 and OUT2.
  • Connect the motor power supply to VCC and GND.

Arduino Code

// L298N Motor Driver Example with Arduino UNO
// Controls a single DC motor connected to Motor A

#define ENA 9  // PWM pin for speed control
#define IN1 8  // Direction control pin 1
#define 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 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 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
  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 Spinning:

    • Check the power supply voltage and ensure it matches the motor's requirements.
    • Verify the connections to the IN and OUT pins.
    • Ensure the ENA or ENB pin is receiving a PWM signal or is set HIGH.
  2. Overheating:

    • Ensure the current drawn by the motor does not exceed 2A per channel.
    • Use a heatsink or active cooling for high-current applications.
  3. Noisy Motor Operation:

    • Check for loose connections.
    • Use capacitors across the motor terminals to reduce electrical noise.

FAQs

Q: Can the L298N control stepper motors?
A: Yes, the L298N can control a bipolar stepper motor by using both channels (Motor A and Motor B).

Q: Can I use the onboard 5V regulator to power my Arduino?
A: Yes, if the motor power supply is above 7V, the onboard 5V regulator can provide power to the Arduino. However, ensure the current draw does not exceed the regulator's capacity.

Q: What is the maximum PWM frequency supported?
A: The L298N supports PWM frequencies up to 20 kHz.

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