The L298N Motor Driver H-Bridge, manufactured by STMicroelectronics (Part ID: L298N), is a robust and versatile dual H-Bridge motor driver. It is designed to control the direction and speed of DC motors and stepper motors, making it an essential component in robotics, automation, and motor control applications. The L298N can drive two motors simultaneously, supporting bidirectional control and pulse-width modulation (PWM) for speed regulation.
The L298N is a high-power motor driver capable of handling significant current and voltage levels. Below are its key specifications and pin configuration details.
Parameter | Value |
---|---|
Operating Voltage | 5V to 46V |
Output Current (per channel) | 2A (continuous), 3A (peak) |
Logic Voltage | 5V |
Power Dissipation | 25W (with proper heat sinking) |
Control Logic Levels | High: 2.3V to 5V, Low: 0V to 1.5V |
Number of Channels | 2 (dual H-Bridge) |
PWM Frequency | Up to 20 kHz |
Operating Temperature Range | -25°C to +130°C |
The L298N module typically includes additional components like a voltage regulator and terminal blocks for easy wiring. Below is the pinout for the L298N IC and its corresponding module.
Pin | Name | Description |
---|---|---|
1 | Enable A | Enables/Disables Motor A (High = Enabled, Low = Disabled) |
2 | Input 1 | Logic input to control Motor A direction (works with Input 2) |
3 | Input 2 | Logic input to control Motor A direction (works with Input 1) |
4 | Output 1 | Motor A output terminal 1 |
5 | Output 2 | Motor A output terminal 2 |
6 | VSS (Logic) | Logic voltage supply (5V) |
7 | Ground | Common ground |
8 | VS (Motor) | Motor power supply (up to 46V) |
9 | Output 3 | Motor B output terminal 1 |
10 | Output 4 | Motor B output terminal 2 |
11 | Input 3 | Logic input to control Motor B direction (works with Input 4) |
12 | Input 4 | Logic input to control Motor B direction (works with Input 3) |
13 | Enable B | Enables/Disables Motor B (High = Enabled, Low = Disabled) |
14 | Ground | Common ground |
Pin | Description |
---|---|
ENA | Enable pin for Motor A (connect to PWM for speed control) |
IN1, IN2 | Control pins for Motor A direction |
OUT1, OUT2 | Output terminals for Motor A |
ENB | Enable pin for Motor B (connect to PWM for speed control) |
IN3, IN4 | Control pins for Motor B direction |
OUT3, OUT4 | Output terminals for Motor B |
12V (VS) | Motor power supply (up to 46V) |
5V | Logic voltage supply (can be used to power external logic circuits) |
GND | Common ground |
Power Supply:
12V
(VS) pin.5V
pin.Motor Connections:
OUT1
and OUT2
for Motor A, and OUT3
and OUT4
for Motor B.Control Pins:
IN1
and IN2
to control the direction of Motor A.IN3
and IN4
to control the direction of Motor B.ENA
and ENB
for enabling/disabling motors or for speed control via PWM.Direction Control Logic:
IN1
HIGH and IN2
LOW to rotate Motor A in one direction.IN1
LOW and IN2
HIGH to rotate Motor A in the opposite direction.IN3
and IN4
for Motor B.Speed Control:
ENA
(for Motor A) or ENB
(for Motor B) to control speed.Below is an example of how to control two DC motors using the L298N and an Arduino UNO.
// Define motor control pins
#define ENA 9 // PWM pin for Motor A speed control
#define IN1 8 // Motor A direction control pin 1
#define IN2 7 // Motor A direction control pin 2
#define ENB 10 // PWM pin for Motor B speed control
#define IN3 6 // Motor B direction control pin 1
#define IN4 5 // Motor B direction control pin 2
void setup() {
// Set motor control pins as outputs
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop() {
// Motor A: Forward at 50% speed
digitalWrite(IN1, HIGH); // Set IN1 HIGH
digitalWrite(IN2, LOW); // Set IN2 LOW
analogWrite(ENA, 128); // Set ENA to 50% duty cycle (128/255)
// Motor B: Reverse at 75% speed
digitalWrite(IN3, LOW); // Set IN3 LOW
digitalWrite(IN4, HIGH); // Set IN4 HIGH
analogWrite(ENB, 192); // Set ENB to 75% duty cycle (192/255)
delay(2000); // Run motors for 2 seconds
// Stop both motors
analogWrite(ENA, 0); // Set ENA to 0% duty cycle (stop Motor A)
analogWrite(ENB, 0); // Set ENB to 0% duty cycle (stop Motor B)
delay(2000); // Wait for 2 seconds
}
Motors Not Running:
ENA
and ENB
pins are set HIGH or receiving a PWM signal.Overheating:
Erratic Motor Behavior:
No Speed Control:
ENA
or ENB
pins.analogWrite()
function.Q1: Can the L298N drive stepper motors?
Yes, the L298N can drive bipolar stepper motors by controlling the two H-Bridge channels.
Q2: Can I power the Arduino from the L298N module?
Yes, if the module has a 5V regulator, you can use the 5V
pin to power the Arduino. Ensure the motor power supply is at least 7V.
Q3: What is the maximum PWM frequency supported?
The L298N supports PWM frequencies up to 20 kHz.
This documentation provides a comprehensive guide to using the L298N Motor Driver H-Bridge. For further details, refer to the official