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!
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.
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.
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.
This circuit is designed to control a two-wheeled robot using an L298N motor driver, powered by two 18650 Li-ion batteries. It includes two KY-033 line tracking sensors for navigation and a 74HC04 inverter to process sensor signals and control the motor driver inputs.
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
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.
Connect Motors: Attach the motor wires to the output pins (OUT1, OUT2 for Motor A and OUT3, OUT4 for Motor B).
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.
Logic Voltage: If your microcontroller operates at 5V logic, you can use the 5V pin on the module to power it.
Important Considerations
Heat Dissipation: The L298N can dissipate up to 25W of power. Use a heat sink or cooling fan to prevent overheating during high-current operation.
Current Limitations: Ensure that the motors do not draw more than 2A per channel continuously to avoid damaging the module.
Power Supply: Use a power supply that matches the voltage and current requirements of your motors.
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
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.
Overheating:
Use a heat sink or cooling fan to dissipate heat.
Ensure the motors do not exceed the 2A continuous current limit.
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.