Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use L298N: Examples, Pinouts, and Specs

Image of L298NDesign with L298N in Cirkit Designer

Introduction

The L298N is a dual H-bridge motor driver 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 a versatile and reliable choice for 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!
Image of ESP32-CAM Controlled Surveillance Robot with Wi-Fi and Servo Pan/Tilt Mechanism: 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.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

Key Technical Details

Parameter Value
Manufacturer Custon
Part ID L298N
Operating Voltage 5V to 46V
Output Current (per channel) Up to 2A
Peak Output Current 3A (short duration)
Logic Voltage 5V
Power Dissipation 25W (with proper heat sink)
Control Logic Levels High: 2.3V to 5V, Low: 0V
Operating Temperature -25°C to +130°C
Motor Types Supported DC motors, stepper motors

Pin Configuration and Descriptions

The L298N module typically includes the following pins for interfacing:

Power and Motor Connections

Pin Name Description
VCC Power supply for motors (5V to 46V).
GND Ground connection.
5V Logic voltage output (used to power external logic circuits if needed).
OUT1 Output 1 for Motor A.
OUT2 Output 2 for Motor A.
OUT3 Output 3 for Motor B.
OUT4 Output 4 for Motor B.

Control Pins

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

Usage Instructions

How to Use the L298N in a Circuit

  1. Power the Module: Connect the VCC pin to the motor power supply (5V to 46V) and the GND pin to the ground of your circuit.
  2. Connect Motors: Attach the motor wires to the output pins (OUT1, OUT2 for Motor A and OUT3, OUT4 for Motor B).
  3. Control Logic: Use the IN1, IN2, IN3, and IN4 pins to control the direction of the motors. Apply a PWM signal to the ENA and ENB pins to control motor speed.
  4. Logic Voltage: If your microcontroller operates at 5V logic, you can use the 5V pin on the module to power it.

Important Considerations

Example: Connecting to an Arduino UNO

Below is an example of how to control a DC motor using the L298N and 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

void setup() {
  // Set motor control pins as outputs
  pinMode(ENA, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
}

void loop() {
  // Rotate motor forward
  digitalWrite(IN1, HIGH);  // Set IN1 high
  digitalWrite(IN2, LOW);   // Set IN2 low
  analogWrite(ENA, 150);    // Set speed (0-255)

  delay(2000);              // Run for 2 seconds

  // Rotate motor backward
  digitalWrite(IN1, LOW);   // Set IN1 low
  digitalWrite(IN2, HIGH);  // Set IN2 high
  analogWrite(ENA, 150);    // Set speed (0-255)

  delay(2000);              // Run for 2 seconds

  // Stop motor
  digitalWrite(IN1, LOW);   // Set IN1 low
  digitalWrite(IN2, LOW);   // Set IN2 low
  analogWrite(ENA, 0);      // Set speed to 0

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

Troubleshooting and FAQs

Common Issues

  1. Motors Not Running:

    • Ensure the power supply voltage matches the motor's requirements.
    • Verify that the ENA and ENB pins are receiving a valid PWM signal.
    • Check the wiring of the control and motor output pins.
  2. Overheating:

    • Use a heat sink or cooling fan to dissipate heat.
    • Ensure the motors do not exceed the 2A continuous current limit.
  3. Erratic Motor Behavior:

    • Check for loose connections or faulty wiring.
    • Ensure the control logic signals are stable and within the specified voltage range.

FAQs

Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive stepper motors by controlling the sequence of the IN1, IN2, IN3, and IN4 pins.

Q: Can I use the L298N with a 3.3V microcontroller?
A: The L298N requires a minimum logic high voltage of 2.3V, so it is compatible with 3.3V microcontrollers. However, ensure proper interfacing to avoid voltage mismatches.

Q: What is the maximum motor voltage supported?
A: The L298N supports motor voltages up to 46V. Ensure your power supply does not exceed this limit.