

The L298N motor driver shield, manufactured by Arduino, is a versatile and robust motor driver designed to interface seamlessly with Arduino boards, such as the Arduino UNO. This shield enables users to control DC motors and stepper motors with ease, making it an essential component for robotics, automation, and motorized projects. It supports dual-channel motor control, allowing simultaneous operation of two motors with independent speed and direction control.








The L298N motor driver shield is based on the L298N dual H-bridge motor driver IC. Below are its key technical details:
| Specification | Details |
|---|---|
| Operating Voltage | 5V to 12V |
| Motor Drive Voltage (VM) | 6V to 35V |
| Maximum Motor Current | 2A per channel |
| Logic Voltage | 5V |
| Control Logic | TTL compatible |
| Number of Channels | 2 (dual H-bridge) |
| PWM Support | Yes |
| Dimensions | 68mm x 53mm x 15mm |
The L298N motor driver shield connects directly to the Arduino UNO, utilizing its pins for control and power. Below is the pin configuration:
| Pin | Description |
|---|---|
| IN1, IN2 | Control inputs for Motor A (set direction) |
| IN3, IN4 | Control inputs for Motor B (set direction) |
| ENA | PWM input for speed control of Motor A |
| ENB | PWM input for speed control of Motor B |
| 5V | Logic voltage input (connected to Arduino 5V pin) |
| GND | Ground connection |
| VM | Motor power supply (6V to 35V) |
| OUT1, OUT2 | Motor A output terminals |
| OUT3, OUT4 | Motor B output terminals |
Below is an example code snippet to control two DC motors using the L298N motor driver shield:
// Define motor control pins
const int IN1 = 8; // Motor A direction pin 1
const int IN2 = 9; // Motor A direction pin 2
const int ENA = 10; // Motor A speed control (PWM)
const int IN3 = 11; // Motor B direction pin 1
const int IN4 = 12; // Motor B direction pin 2
const int ENB = 13; // Motor B speed control (PWM)
void setup() {
// Set motor control pins as outputs
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENA, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
}
void loop() {
// Motor A: Forward at 50% speed
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
analogWrite(ENA, 128); // 50% duty cycle (0-255)
// Motor B: Backward at 75% speed
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
analogWrite(ENB, 192); // 75% duty cycle (0-255)
delay(2000); // Run motors for 2 seconds
// Stop both motors
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
analogWrite(ENA, 0);
analogWrite(ENB, 0);
delay(2000); // Wait for 2 seconds before repeating
}
Motors Not Running:
Motors Running in the Wrong Direction:
Shield Overheating:
PWM Not Controlling Speed:
Q: Can I use this shield with stepper motors?
A: Yes, the L298N shield supports stepper motors. You will need to configure the control pins accordingly.
Q: What happens if I exceed the current limit?
A: Exceeding the 2A per channel limit may cause the IC to overheat or fail. Use motors within the specified current range.
Q: Can I power the Arduino through the shield?
A: Yes, if the external power supply is connected to the VM terminal, the shield can provide 5V to the Arduino through its onboard voltage regulator.
Q: Is this shield compatible with other Arduino boards?
A: Yes, it is compatible with most Arduino boards that have the same pinout as the Arduino UNO.