L293D Motor Driver

148,268

70

22

Introduction: L293D Motor Driver

A motor driver is an integrated circuit chip which is usually used to control motors in autonomous robots. Motor driver act as an interface between Arduino and the motors . The most commonly used motor driver IC’s are from the L293 series such as L293D, L293NE, etc. These ICs are designed to control 2 DC motors simultaneously. L293D consist of two H-bridge. H-bridge is the simplest circuit for controlling a low current rated motor. We will be referring the motor driver IC as L293D only. L293D has 16 pins.

Step 1: Part List

1) L293D IC

2) 4 1microfarad capacitor

3) 6 Header Male pins

4) 12 Volt battery or source

5) Wires or female sockets

6) 2 Motors

7) Arduino (Any) to test the Driver

8) Computer with arduino IDE

9) Misc itmes like soldering iron , soldering Wire etc

Step 2: Schematic and Working

The L293D is a 16 pin IC, with eight pins, on each side, dedicated to the controlling of a motor. There are 2 INPUT pins, 2 OUTPUT pins and 1 ENABLE pin for each motor. L293D consist of two H-bridge. H-bridge is the simplest circuit for controlling a low current rated motor.

Pin No. - Pin Characteristics

  • 1 - Enable 1-2, when this is HIGH the left part of the IC will work and when it is low the left part won’t work.
  • 2 - INPUT 1, when this pin is HIGH the current will flow though output 1
  • 3 - OUTPUT 1, this pin should be connected to one of the terminal of motor
  • 4,5 - GND, ground pins
  • 6 - OUTPUT 2, this pin should be connected to one of the terminal of motor
  • 7 - INPUT 2, when this pin is HIGH the current will flow though output 2
  • 8 - VCC2, this is the voltage which will be supplied to the motor.
  • 16 - VCC1, this is the power source to the IC. So, this pin should be supplied with 5 V
  • 15 - INPUT 4, when this pin is HIGH the current will flow though output 4
  • 14 - OUTPUT 4, this pin should be connected to one of the terminal of motor
  • 13,12 - GND, ground pins
  • 11 - OUTPUT 3, this pin should be connected to one of the terminal of motor
  • 10 - INPUT 3, when this pin is HIGH the current will flow though output 3
  • 9 - Enable 3-4, when this is HIGH the right part of the IC will work and when it is low the right part won’t work.

Why 4 grounds in the IC?

The motor driver IC deals with heavy currents. Due to so much current flow the IC gets heated. So, we need a heat sink to reduce the heating. Therefore, there are 4 ground pins. When we solder the pins on PCB, we get a huge metalllic area between the grounds where the heat can be released.

Why Capacitors?

The DC motor is an inductive load. So, it develops a back EMF when supplied by a voltage. There can be fluctuations of voltage while using the motor say when suddenly we take a reverse while the motor was moving in some direction. At this point the fluctuation in voltage is quite high and this can damage the IC. Thus, we use four capacitors that help to dampen the extreme variation in current.

Step 3: Working Mechanism and Arduino Code

Now depending upon the values of the Input and Enable the motors will rotate in either clockwise or anticlockwise direction with full speed (when Enable is HIGH) or with less speed (when Enable is provided with PWM).Let us assume for Left Motor when Enable is HIGH and Input 1 and Input 2 are HIGH and LOW respectively then the motor will move in clockwise direction.

Arduino Code I used to test :-

//Testing the DC Motors with
// L293D //Define Pins //Motor A int enableA = 2; int MotorA1 = 4; int MotorA2 = 5; //Motor B int enableB = 3; int MotorB1 =6; int MotorB2 =7; void setup() { Serial.begin (9600); //configure pin modes pinMode (enableA, OUTPUT); pinMode (MotorA1, OUTPUT); pinMode (MotorA2, OUTPUT); pinMode (enableB, OUTPUT); pinMode (MotorB1, OUTPUT); pinMode (MotorB2, OUTPUT); } void loop() { //enabling motor A Serial.println ("Enabling Motors"); digitalWrite (enableA, HIGH); digitalWrite (enableB, HIGH); delay (1000); //do something Serial.println ("Motion Forward"); digitalWrite (MotorA1, LOW); digitalWrite (MotorA2, HIGH); digitalWrite (MotorB1, LOW); digitalWrite (MotorB2, HIGH); delay (3000); Serial.println ("Motion Backwards"); digitalWrite (MotorA1,HIGH); digitalWrite (MotorA2,LOW); digitalWrite (MotorB1,HIGH); digitalWrite (MotorB2,LOW); delay (3000); Serial.println ("Stoping motors"); //stop digitalWrite (enableA, LOW); digitalWrite (enableB, LOW); delay (3000); }

