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 manufactured by Custon (Part ID: L298N). It is designed to control the direction and speed of DC motors and stepper motors. With the ability to drive two motors simultaneously and handle up to 2A per channel, the L298N is widely used in robotics, automation, and other motor control applications.

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!

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!

Common Applications

  • Robotics: Driving wheels or tracks of robots
  • Automation: Controlling conveyor belts or actuators
  • DIY Projects: Building motorized vehicles or robotic arms
  • Stepper Motor Control: Driving stepper motors for precise positioning

Technical Specifications

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

Parameter Value
Supply Voltage (Vcc) 4.5V to 46V
Logic Voltage (Vss) 5V to 7V
Maximum Output Current 2A per channel (continuous)
Peak Output Current 3A per channel (short duration)
Power Dissipation 25W (with proper heat sinking)
Operating Temperature -25°C to +130°C
Motor Channels 2 (independent control)
Control Logic TTL-compatible

Pin Configuration and Descriptions

The L298N IC has 15 pins, each serving a specific function. Below is the pinout and description:

Pin Number Pin Name Description
1 Enable A Enables or disables motor channel A (active HIGH)
2 Input 1 Logic input to control motor A direction (HIGH/LOW)
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 (5V to 7V)
8 Vcc Motor power supply (4.5V 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 (HIGH/LOW)
14 Enable B Enables or disables motor channel B (active HIGH)
15 Sense A/B Current sensing pins for motor A and B (optional, connect to ground if unused)

Usage Instructions

The L298N is straightforward to use in motor control circuits. Below are the steps and best practices for using the component:

Connecting the L298N to a DC Motor

  1. Power Supply:

    • Connect the motor power supply (4.5V to 46V) to the Vcc pin.
    • Connect the logic power supply (5V) to the Vss pin.
    • Ensure all ground pins are connected to a common ground.
  2. Motor Connections:

    • Connect the motor terminals to the Output 1 and Output 2 pins for motor A.
    • For motor B, use Output 3 and Output 4.
  3. Control Logic:

    • Use the Input 1 and Input 2 pins to control the direction of motor A.
    • Similarly, use Input 3 and Input 4 for motor B.
    • Set the Enable A and Enable B pins HIGH to activate the respective motor channels.
  4. Optional Features:

    • Use the Sense A/B pins for current sensing if required. Otherwise, connect them to ground.

Example: Controlling a DC Motor with Arduino UNO

Below is an example Arduino sketch to control a single DC motor using the L298N:

// 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
  digitalWrite(input1, LOW);   // Set direction to LOW
  digitalWrite(input2, LOW);   // Set direction to LOW
}

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

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

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

Best Practices

  • Use a heat sink with the L298N to prevent overheating during high-current operation.
  • Ensure the motor power supply voltage matches the motor's rated voltage.
  • Use decoupling capacitors near the power supply pins to reduce noise.
  • Avoid exceeding the maximum current rating (2A per channel) to prevent damage.

Troubleshooting and FAQs

Common Issues

  1. Motor Not Running:

    • Check if the Enable pin is HIGH.
    • Verify the power supply connections to Vcc and Vss.
    • Ensure the motor connections are correct.
  2. Overheating:

    • Use a heat sink or active cooling to dissipate heat.
    • Reduce the motor load or current draw.
  3. Erratic Motor Behavior:

    • Check for loose connections or faulty wiring.
    • Add decoupling capacitors to the power supply.
  4. Low Motor Speed:

    • Verify the motor power supply voltage.
    • 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 inputs to the motor windings.

Q: What is the purpose of the Sense A/B pins?
A: The Sense A/B pins are used for current sensing. They can be connected to a resistor to measure the current flowing through the motors.

Q: Can I use the L298N with a 3.3V microcontroller?
A: The L298N requires a logic voltage of 5V to 7V. You may need a level shifter to interface it with a 3.3V microcontroller.

Q: How do I protect the L298N from voltage spikes?
A: Use flyback diodes across the motor terminals to protect the IC from voltage spikes caused by inductive loads.