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

How to Use L298N DC motor driver: Examples, Pinouts, and Specs

Image of L298N DC motor driver
Cirkit Designer LogoDesign with L298N DC motor driver in Cirkit Designer

Introduction

The L298N is a dual H-bridge motor driver that enables control of the direction and speed of DC motors using Pulse Width Modulation (PWM) signals. It is capable of driving two DC motors simultaneously, making it a versatile and widely used component in robotics, automation, and motor control projects. The L298N is designed to handle motors with operating voltages between 5V and 35V and can deliver up to 2A of current per channel.

Explore Projects Built with L298N DC 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!
L298N DC Motor Driver Controlled DC Motor System
Image of 275 GC: A project utilizing L298N DC 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
Wi-Fi Controlled Quad DC Motor Driver System
Image of abhinand: A project utilizing L298N DC motor driver in a practical application
This circuit is designed to control four DC motors using an L298N motor driver module, which is interfaced with an ESP8266 NodeMCU microcontroller. The NodeMCU's digital pins (D1-D6) are connected to the input pins of the L298N to control the speed and direction of the motors. A 12V battery provides power to the motors through the motor driver, and also powers the NodeMCU through a voltage regulator on the L298N.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino and L298N Motor Driver Controlled DC Motor System
Image of trial2: A project utilizing L298N DC motor driver in a practical application
This circuit controls a DC motor using an L298N motor driver module, powered by three 12V batteries. An Arduino UNO is used to provide 5V power to the motor driver and can be programmed to control the motor's operation.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Controlled Fire Detection and GSM Notification System
Image of l298n motor driver test: A project utilizing L298N DC motor driver in a practical application
This circuit is designed to control multiple DC motors using an L298N motor driver, which is interfaced with an Arduino UNO microcontroller. The Arduino controls the direction and speed of the motors, as well as a servo motor, and can activate a water pump via a relay module. Additionally, the circuit includes flame and smoke sensors for safety monitoring, and a SIM800L module for potential communication capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with L298N DC 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 275 GC: A project utilizing L298N DC 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
Image of abhinand: A project utilizing L298N DC motor driver in a practical application
Wi-Fi Controlled Quad DC Motor Driver System
This circuit is designed to control four DC motors using an L298N motor driver module, which is interfaced with an ESP8266 NodeMCU microcontroller. The NodeMCU's digital pins (D1-D6) are connected to the input pins of the L298N to control the speed and direction of the motors. A 12V battery provides power to the motors through the motor driver, and also powers the NodeMCU through a voltage regulator on the L298N.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of trial2: A project utilizing L298N DC motor driver in a practical application
Arduino and L298N Motor Driver Controlled DC Motor System
This circuit controls a DC motor using an L298N motor driver module, powered by three 12V batteries. An Arduino UNO is used to provide 5V power to the motor driver and can be programmed to control the motor's operation.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of l298n motor driver test: A project utilizing L298N DC motor driver in a practical application
Arduino-Controlled Fire Detection and GSM Notification System
This circuit is designed to control multiple DC motors using an L298N motor driver, which is interfaced with an Arduino UNO microcontroller. The Arduino controls the direction and speed of the motors, as well as a servo motor, and can activate a water pump via a relay module. Additionally, the circuit includes flame and smoke sensors for safety monitoring, and a SIM800L module for potential communication capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Robotics: Controlling the movement of robot wheels or arms.
  • Automation: Driving conveyor belts or automated systems.
  • DIY Projects: Building remote-controlled cars, drones, or other motorized devices.
  • Educational Projects: Learning about motor control and H-bridge circuits.

Technical Specifications

Key Technical Details

  • Operating Voltage (Logic): 5V
  • Motor Supply Voltage (Vmotor): 5V to 35V
  • Maximum Output Current (Per Channel): 2A
  • Logic Current: 0mA to 36mA
  • Control Method: PWM for speed control, logic HIGH/LOW for direction control
  • Number of Channels: 2 (dual H-bridge)
  • Built-in Protection: Thermal shutdown and overcurrent protection
  • Dimensions: Approximately 43mm x 43mm x 27mm