4 People Made This Project!

Recommendations

  • Big and Small Contest

    Big and Small Contest
  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Make It Bridge

    Make It Bridge

22 Comments

0
blitobit
blitobit

3 years ago on Introduction

Hello,

I've modified slightly your code to use it with an Attiny85, only one motor, but for some reason, the motor only spins in one direction. In fact I've checked that during the inversion period the motor doensn't move. I've changed the order of activation MotorA1, MotorA2, HIGH and LOW and nothing happens. I don't think the problem is the Attiny85. I use it very often for small projects.
Have you got any idea what might be the reason?
Should you need more inormation: code, schema... etc just ask me.
Thanks
Pablo

0
avinawade
avinawade

Question 3 years ago on Introduction

can i used only one 10uf/63v capcitor out of 4 shown in circuit. please reply any issue in motor or driver ic.

1
Santhosh30
Santhosh30

Question 3 years ago

hw to connect the driver module to nodemcu please can u send me the connection pin diagram

0
Ani24
Ani24

Reply 3 years ago

just try swapping the motor connections it will do the trick ! else if you want to do that in code swap values of any one pair i.e. LOW to HIGH and vice versa

0
VinuS5
VinuS5

3 years ago

Hai i want to do this project cnc mini plotter mechine ,so i want your support
And this is my first project

0
Ani24
Ani24

Reply 3 years ago

do let me know how can i help you with that .

0
sunetrabhar1999
sunetrabhar1999

3 years ago on Step 3

Pin 4 and 5 are ground pins...why do we make use of these two pins as output input pins...and pin 1 is enable pin...so why do we make use of pin 2 as enable pins...please let me understand...I can't get the logic

0
Ani24
Ani24

Reply 3 years ago

The circuit in the project is in accordance to the pinout of L293D IC. Functions of pins are fixed by the IC manufacturer such as Pin 4,5,12,13 are gnd pins. there are 2 enable pins to activate and deactivate their respective side, as L293D is a dula h-bridge.

0
kendias
kendias

3 years ago

I want to use this driver with a motor controller mc33033 to control a 4-phase brushless motor. Looking for circuit diagram to do this

0
Loverboy1150
Loverboy1150

Reply 3 years ago

Since brushless motors draw a huge amount of current and since the max output current of the IC limited to 1 A. I would recommend looking for another circuit for it

0
kendias
kendias

Question 3 years ago on Introduction

what is the supply voltage and current range for L293D

0
Loverboy1150
Loverboy1150

Answer 3 years ago

You can give from 4.5v to 35 v at vcc2 and upto 7 at vcc1

0
JimA107
JimA107

5 years ago

Hi, can anyone advise how i code a l293d chip to run a stepper motor. I am new to this, i have no usb on board not sure if you have to get some sort of docking station to put chip in then code it, thanks

0
SamiulS5
SamiulS5

Reply 5 years ago

you do not code L293D.Just follow the above instruction and you are good to go.

0
avi jain
avi jain

Question 4 years ago on Step 3

Thank you so much for this knowledge..

Sir which pic should i use if I have to connect a
usb keyboard, and
3dc motors
And program them..??

0
lenny1738
lenny1738

Answer 4 years ago

I'm not sure you understand how this works, not to worry
this is a microcontroller circuit that you can operate with an arduino
unlike a raspberry pi,which you connect keyboard, mouse, etc.
an Arduino should be connected to a pc in which you can write the program
https://www.arduino.cc/en/guide/introduction

0
ArunN40
ArunN40

5 years ago

Please reply fast

I am currently working on project which require this driver board so please hurry.

0
Ani24
Ani24

Reply 5 years ago

On the left side 2 caps between pin no, 3-4 and 4-6 and on the right side 14-13,13-11. Hope it helps . refer to the pin configuration of L293D