

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 an essential component in robotics, automation, and motor control projects. The L298n can handle high currents and voltages, making it suitable for a wide range of applications, from small hobbyist robots to industrial automation systems.








The L298n is a robust and versatile motor driver IC. Below are its key technical details:
The L298n IC has 15 pins, but it is often used in a module form for ease of use. Below is the pin configuration for the IC:
| 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 (works with Input 2) |
| 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 | Enable B | Enables or disables motor B (High = Enabled, Low = Disabled) |
| 10 | Input 3 | Logic input to control motor B direction (works with Input 4) |
| 11 | Output 3 | Output to motor B terminal 1 |
| 12 | Ground | Ground connection |
| 13 | Ground | Ground connection |
| 14 | Output 4 | Output to motor B terminal 2 |
| 15 | Input 4 | Logic input to control motor B direction (works with Input 3) |
For the L298n module, additional pins such as a 5V regulator output and jumpers for enabling motors are typically included.
The L298n is straightforward to use in motor control circuits. Below are the steps and considerations for using it effectively:
Power Supply:
Motor Connections:
Control Pins:
Optional Features:
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 control pins as outputs
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 neutral
digitalWrite(input2, LOW); // Set direction to neutral
}
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:
Q: Can the L298n drive stepper motors?
A: Yes, the L298n can drive stepper motors by controlling the sequence of inputs to the H-bridges. You will need to implement the correct stepping sequence in your code.
Q: Can I use the L298n with a 3.3V microcontroller?
A: The L298n requires 5V logic levels for proper operation. You may need a level shifter to interface it with a 3.3V microcontroller.
Q: What is the purpose of the onboard 5V regulator on the L298n module?
A: The onboard 5V regulator can provide power to your microcontroller if the motor power supply voltage is greater than 7V. Ensure the jumper is set correctly to enable this feature.
By following this documentation, you can effectively use the L298n motor driver in your projects.