Menu Close

L293D Motor Driver – Arduino

This tutorial of Robo India explains how to control DC motor using L293D IC Motor Driver with Arduino. (By Robo India)

1. Introduction

The Motor Driver is a module for motors that allows you to control the working speed and direction of two motors simultaneously .This Motor Driver is designed and developed based on L293D IC.

L293D is a 16 Pin Motor Driver IC. This is designed to provide bidirectional drive currents at voltages from 5 V to 36 V.

1.2 Hardware required

S.No.ItemQuantity
1Arduino UNO 1
2Motor Driver 1
3DC Motor 2
4Female to Male Jumper wire 8
56xAA Battery 1

1.3 L293D IC Pin Out

The L293D is a 16 pin IC, with eight pins, on each side, to controlling of two DC motor simultaneously. There are 4 INPUT pins, 4 OUTPUT pins and 2 ENABLE pin for each motor.

Pin 1: When Enable1/2 is HIGH, Left part of IC will work, i.e motor connected with pin 3 and pin 6 will rotate.

Pin 2: Input 1, when this pin is HIGH the current will flow though output 1.

Pin 3: Output 1, this pin is connected with one terminal of motor.

Pin 4/5: GND pins

Pin 6: Output 2, this pin is connected with one terminal of motor.

Pin 7: Input 2, when this pin is HIGH the current will flow though output 2.

Pin 8: VSS, this pin is used to give power supply to connected motors from 5V to 36V maximum depends on Motor connected.

Pin 9: When Enable 3/4 is HIGH, Right part of IC will work, i.e motor connected with pin 11 and pin 14 will rotate.

Pin 10: Input 4, when this pin is HIGH the current will flow though output 4.

Pin 11: Output 4, this pin is connected with one terminal of motor.

Pin 12/13: GND pins

Pin 14: Output 3, this pin is connected with one terminal of motor.

Pin 15: Input 3, when this pin is HIGH the current will flow though output 3.

Pin 16: VCC, for supply power to IC i.e 5V.

2. Connections with Arduino

1. Module 5V (VCC) – Arduino 5V.

2. Module GND – Arduino GND.

3. Module 1 – Arduino D8.

4. Module 2 – Arduino D9.

5. Module 3 – Arduino D10.

6. Module 4 – Arduino D11.

7. Module Motor terminals – DC motors.

8. Module VSS power terminal- External power source of 9V.

Make the connection as shown above. 

Make sure that the Jumpers are preset on the Enable 1-2 and Enable 3-4 pins of module, so that motor will be enabled and work at maximum speed.

2.1. Working Mechanism

Rotation of motor depends on Enable Pins. When Enable 1/2 is HIGH , motor connected to left part of IC will rotate according to following manner:

Input 1Input 2Result
00Stop
01Anti Clockwise
10Clockwise
11Stop

3. Programming:

Here is the code to run this circuit.

You may download this code (Arduino Sketch) from here.

//Tutorial by RoboIndia on Motor Control
//Hardware Require: Motor Driver(By RoboIndia) & Arduino

//Motor A
const int inputPin1  = 10;    // Pin 15 of L293D IC
const int inputPin2  = 11;    // Pin 10 of L293D IC
//Motor B
const int inputPin3  = 9;   // Pin  7 of L293D IC
const int inputPin4  = 8;   // Pin  2 of L293D IC


void setup() 
{
    pinMode(inputPin1, OUTPUT);
    pinMode(inputPin2, OUTPUT);
    pinMode(inputPin3, OUTPUT);
    pinMode(inputPin4, OUTPUT);  
}

void loop() 
{
    digitalWrite(inputPin1, HIGH);
    digitalWrite(inputPin2, LOW);
    digitalWrite(inputPin3, HIGH);
    digitalWrite(inputPin4, LOW);  
}

4. Output

After the connection you will copy and paste this code in Arduino IDE than upload the code. Both motors will start rotating.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

4 Comments

Leave a Reply