

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 a versatile and widely used 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 compact design and ease of use make it a popular choice for hobbyists and professionals alike.








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 |
| Control Logic Levels | High: 3.5V to 5V, Low: 0V |
| Power Dissipation | 25W (with proper heat sinking) |
| Number of Channels | 2 (dual H-bridge) |
| Dimensions | 43mm x 43mm x 27mm |
The L298N module has several pins and terminals for motor control and power input. Below is a detailed description:
| Pin/Terminal | Description |
|---|---|
| VCC | Motor power supply (5V to 35V) |
| GND | Ground connection |
| 5V | Logic power supply (optional, if not using onboard regulator) |
| OUT1 | Output for Motor 1 (connect to one motor terminal) |
| OUT2 | Output for Motor 1 (connect to the other motor terminal) |
| OUT3 | Output for Motor 2 (connect to one motor terminal) |
| OUT4 | Output for Motor 2 (connect to the other motor terminal) |
| Pin | Description |
|---|---|
| ENA | Enable pin for Motor 1 (PWM input for speed control) |
| IN1 | Input 1 for Motor 1 (controls direction) |
| IN2 | Input 2 for Motor 1 (controls direction) |
| ENB | Enable pin for Motor 2 (PWM input for speed control) |
| IN3 | Input 1 for Motor 2 (controls direction) |
| IN4 | Input 2 for Motor 2 (controls direction) |
Power Connections:
VCC terminal (5V to 35V).GND terminal.5V pin can be left unconnected or used as a 5V output.Motor Connections:
OUT1 and OUT2.OUT3 and OUT4.Control Connections:
ENA and ENB pins to PWM-capable pins on your microcontroller for speed control.IN1, IN2, IN3, and IN4 to digital pins on your microcontroller to control motor direction.Logic Power:
5V pin from an external source.Below is an example of how to control a single DC motor using the L298N and an Arduino UNO:
VCC to a 12V power supply and GND to the ground.OUT1 and OUT2 to the motor terminals.ENA to Arduino pin 9 (PWM pin).IN1 to Arduino pin 7 and IN2 to Arduino pin 8.GND to the L298N's GND.// Define control pins for the L298N motor driver
const int ENA = 9; // PWM pin for speed control
const int IN1 = 7; // Direction control pin 1
const int IN2 = 8; // Direction control pin 2
void setup() {
// Set control pins as outputs
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
}
void loop() {
// Rotate motor forward at 50% speed
analogWrite(ENA, 128); // Set speed (0-255)
digitalWrite(IN1, HIGH); // Set direction
digitalWrite(IN2, LOW);
delay(2000); // Run for 2 seconds
// Rotate motor backward at 75% speed
analogWrite(ENA, 192); // Set speed (0-255)
digitalWrite(IN1, LOW); // Set direction
digitalWrite(IN2, HIGH);
delay(2000); // Run for 2 seconds
// Stop the motor
analogWrite(ENA, 0); // Set speed to 0
delay(2000); // Wait for 2 seconds
}
Motor Not Running:
ENA pin is receiving a PWM signal and is not set to 0.Overheating:
Erratic Motor Behavior:
No Output Voltage on Motor Terminals:
IN1, IN2, etc.) are correctly configured in the code.ENA or ENB pin is enabled with a PWM signal.Q: Can the L298N drive stepper motors?
A: Yes, the L298N can drive bipolar stepper motors by using both H-bridge channels. However, additional control logic is required.
Q: Can I use the onboard 5V regulator to power my Arduino?
A: Yes, if the motor power supply is above 7V, the onboard 5V regulator can provide power to the Arduino via the 5V pin. However, ensure the current draw does not exceed the regulator's capacity.
Q: What is the maximum motor voltage the L298N can handle?
A: The L298N can handle motor voltages up to 35V. Ensure the motor power supply does not exceed this limit.