In many Arduino projects, DC motors are at the heart of motion control — from simple cars to robotic arms and even small CNC machines. But to drive a DC motor properly, you need more than just connecting it to the Arduino pins. That’s where the L293D H-Bridge IC comes in, making it simple to control both the direction and speed of one or two DC motors.

1. Why You Need an H-Bridge
Arduino pins output very little current, around 20–40mA, which is nowhere near enough to drive a motor. The L293D acts as a bridge between your low-power Arduino control signals and the higher current your motors need.
An H-Bridge lets you:
- Spin the motor forward or backward by reversing polarity.
- Control speed by using PWM (Pulse Width Modulation) signals.
- Power motors with a separate voltage source (e.g., 6V or 9V) while keeping the Arduino safe.
2. L293D Features at a Glance
- Dual H-Bridge (controls 2 DC motors)
- Up to 600mA per channel (with proper heat dissipation)
- Motor supply voltage: 4.5V — 36V
- Logic supply voltage: 5V
- Built-in diodes for back EMF protection
3. Basic Pin Connections
For one motor, here’s the typical wiring:
L293D Pin Function Arduino Connection EN1 Enable Motor 1 (Speed Control via PWM) PWM Pin (e.g., D9) IN1 Motor Direction 1 Digital Pin (e.g., D8) IN2 Motor Direction 2 Digital Pin (e.g., D7) OUT1 Motor Terminal 1 Motor Wire 1 OUT2 Motor Terminal 2 Motor Wire 2 VCC1 Logic Supply (5V) Arduino 5V VCC2 Motor Supply (e.g., 6V) External Battery + GND Ground Common Ground
To control two motors, you simply use the second set of EN2, IN3, IN4, OUT3, and OUT4.
4. Arduino Code Example
Here’s a simple sketch to spin one motor forward, backward, and stop:
int ENA = 9; // PWM pin for speed
int IN1 = 8; // Direction
int IN2 = 7; // Direction
void setup() {
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
}
void loop() {
// Forward
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
analogWrite(ENA, 200); // Speed (0-255)
delay(2000);
// Backward
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
analogWrite(ENA, 200);
delay(2000);
// Stop
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
analogWrite(ENA, 0);
delay(2000);
}
5. Applications
- Line-following robots
- RC cars
- Conveyor belts
- Automated curtains or windows
- Mini robotic arms
6. Tips for Successful operation
- Always use a common ground between the Arduino and motor power source.
- Add capacitors across the motor terminals to reduce noise.
- If you need to drive larger motors, consider using L298N or MOSFET-based motor drivers.
- Use an external power supply for motors to avoid resetting the Arduino due to voltage drops.
The L293D H-Bridge is one of the most beginner-friendly and versatile motor driver ICs for Arduino projects. By mastering how to control direction and speed with simple code, you open the door to a wide range of robotics and automation projects.
Experiment with different PWM values, dual-motor configurations, and even integrate sensors for smart motion control. Once you’ve got the basics, you can scale up to more complex systems like motor shields, advanced motor drivers, or even PID-controlled robotics.