

The L298n is a dual H-bridge motor driver IC designed to control the direction and speed of DC motors and stepper motors. It is capable of driving two motors simultaneously, making it a versatile choice for robotics, automation, and other motor control applications. The L298n can handle high currents and voltages, making it suitable for a wide range of projects, from small robots to industrial automation systems.








Below are the key technical details of the L298n motor driver IC:
| Parameter | Value |
|---|---|
| Operating Voltage | 5V to 46V |
| Maximum Output Current | 2A per channel (continuous) |
| Peak Output Current | 3A per channel (short duration) |
| 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) |
| Motor Types Supported | DC motors, stepper motors |
| Built-in Protection | Thermal shutdown, overcurrent |
The L298n IC has 15 pins, each serving a specific purpose. Below is the pinout description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | Enable A | Enables or disables motor A (High = Enabled, Low = Disabled) |
| 2 | Input 1 | Logic input to control motor A direction (connect to microcontroller) |
| 3 | Output 1 | Output to motor A terminal 1 |
| 4 | Ground | Ground connection |
| 5 | Ground | Ground connection |
| 6 | Output 2 | Output to motor A terminal 2 |
| 7 | VSS | Logic voltage supply (typically 5V) |
| 8 | VS | Motor power supply (up to 46V) |
| 9 | Output 3 | Output to motor B terminal 1 |
| 10 | Ground | Ground connection |
| 11 | Ground | Ground connection |
| 12 | Output 4 | Output to motor B terminal 2 |
| 13 | Input 2 | Logic input to control motor B direction (connect to microcontroller) |
| 14 | Enable B | Enables or disables motor B (High = Enabled, Low = Disabled) |
| 15 | Sense A/B | Current sensing pins (optional, connect to ground if not used) |
Power Connections:
Motor Connections:
Control Inputs:
Optional Current Sensing:
Below is an example of how to control a DC motor using the L298n and an Arduino UNO:
// Define L298n control pins
const int enableA = 9; // Enable pin for motor A
const int input1 = 8; // Input 1 for motor A
const int input2 = 7; // Input 2 for motor A
void setup() {
// Set pin modes
pinMode(enableA, OUTPUT);
pinMode(input1, OUTPUT);
pinMode(input2, OUTPUT);
// Initialize motor in stopped state
digitalWrite(enableA, LOW); // Disable motor A
digitalWrite(input1, LOW); // Set direction to LOW
digitalWrite(input2, LOW); // Set direction to LOW
}
void loop() {
// Example: Rotate motor A forward
digitalWrite(enableA, HIGH); // Enable motor A
digitalWrite(input1, HIGH); // Set direction forward
digitalWrite(input2, LOW); // Set direction forward
delay(2000); // Run motor for 2 seconds
// Example: Rotate motor A backward
digitalWrite(input1, LOW); // Set direction backward
digitalWrite(input2, HIGH); // Set direction backward
delay(2000); // Run motor for 2 seconds
// Stop motor A
digitalWrite(enableA, LOW); // Disable motor A
delay(2000); // Wait for 2 seconds
}
Motor Not Running:
Overheating:
Erratic Motor Behavior:
Low Motor Speed:
Q: Can the L298n drive stepper motors?
A: Yes, the L298n can drive stepper motors by controlling the sequence of the Input pins.
Q: What is the maximum voltage the L298n can handle?
A: The L298n can handle up to 46V on the motor power supply (VS) pin.
Q: Do I need external diodes with the L298n?
A: The L298n has built-in diodes for protection, but external diodes can be added for additional safety when driving inductive loads.
Q: Can I use the L298n with a 3.3V microcontroller?
A: The L298n requires a logic voltage of 5V, so a level shifter may be needed for compatibility with 3.3V microcontrollers.