L293D Motor Driver
L293D is a 16 pin motor driver IC consist of quadruple half H drivers. It can simultaneously control the direction and speed of two DC motors. L293d is a suitable device to use for stepper motors, gear motors etc.

The IC has an operating voltage range from 4.5 V to 36 V. The L293 and L293D models can drive current up to 1A and 600mA respectively.
L293d pin diagram

Features
- Can be used to run Two DC motors with the same IC.
- Speed and Direction control is possible
- Motor voltage Vcc2 (Vs): 4.5V to 36V
- Maximum Peak motor current: 1.2A
- Maximum Continuous Motor Current: 600mA
- Supply Voltage to Vcc1(vss): 4.5V to 7V
- Transition time: 300ns (at 5Vand 24V)
- Automatic Thermal shutdown is available
- Available in 16-pin DIP, TSSOP, SOIC packages
IC L293D pin functions
Pin 1: Enable 1,2 – This is an active high input. When the pin is high it enables the driver channels 1 and 2.
Input High state – Enabled.
Input Low state – Disabled.
Pin 2: Input 1 – Digital input to control the output 1. The state of all outputs OUT1, OUT2, OUT3, OUT4 will be same as the input state applied at the corresponding inputs.
Output = Input.
High input – High output.
Low input – Low output.
Pin 3: Output 1 – Connected to one of the terminals of the motor 1; motor 1 – connected across the output 1 and 2.
Pin 4: GND – Heatsink and Ground Connection. The GND connection itself used as the heat sink to disperse the heat.
Pin 5: GND – Heatsink and Ground Connection.
Pin 6: Output 2 – Connected to the remaining terminal of the motor 1. Motor terminals should be connected with respect to the inputs assigned.
Pin 7: Input 2 – Digital input to control the output 2.
Pin 8: Vcc2 – Supply to the motors, 4.5V to 36V. The supply must be connected to a source capable enough to drive the current requirement of the load.
Pin 9: Enable3,4 – It is also an active high input. It is to enable and disable the driver channels 3 and 4.
Pin 10: Input 3 – Digital input to control the output 3.
Pin 11: Output 3 – Connected to one of the terminals of the motor 2; motor 2 – connected across the output 3 and 4.
Pin 12: GND – Heatsink and Ground Connection.
Pin 13: GND – Heatsink and Ground Connection. The Ground terminals should be soldered to a metallic area in the PCB which is enough to transfer the heat generated.
Pin 14: Output 4 – Connected to the remaining terminal of the motor 1.
Pin 15: Input 4 – Input to control the output 4. All the inputs are permitted only up to a maximum of 7V.
Pin 16: Vcc1 – 5V supply for the functioning of the IC.
How to use a L293D Motor Driver IC
Using this L293D motor driver IC is very simple. The IC works on the principle of Half H-Bridge, let us not go too deep into what H-Bridge means, but for now just know that H bridge is a set up which is used to run motors both in clock wise and anti clockwise direction. As said earlier this IC is capable of running two motors at the any direction at the same time, the circuit to achieve the same is shown below.

All the Ground pins should be grounded. There are two power pins for this IC, one is the Vss(Vcc1) which provides the voltage for the IC to work, this must be connected to +5V. The other is Vs(Vcc2) which provides voltage for the motors to run, based on the specification of your motor you can connect this pin to anywhere between 4.5V to 36V, here I have connected to +12V.
The Enable pins (Enable 1,2 and Enable 3,4) are used to Enable Input pins for Motor 1 and Motor 2 respectively. Since in most cases we will be using both the motors both the pins are held high by default by connecting to +5V supply. The input pins Input 1,2 are used to control the motor 1 and Input pins 3,4 are used to control the Motor 2. The input pins are connected to the any Digital circuit or microcontroller to control the speed and direction of the motor. You can toggle the input pins based on the following table to control your motor.
Input 1 = HIGH(5v) |
Output 1 = HIGH |
Motor 1 rotates in Clock wise Direction |
Input 2 = LOW(0v) |
Output 2 = LOW |
|
Input 3 = HIGH(5v) |
Output 1 = HIGH |
Motor 2 rotates in Clock wise Direction |
Input 4 = LOW(0v) |
Output 2 = LOW |
Input 1 = LOW(0v) |
Output 1 = LOW |
Motor 1 rotates in Anti-Clock wise Direction |
Input 2 = HIGH(5v) |
Output 2 = HIGH |
|
Input 3 = LOW(0v) |
Output 1 = LOW |
Motor 2 rotates in Anti -Clock wise Direction |
Input 4 = HIGH(5v) |
Output 2 = HIGH |
Input 1 = HIGH(5v) |
Output 1 = HIGH |
Motor 1 stays still |
Input 2 = HIGH(5v) |
Output 2 = HIGH |
|
Input 3 = HIGH(5v) |
Output 1 = LOW |
Motor 2 stays still |
Input 4 = HIGH(5v) |
Output 2 = HIGH |
L293D motor driver Arduino interfacing
Driver IC L293D is available as module and Arduino shield. L293D Motor Driver modules usually come with an inbuilt Lm317 voltage regulator circuit or similar voltage regulating circuit, along with connectors.
There is no difference in program or connection vice while using the L293D IC directly or through a module.
Connect the 4 inputs and 2 enable pins to the respective digital output pins of the arduino as declared in the code.

L293d motor driver module connection with Arduino Uno

The below arduino code just show you how the motor direction changes with the change in respective input states. As given in the code, for five seconds the motor runs in the clockwise direction, then in the counterclockwise direction and then stops; this repeats again.
L293d motor driver Arduino code
const int IN1 = 6, IN2 = 5, IN3 = 11, IN4 = 10;
const int enable12 = 3 , enable34 = 9;
void setup()
{
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(enable12, OUTPUT);
pinMode(enable34, OUTPUT);
digitalWrite(enable12, HIGH);
digitalWrite(enable34, HIGH);
}
void loop()
{
clockwise();
delay(5000);
anticlockwise();
delay(5000);
brake();
delay(5000);
}
// Input state to rotate 2 motors CW
void clockwise()
{
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
// Input state to rotate 2 motors CCW
void anticlockwise()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
//Motor Brake
void brake()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
Applications:
- Used to drive high current Motors using Digital Circuits
- Can be used to drive Stepper motors
- High current LED’s can be driven
- RelayDriver module (Latching Relay is possible)
Reference:
https://www.instructables.com/id/How-to-Use-the-L293D-Motor-Driver-With-Arduino/
https://roboindia.com/tutorials/motor-driver-arduino/
https://create.arduino.cc/projecthub/electropeak/arduino-l293d-motor-driver-shield-tutorial-c1ac9b
https://mechatrofice.com/arduino/l293d-motor-driver