L293D Motor Driver Working Operation

In this tutorial, we will see L293d Motor Driver Working Operation.

You can also read 8051 DC Motor interfacing, PIC16F877A DC motor interfacing, LPC2148 DC motor interfacing, Bluetooth interfacing with PIC16F877A, and Bluetooth interfacing with 8051.


Even the simplest robot requires a motor to rotate a wheel or performs particular action. Since motors require more current than the microcontroller pin can typically generate, you need some type of a switch that can accept a small current, amplify it and generate a larger current, which further drives a motor. This entire process is done by what is known as a Motor driver. With L293D Motor Driver IC, that task is made simple and has helped in a number of applications with relative ease.

L293D H-bridge driver is the most commonly used driver for Bidirectional motor driving applications. This L293D IC allows DC motor to drive on either direction. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motor with a single L293D IC. Because it has two H-Bridge Circuit inside. The L293D can drive small and quiet big motors as well. There are various ways of making an H-bridge motor control circuit such as using transistors, relays, and using L293D/L298. Before going into detail, first we will see what is H-Bridge circuit.

H-Bridge Circuit Working (L293D Motor Driver Working)

A motor driver is basically a current amplifier which takes a low-current signal from the microcontroller and gives out a proportionally higher current signal which can control and drive a motor. In most cases, a transistor can act as a switch and perform this task which drives the motor in a single direction.

Turning a motor ON and OFF requires only one switch to control a single motor in a single direction. What if you want your motor to reverse its direction? The simple answer is to reverse its polarity. This can be achieved by using four switches that are arranged in an intelligent manner such that the circuit not only drives the motor but also controls its direction. Out of many, one of the most common and clever designs is an H-bridge circuit where transistors are arranged in a shape that resembles the English alphabet “H”.

A H bridge is an electronic circuit that allows a voltage to be applied across a load in any direction. H-bridge circuits are frequently used in robotics and many other applications to allow DC motors to run forward  & backward. These motor control circuits are mostly used in different converters like DC-DC, DC-AC, AC-AC converters, and many other types of power electronic converters. In specific, a bipolar stepper motor is always driven by a motor controller having two H-bridges.

A H-bridge is fabricated with four switches like S1, S2, S3 and S4. When the S1 and S4 switches are closed, then a +ve voltage will be applied across the motor. By opening the switches S1 and S4 and closing the switches S2 and S3, this voltage is inverted, allowing invert operation of the motor.

Generally, the H-bridge motor driver circuit is used to reverse the direction of the motor and also to brake the motor. When the motor comes to a sudden stop, as the terminals of the motor’s are shorted. Or let the motor run free to a stop when the motor is detached from the circuit. The table below gives the different operations with the four switches corresponding to the above circuit.

L293D IC

L293D IC generally comes as a standard 16-pin DIP (dual-in line package). This motor driver IC can simultaneously control two small motors in either direction; forward and reverse with just 4 microcontroller pins (if you do not use enable pins).

PIN Diagram

Pin Description

PIN NoPIN NAMEDescription
1ENABLE 1When the enable pin is high, then the left part of the IC will work otherwise it won’t work. This pin is also called as a master control pin of left side.
2INPUT 1When the input pin is high, then the flow of current will be through output 1
3OUTPUT 1This output-1 pin must be connected to one of the terminals of the motor
4GNDConnected to Ground
5GNDConnected to Ground
6OUTPUT 2This pin must be connected to one of the terminals of the motor
7INPUT 2When this pin is HIGH then the flow of current will be though output 2
8VSThis is the voltage pin which is used to supply the voltage to the motor (12v)
9ENABLE 2When this pin is high, then the right part of the IC will work & when it is low the right part of the IC won’t work. This pin is also called as a master control pin for the right part of the IC.
10INPUT 3When this pin is high, then the flow of current will through output-3
11OUTPUT 3This pin must be connected to one of the terminals of the motor
12GNDConnected to Ground
13GNDConnected to Ground
14OUTPUT 4This pin must be connected to one of the terminals of the motor
15INPUT 4When this pin is high, then the flow of current will be through output-4
16VSSThis pin is the power source to the integrated circuit (5v)

Connection Diagram

The circuit shown to the right is the most basic implementation of L293D IC. There are 16 pins sticking out of this IC and we have to understand the functionality of each pin before implementing this in a circuit.

  1. Pin1 and Pin9 are “Enable” pins. They should be connected to +5V for the drivers to function. If they pulled low (GND), then the outputs will be turned off regardless of the input states, stopping the motors. If you have two spare pins in your microcontroller, connect these pins to the microcontroller, or just connect them to regulated positive 5 Volts.

  2. Pin4, Pin5, Pin12, and Pin13 are ground pins that should ideally be connected to the microcontroller’s ground.

  3. Pin2, Pin7, Pin10 and Pin15 are logic input pins. These are control pins which should be connected to microcontroller pins. Pin2 and Pin7 control the first motor (left); Pin10 and Pin15 control the second motor(right).

  4. Pin3, Pin6, Pin11, and Pin14 are output pins. Tie Pin3 and Pin6 to the first motor, Pin11 and Pin14 to second motor

  5. Pin16 powers the IC and it should be connected to regulated +5Volts

  6. Pin8 powers the two motors and should be connected to positive lead of a secondary battery. As per the datasheet, supply voltage can be as high as 36 Volts.

I have shown you where to connect the motors, battery and the microcontroller. But how do we control the direction of these motors? Let us take an example:

Suppose you need to control the left motor which is connected to Pin3 (O1) and Pin6 (O2). As mentioned above, we require three pins to control this motor – Pin1 (E1), Pin2 (I1) and Pin7 (I2). Here is the truth table representing the functionality of this motor driver.

110Rotates Anti-clockwise (Reverse)
101Rotates Clockwise (Forward)

X= Either high or low (don't care)

In the above truth table, you can observe that if ENABLE 1 is low then the motor stops, irrespective of the states on INPUT 1 and INPUT 2. Hence it is essential to hold ENABLE 1 high for the driver to function, or simply connect enable pins to positive 5 volts.

With ENABLE 1 high, if INPUT 1 is set high and INPUT 2 is pulled low, then current flows from INPUT 1 to INPUT 2 driving the motor in anti-clockwise direction. If the states of INPUT 1 and INPUT 2 are flipped, then current flows from INPUT 2 to INPUT 1 driving the motor in a clockwise direction.

The above concept holds true for other side of the IC too. Connect your motor to OUTPUT 3 and OUTPUT 4; INPUT 3 and INPUT 4 are input pins and ENABLE 2 enables the driver.

You can find the Datasheet Here.

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
STM32F7 Bootloader TutorialsRaspberry PI Pico Tutorials
STM32F103 Bootloader TutorialsRT-Thread RTOS Tutorials
Zephyr RTOS Tutorials - STM32Zephyr RTOS Tutorials - ESP32
AUTOSAR TutorialsUDS Protocol Tutorials
Product ReviewsSTM32 MikroC Bootloader Tutorial
VHDL Tutorials
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
Table of Contents