Pin Configuration and Descriptions

The L298N module has several pins and terminals for motor control and power input. Below is a detailed description:

Power and Motor Terminals

Pin/Terminal Description
VCC Motor power supply (5V to 35V). Connect to the motor's power source.
GND Ground connection. Common ground for logic and motor power.
5V Logic power supply (5V). Can also be used as a 5V output if VCC > 7V.
OUT1 Output for Motor 1 (connect to one terminal of Motor 1).
OUT2 Output for Motor 1 (connect to the other terminal of Motor 1).
OUT3 Output for Motor 2 (connect to one terminal of Motor 2).
OUT4 Output for Motor 2 (connect to the other terminal of Motor 2).

Control Pins

Pin Description
ENA Enable pin for Motor 1. Use PWM signal to control speed.
ENB Enable pin for Motor 2. Use PWM signal to control speed.
IN1 Input pin for Motor 1. Logic HIGH/LOW controls direction.
IN2 Input pin for Motor 1. Logic HIGH/LOW controls direction.
IN3 Input pin for Motor 2. Logic HIGH/LOW controls direction.
IN4 Input pin for Motor 2. Logic HIGH/LOW controls direction.

Usage Instructions

How to Use the L298N in a Circuit

  1. Power Connections:

    • Connect the motor power supply to the VCC terminal (5V to 35V).
    • Connect the ground of the power supply to the GND terminal.
    • If the motor power supply is greater than 7V, the 5V pin can be used as a 5V output to power external logic circuits.
  2. Motor Connections:

    • Connect the terminals of Motor 1 to OUT1 and OUT2.
    • Connect the terminals of Motor 2 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 operates at 5V, connect its 5V output to the 5V pin on the L298N module.

Important Considerations and Best Practices

  • Ensure the motor power supply voltage matches the motor's operating voltage.
  • Use a heat sink or cooling fan if driving motors at high currents for extended periods.
  • Avoid exceeding the maximum current rating of 2A per channel to prevent damage.
  • Use appropriate decoupling capacitors on the power supply to reduce noise.

Example: Connecting to an Arduino UNO

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

Circuit Connections

  • ENA → Arduino Pin 9 (PWM)
  • ENB → Arduino Pin 10 (PWM)
  • IN1 → Arduino Pin 7
  • IN2 → Arduino Pin 6
  • IN3 → Arduino Pin 5
  • IN4 → Arduino Pin 4
  • VCC → External Motor Power Supply (e.g., 12V)
  • GND → Common Ground (Arduino and Motor Power Supply)

Arduino Code

// Define control pins for Motor 1
#define ENA 9  // PWM pin for speed control
#define IN1 7  // Direction control pin
#define IN2 6  // Direction control pin

// Define control pins for Motor 2
#define ENB 10 // PWM pin for speed control
#define IN3 5  // Direction control pin
#define IN4 4  // Direction control pin

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 1: Forward at 50% speed
  analogWrite(ENA, 128); // Set speed (0-255)
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);

  // Motor 2: Backward at 75% speed
  analogWrite(ENB, 192); // Set speed (0-255)
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);

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

  // Stop both motors
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);

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

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Ensure the motor power supply is connected and providing sufficient voltage.
    • Verify that the ENA and ENB pins are receiving PWM signals.
    • Check the wiring of the motor terminals (OUT1, OUT2, OUT3, OUT4).
  2. Motors Running in the Wrong Direction:

    • Swap the connections of IN1 and IN2 (or IN3 and IN4) to reverse the motor direction.
    • Verify the logic levels being sent to the direction control pins.
  3. Overheating:

    • Use a heat sink or cooling fan to dissipate heat.
    • Reduce the motor load or operating current.
  4. No 5V Output:

    • 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 stepper motors by controlling the sequence of the H-bridge outputs.

  • What is the maximum motor current the L298N can handle? The L298N can handle up to 2A per channel, but a heat sink is recommended for high currents.

  • Can I use the L298N with a 3.3V microcontroller? The L298N is designed for 5V logic. Use a level shifter or ensure the control signals are compatible.