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 capable of driving two motors simultaneously, making it a versatile choice for robotics, automation, and other motor control applications. The L298n can handle high currents and voltages, making it suitable for a wide range of projects, from small robots to industrial automation 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!
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
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
Wi-Fi Controlled Quad DC Motor Driver System
Image of abhinand: A project utilizing L298n 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
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

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 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 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 abhinand: A project utilizing L298n 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 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

Common Applications:

  • Robotics (e.g., motorized robots, robotic arms)
  • Automation systems
  • Electric vehicles (small-scale prototypes)
  • CNC machines and 3D printers
  • Conveyor belts and motorized platforms

Technical Specifications

Below are the key technical details of the L298n motor driver IC:

Parameter Value
Operating Voltage 5V to 46V
Maximum Output Current 2A per channel (continuous)
Peak Output Current 3A per channel (short duration)
Logic Voltage 5V
Power Dissipation 25W (with proper heat sinking)
Control Logic Levels High: 2.3V to 5V, Low: 0V to 1.5V
Number of Channels 2 (dual H-bridge)
Motor Types Supported DC motors, stepper motors
Built-in Protection Thermal shutdown, overcurrent

Pin Configuration and Descriptions

The L298n IC has 15 pins, each serving a specific purpose. Below is the pinout description:

Pin Number Pin Name Description
1 Enable A Enables or disables motor A (High = Enabled, Low = Disabled)
2 Input 1 Logic input to control motor A direction (connect to microcontroller)
3 Output 1 Output to motor A terminal 1
4 Ground Ground connection
5 Ground Ground connection
6 Output 2 Output to motor A terminal 2
7 VSS Logic voltage supply (typically 5V)
8 VS Motor power supply (up to 46V)
9 Output 3 Output to motor B terminal 1
10 Ground Ground connection
11 Ground Ground connection
12 Output 4 Output to motor B terminal 2
13 Input 2 Logic input to control motor B direction (connect to microcontroller)
14 Enable B Enables or disables motor B (High = Enabled, Low = Disabled)
15 Sense A/B Current sensing pins (optional, connect to ground if not used)

Usage Instructions

How to Use the L298n in a Circuit

  1. Power Connections:

    • Connect the motor power supply (VS) to the motor voltage source (e.g., 12V battery).
    • Connect the logic voltage supply (VSS) to a 5V source (e.g., Arduino 5V pin).
    • Connect all ground pins (GND) to the common ground of the circuit.
  2. Motor Connections:

    • Connect the motor terminals to the output pins (Output 1 and Output 2 for motor A, Output 3 and Output 4 for motor B).
  3. Control Inputs:

    • Use the Input pins (Input 1 and Input 2 for motor A, Input 3 and Input 4 for motor B) to control the direction of the motors.
    • Use the Enable pins (Enable A and Enable B) to enable or disable the motors.
  4. Optional Current Sensing:

    • If current sensing is required, connect the Sense A and Sense B pins to a resistor and measure the voltage drop.

Important Considerations:

  • Use a heat sink with the L298n IC to prevent overheating during operation.
  • Ensure the motor power supply voltage does not exceed 46V.
  • Do not exceed the maximum continuous current rating of 2A per channel.
  • Use external diodes for additional protection if driving inductive loads.

Example: Controlling a DC Motor with Arduino UNO

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

// Define L298n control pins
const int enableA = 9;  // Enable pin for motor A
const int input1 = 8;   // Input 1 for motor A
const int input2 = 7;   // Input 2 for motor A

void setup() {
  // Set pin modes
  pinMode(enableA, OUTPUT);
  pinMode(input1, OUTPUT);
  pinMode(input2, OUTPUT);

  // Initialize motor in stopped state
  digitalWrite(enableA, LOW);  // Disable motor A
  digitalWrite(input1, LOW);  // Set direction to LOW
  digitalWrite(input2, LOW);  // Set direction to LOW
}

void loop() {
  // Example: Rotate motor A forward
  digitalWrite(enableA, HIGH);  // Enable motor A
  digitalWrite(input1, HIGH);   // Set direction forward
  digitalWrite(input2, LOW);    // Set direction forward
  delay(2000);                  // Run motor for 2 seconds

  // Example: Rotate motor A backward
  digitalWrite(input1, LOW);    // Set direction backward
  digitalWrite(input2, HIGH);   // Set direction backward
  delay(2000);                  // Run motor for 2 seconds

  // Stop motor A
  digitalWrite(enableA, LOW);   // Disable motor A
  delay(2000);                  // Wait for 2 seconds
}

Notes:

  • Ensure the Arduino's 5V pin is connected to the L298n's VSS pin.
  • The motor power supply should be connected to the VS pin of the L298n.

Troubleshooting and FAQs

Common Issues and Solutions:

  1. Motor Not Running:

    • Check if the Enable pin is set to HIGH.
    • Verify the motor power supply is connected and providing sufficient voltage.
    • Ensure the Input pins are receiving the correct logic signals.
  2. Overheating:

    • Attach a heat sink to the L298n IC.
    • Reduce the motor load or use a motor with lower current requirements.
  3. Erratic Motor Behavior:

    • Check for loose connections in the circuit.
    • Ensure the ground connections are properly shared between the L298n, Arduino, and power supply.
  4. Low Motor Speed:

    • Verify the motor power supply voltage is adequate for the motor.
    • Check if the PWM signal (if used) is configured correctly.

FAQs:

Q: Can the L298n drive stepper motors?
A: Yes, the L298n can drive stepper motors by controlling the sequence of the Input pins.

Q: What is the maximum voltage the L298n can handle?
A: The L298n can handle up to 46V on the motor power supply (VS) pin.

Q: Do I need external diodes with the L298n?
A: The L298n has built-in diodes for protection, but external diodes can be added for additional safety when driving inductive loads.

Q: Can I use the L298n with a 3.3V microcontroller?
A: The L298n requires a logic voltage of 5V, so a level shifter may be needed for compatibility with 3.3V microcontrollers.