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

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

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

Introduction

The L298N Motor Driver, manufactured by Arduino (Part ID: L298N), is a dual H-bridge motor driver designed to control two DC motors or one stepper motor. It supports motor voltage ranges from 5V to 35V and can handle up to 2A per channel, making it ideal for robotics and automation projects. The L298N allows for precise control of motor speed and direction, making it a popular choice for hobbyists and professionals alike.

Explore Projects Built with L298N Motor Driver - Robo

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-Based Line Following Robot with L298N Motor Driver and IR Sensor Array
Image of RC_Car: A project utilizing L298N Motor Driver - Robo in a practical application
This circuit is a line-following robot that uses an Arduino Expansion Board to control two DC motors via an L298N motor driver. The robot uses a 5-channel IR sensor array to detect the line and adjust the motor speeds accordingly, powered by a 2200mAH LiPo battery and controlled through a PID algorithm implemented in the Arduino code.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO Controlled Robot with Bluetooth and Ultrasonic Sensor
Image of vhjv: A project utilizing L298N Motor Driver - Robo 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
Arduino UNO-Based Line Following and Obstacle Avoidance Robot with IR Sensors and Ultrasonic Distance Sensor
Image of 461 Lab Project: A project utilizing L298N Motor Driver - Robo in a practical application
This circuit is a robotic system controlled by an Arduino UNO, featuring a 5-channel IR array for line detection, an HC-SR04 ultrasonic sensor for distance measurement, and a micro servo for precise movement. The L298N motor driver controls two hobby gearmotors powered by a 18650 Li-Ion battery, enabling the robot to navigate its environment.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Controlled Line-Following Robot with Dual TCS3200 Color Sensors
Image of my first: A project utilizing L298N Motor Driver - Robo in a practical application
This circuit is designed for a line-following robot that uses a pair of tcs3200 color sensors to detect and follow a line on the ground. The L298N motor driver controls two sets of motors and wheels, receiving commands from an Arduino Nano, which processes the sensor data to steer the robot. The Arduino Nano's embedded code enables the robot to move forward, turn left, turn right, or stop based on the line's position relative to the sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with L298N Motor Driver - Robo

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 RC_Car: A project utilizing L298N Motor Driver - Robo in a practical application
Arduino-Based Line Following Robot with L298N Motor Driver and IR Sensor Array
This circuit is a line-following robot that uses an Arduino Expansion Board to control two DC motors via an L298N motor driver. The robot uses a 5-channel IR sensor array to detect the line and adjust the motor speeds accordingly, powered by a 2200mAH LiPo battery and controlled through a PID algorithm implemented in the Arduino code.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of vhjv: A project utilizing L298N Motor Driver - Robo 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 461 Lab Project: A project utilizing L298N Motor Driver - Robo in a practical application
Arduino UNO-Based Line Following and Obstacle Avoidance Robot with IR Sensors and Ultrasonic Distance Sensor
This circuit is a robotic system controlled by an Arduino UNO, featuring a 5-channel IR array for line detection, an HC-SR04 ultrasonic sensor for distance measurement, and a micro servo for precise movement. The L298N motor driver controls two hobby gearmotors powered by a 18650 Li-Ion battery, enabling the robot to navigate its environment.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of my first: A project utilizing L298N Motor Driver - Robo in a practical application
Arduino-Controlled Line-Following Robot with Dual TCS3200 Color Sensors
This circuit is designed for a line-following robot that uses a pair of tcs3200 color sensors to detect and follow a line on the ground. The L298N motor driver controls two sets of motors and wheels, receiving commands from an Arduino Nano, which processes the sensor data to steer the robot. The Arduino Nano's embedded code enables the robot to move forward, turn left, turn right, or stop based on the line's position relative to the sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Robotics: Controlling wheels or tracks in mobile robots.
  • Automation: Driving conveyor belts or actuators.
  • DIY Projects: Building RC cars, robotic arms, or CNC machines.
  • Educational Purposes: Learning motor control and H-bridge concepts.

Technical Specifications

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

Parameter Value
Operating Voltage 5V to 35V
Output Current Up to 2A per channel
Logic Voltage 5V
Control Logic Levels High: 2.3V to 5V, Low: 0V
Number of Channels 2 (dual H-bridge)
Power Dissipation 25W (with proper heat sink)
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 Motor power supply (5V to 35V).
GND Ground connection.
5V Logic power supply (optional, if not using onboard regulator).
OUT1, OUT2 Outputs for Motor A.
OUT3, OUT4 Outputs for Motor B.

Control Pins

Pin Description
ENA Enable pin for Motor A (PWM input for speed control).
ENB Enable pin for Motor B (PWM input for speed control).
IN1, IN2 Control pins for Motor A direction.
IN3, IN4 Control pins for Motor B 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 using the onboard 5V regulator, the 5V pin can be used to power the logic circuit.
  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 for speed control.
    • Connect IN1, IN2, IN3, and IN4 to digital pins on your microcontroller for direction control.
  4. Logic Power:

    • If the motor power supply is greater than 12V, do not use the onboard 5V regulator to power the logic circuit. Instead, provide a separate 5V supply to the 5V pin.

Arduino UNO Example Code

Below is an example code to control two DC motors using the L298N Motor Driver with an Arduino UNO:

// Define control pins for Motor A
const int ENA = 9;  // PWM pin for speed control
const int IN1 = 8;  // Direction control pin 1
const int IN2 = 7;  // Direction control pin 2

// Define control pins for Motor B
const int ENB = 10; // PWM pin for speed control
const int IN3 = 6;  // Direction control pin 1
const int IN4 = 5;  // Direction control pin 2

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 speed (0-255)

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

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

  // Stop both motors
  analogWrite(ENA, 0);      // Stop Motor A
  analogWrite(ENB, 0);      // Stop Motor B
  delay(2000); // Wait for 2 seconds
}

Important Considerations and Best Practices

  • Use a heat sink on the L298N module if driving motors with high current to prevent overheating.
  • Ensure the motor power supply voltage matches the motor's rated voltage.
  • Avoid exceeding the 2A current limit per channel to prevent damage to the driver.
  • Use proper decoupling capacitors on the power supply to reduce noise.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Check all power connections and ensure the motor power supply is within the specified range.
    • Verify that the enable pins (ENA and ENB) are receiving a 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 module.
    • Reduce the motor load or current draw.
  4. No Output Voltage on Motor Terminals:

    • Ensure the control pins (IN1, IN2, IN3, IN4) are correctly configured in the code.
    • Check for loose connections or damaged wires.

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive a bipolar stepper motor by controlling the two H-bridges. However, additional code is required to generate the step sequence.

Q: Can I use the onboard 5V regulator to power my Arduino?
A: Yes, but only if the motor power supply is between 7V and 12V. For higher voltages, use a separate 5V power supply for the Arduino.

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

Q: Can I control more than two motors with one L298N?
A: No, the L298N is designed to control up to two DC motors or one stepper motor. For more motors, additional drivers are required.