The L298N is a dual H-bridge motor driver that enables control of the direction and speed of DC motors. It is capable of driving two motors simultaneously, making it an essential component in robotics, automation, and other motor control applications. The module is designed to handle motors with operating voltages between 5V and 35V and can deliver up to 2A of current per channel. Its versatility and ease of use make it a popular choice for hobbyists and professionals alike.
Explore Projects Built with L298N DC LEFT 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!
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.
This circuit is designed to control four DC gearmotors using an L298N motor driver module, which is interfaced with an ESP32 microcontroller. The ESP32 uses its GPIO pins to send control signals to the L298N driver, enabling the independent operation of the motors, such as direction and speed control. Power is supplied by a 12V battery connected to the motor driver, with the ESP32 receiving its power through a voltage regulator on the L298N module.
This circuit controls four DC motors using an L298N motor driver, powered by a 18650 Li-Ion battery. The direction and operation of the motors are controlled by four pushbuttons, each connected to the motor driver's input pins through resistors.
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.
Robotics: Controlling wheels or tracks in mobile robots
Automation: Operating conveyor belts or actuators
DIY Projects: Building remote-controlled cars or robotic arms
Educational Projects: Teaching motor control concepts in electronics
Technical Specifications
The L298N motor driver module has the following key specifications:
Parameter
Value
Operating Voltage
5V to 35V
Output Current
Up to 2A per channel
Logic Voltage
5V
Power Dissipation
25W (with proper heat sinking)
Control Logic Levels
High (1) and Low (0)
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
Logic voltage output (used when VCC > 7V)
OUT1
Output for Motor A (connect to one motor terminal)
OUT2
Output for Motor A (connect to the other terminal)
OUT3
Output for Motor B (connect to one motor terminal)
OUT4
Output for Motor B (connect to the other 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
Power the Module: Connect the VCC pin to a power source (5V to 35V) suitable for your motor. Connect the GND pin to the ground of your power supply.
Connect the Motors: Attach the motor terminals to OUT1 and OUT2 for Motor A, and OUT3 and OUT4 for Motor B.
Control Pins: Use IN1 and IN2 to control the direction of Motor A, and IN3 and IN4 for Motor B. Apply a PWM signal to ENA and ENB to control motor speed.
Logic Voltage: If your motor power supply (VCC) is greater than 7V, the module provides a 5V output that can be used to power the logic circuit.
Important Considerations and Best Practices
Heat Dissipation: The L298N can get hot during operation. Use a heat sink or active cooling for high-current applications.
Power Supply: Ensure the power supply voltage matches the motor's requirements and does not exceed the module's limits.
Current Limits: Do not exceed the 2A per channel current rating to avoid damaging the module.
Decoupling Capacitors: Add capacitors across the motor terminals to reduce electrical noise.
Example: Connecting to an Arduino UNO
Below is an example of how to control a single motor using the L298N and an Arduino UNO:
Circuit Connections
Connect the motor terminals to OUT1 and OUT2.
Connect ENA to Arduino pin 9 (PWM pin).
Connect IN1 to Arduino pin 8 and IN2 to Arduino pin 7.
Connect the GND of the L298N to the Arduino GND.
Arduino Code
// 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 and Solutions
Motor Not Spinning
Cause: Incorrect wiring or insufficient power supply.
Solution: Double-check all connections and ensure the power supply voltage matches the motor's requirements.
Motor Spins in the Wrong Direction
Cause: IN1 and IN2 (or IN3 and IN4) are incorrectly set.
Solution: Swap the HIGH and LOW signals on the control pins to reverse the direction.
Module Overheating
Cause: Excessive current draw or insufficient cooling.
Solution: Add a heat sink or fan, and ensure the motor's current is within the module's limits.
No Output Voltage on Motor Terminals
Cause: ENA or ENB pins are not receiving a signal.
Solution: Verify that the enable pins are connected to a PWM signal or set HIGH.
FAQs
Can I control stepper motors with the L298N?
Yes, the L298N can control stepper motors by using both H-bridge channels. However, additional logic may be required.
What happens if I exceed the current rating?
Exceeding the 2A per channel limit can damage the module. Use motors within the specified current range.
Can I use the 5V output to power my Arduino?
Yes, but only if the motor power supply (VCC) is greater than 7V. Ensure the current draw of the Arduino and other components does not exceed the module's capacity.