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 allows control of the direction and speed of DC motors. It is capable of driving two DC motors simultaneously, making it an essential component in robotics and automation projects. The module can handle motors with operating voltages between 5V and 35V and currents up to 2A per channel. Its versatility and ease of use make it a popular choice for hobbyists and professionals alike.

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

  • Robotics: Controlling wheels or tracks in mobile robots
  • Automation: Driving conveyor belts or actuators
  • DIY projects: Building remote-controlled cars or robotic arms
  • Educational purposes: Learning motor control and H-bridge concepts

Technical Specifications

Below are the key technical details of the L298N motor driver module:

Parameter Value
Operating Voltage 5V to 35V
Output Current Up to 2A per channel
Logic Voltage 5V
Logic Current 0-36mA
Power Dissipation 25W (with proper heat sinking)
Control Signal Voltage 4.5V to 7V (high logic level)
Number of Channels 2 (dual H-bridge)
Dimensions 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 Power supply for motors (5V to 35V)
GND Ground connection
5V Regulated 5V output (used if onboard regulator is active)
OUT1 Output for Motor A (positive terminal)
OUT2 Output for Motor A (negative terminal)
OUT3 Output for Motor B (positive terminal)
OUT4 Output for Motor B (negative terminal)

Control Pins

Pin Description
ENA Enable pin for Motor A (PWM input for speed control)
IN1 Input 1 for Motor A (direction control)
IN2 Input 2 for Motor A (direction control)
ENB Enable pin for Motor B (PWM input for speed control)
IN3 Input 3 for Motor B (direction control)
IN4 Input 4 for Motor B (direction control)

Usage Instructions

How to Use the L298N in a Circuit

  1. Power the Module: Connect the motor power supply to the VCC terminal and ground to the GND terminal. If the motor voltage exceeds 12V, ensure the onboard 5V regulator is enabled by removing the jumper on the 5V pin.
  2. Connect Motors: Attach the DC motors to the OUT1, OUT2, OUT3, and OUT4 terminals. Each motor requires two terminals.
  3. Control Pins: Connect the control pins (ENA, ENB, IN1, IN2, IN3, IN4) to a microcontroller or other control circuit. Use PWM signals on ENA and ENB for speed control.
  4. Direction Control: Use the IN1/IN2 pair for Motor A and IN3/IN4 pair for Motor B to set the direction of rotation.

Important Considerations

  • Heat Dissipation: The L298N can get hot during operation. Use a heat sink or active cooling for high-current applications.
  • Power Supply: Ensure the motor power supply matches the voltage and current requirements of your motors.
  • Logic Voltage: The control pins operate at 5V logic levels. Use level shifters if interfacing with 3.3V systems.

Example: Connecting to an Arduino UNO

Below is an example of how to control a single 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 to OUT1 and OUT2.
  • Connect the motor power supply to VCC and GND.

Arduino Code

// Define control pins for 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 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 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
}

Troubleshooting and FAQs

Common Issues

  1. Motor Not Spinning

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

    • Cause: High current draw or insufficient cooling.
    • Solution: Add a heat sink or active cooling to the L298N module.
  3. Motor Spins in One Direction Only

    • Cause: Faulty or incorrect control signals.
    • Solution: Verify the logic levels on the IN1, IN2, IN3, and IN4 pins.
  4. PWM Speed Control Not Working

    • Cause: Incorrect PWM signal or damaged ENA/ENB pins.
    • Solution: Ensure the PWM signal is properly configured and test with a different pin.

FAQs

  • Can the L298N drive stepper motors? Yes, the L298N can control stepper motors by using both H-bridge channels. However, additional logic is required to sequence the motor phases.

  • What is the maximum motor voltage the L298N can handle? The module supports motor voltages up to 35V.

  • Can I use the L298N with a 3.3V microcontroller? The L298N requires 5V logic levels. Use a level shifter to interface with 3.3V systems.