Description
L293D Motor Driver Module
The L293D Motor Driver Module is a dual H-bridge motor driver IC that allows you to control the direction and speed of two DC motors or one stepper motor using an Arduino or other microcontroller.
Technical Specifications:
-
Operating Voltage (VCC): 4.5V to 36V (motor supply voltage)
-
Logic Voltage (VSS): 4.5V to 7V (5V typically used from Arduino)
-
IC Used: L293D Dual H-Bridge Motor Driver IC
-
Motor Channels: 2 (can control 2 DC motors or 1 stepper motor)
-
Control Pins: IN1, IN2 (Motor A), IN3, IN4 (Motor B), ENA/ENB for enabling or PWM speed control
-
Output Pins: OUT1–OUT4 (connect to motors)
-
Speed Control (PWM): Yes, via ENA and ENB pins (connect to Arduino PWM pins)
-
Built-in Protection: Internal diodes for back EMF, thermal shutdown protection
- Current per Channel: 600 mA continuous, 1.2 A peak per motor channel
Pinouts:
Connection with Arduino:
L293D Module Pin |
Arduino UNO |
Purpose |
VCC |
External power (e.g., 9V or 12V battery) |
Motor supply voltage |
GND |
GND |
Common ground with Arduino |
5V (or VSS) |
5V |
Logic voltage for L293D |
IN1(A1) |
D8 |
control pin 1 |
IN2(A2) |
D9 |
control pin 2 |
ENA |
D10 (PWM) |
Motor A speed control (PWM) |
IN3(B1) |
D11 |
control pin 1 |
IN4(B2) |
D12 |
control pin 2 |
ENB |
D5 (PWM) |
Motor B speed control (PWM) |
OUT1 & OUT2 |
Motor A terminals |
Connect DC Motor A |
OUT3 & OUT4 |
Motor B terminals |
Connect DC Motor B |
Sample code:
// Motor A pins
const int ENA = 10; // PWM for Motor A speed
const int IN1 = 8;
const int IN2 = 9;
// Motor B pins
const int ENB = 5; // PWM for Motor B speed
const int IN3 = 11;
const int IN4 = 12;
void setup() {
// Set all the motor control pins to output
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop() {
// Run motors forward at full speed
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
analogWrite(ENA, 255); // Full speed
analogWrite(ENB, 255);
delay(2000);
// Reverse motors
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
delay(2000);
// Stop motors
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
delay(1000);
// Run motors forward at half speed
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
analogWrite(ENA, 128); // Half speed
analogWrite(ENB, 128);
delay(2000);
}