L293DNE H-Bridge

Today I’m going to talk about the L293DNE Quadruple H-Driver used to control 2 bidirectional motors when hooked up to a motor. I had a lot of trouble recently attempting to get this thing working. All of the tutorials written involved hooking it up to a microcontroller (I’m going to use the arduino in all examples from now on), and sending singles with code to change the direction. While that is the ultimate use I’ll be using the L293DNE for, I wanted to make sure it worked without a microcontroller first.

Example use of an L293DNE

The L293DNE has 16 pins. If you’re just driving a single motor you can ignore 5 of those pins (9-11, 14-15). Pin 16 powers the logic of the controller and should always be set to +5V from what I’ve been able to gather. Pin 8 provides power for both motors. Often you’ll want a stronger and independent power source for your motors than from the rest of the logic. Your motor power source should have its positive node connected to pin 8, and ground connected to the grounds of pins 4, 5, 12, and 13. Grounds for your logic control source should also be connected to the same pins.

The motor will be connected to pins 3 and 6. The basic idea is that when power is supplied to pin 2, pin 3 will become positive and pin 6 will become ground for the motor. When power is supplied to pin 7, pin 6 will become positive and pin 3 will become ground. Depending on which control pin (2 or 7) you have powered, the polarity of the circuit that’s going through the motor will change. If neither 2 nor 7 is powered, there will be no circuit going through pin 3 and 6 and the motor will not be powered.

Motor 1 and 2 are turned on and off by pin 1 and 9 respectively. If either of these pins does not have +5V connected to them, the motor associated with that pin will also not receive power.

One thing that I did not understand from looking at the datasheet for the L293DNE was that while you can add a voltage to pin 2 or 7 to turn the motor on in either direction, the other pin must be connected to ground to work. This means that if pin 7 has a +5V but pin 2 is not connected into the circuit, the motor will not work. The circuit for pin 7 is completed by pin 2 (and visa versa), not the grounds coming from pins 4, 5, 12 or 13. I assume those grounds are associated with pins 1, 8, 9, and 16, but I haven’t experimented with that and I can’t find that information in the datasheet.

So, in order to test if your H-Bridge works, do the following:

Quick test for L293DNE without a controller

Pin 1, 2, and 8 should connect to the +5V positive line of your power source. Pins 4, 5, and 7 should connect to ground. Hook pin 3 and 6 up to a multimeter and check the voltage. It should read around +5V (probably a little less). Change the circuit so pin 2 is hooked to ground and pin 7 is hooked to +5V and check again. The voltage reading should be reversed (-5V or so). Unhook either pin 2 or 7 and you should see no voltage going through the circuit. You’ll notice the same thing if you leave the original setup and unhook pin 1 or 8 as well.

So what caught me off guard from this was that all tutorials mentioned plugging the H-Driver into an arduino and setting pin 2 to HIGH and 7 to LOW. What didn’t click for me was that LOW doesn’t mean no current is going through it, it means ground. By not making the association that LOW = Ground, I was attempting to just add voltage to 2 or 7 without connecting the other, assuming that pins 4, 5, 12, or 13 would provide the ground for the circuit. This is not the case, the other needs to be connected to ground.

I don’t know if this will help anyone else out there working on making simple bots, but I found it a frustrating adventure in learning how to use the L293DNE. If I had just hooked it up to the arduino to start with it would have worked fine, but by going the longer route of figuring out how to use the driver without an arduino I learned more about the chip and the arduino itself.

,

Published by


Responses

  1. Randall Avatar
    Randall

    Great write up. Im using this driver for my robot and was searching google to do research about it before using it. One correction though the quick test diagram is missing the 5volts on pin 16 (logic power).

    1. Jearil Avatar
      Jearil

      Nice catch. I must have forgotten about that even though I wrote about it above. Thanks. I’ll see if I still have the diagram file to update that with, else these comments will tell that story.

    2. Gijs Avatar
      Gijs

      thank you! i almost gave up on this till i read your reply.. 🙂

  2. Gokul Ramamurthy Avatar
    Gokul Ramamurthy

    hi,

    Was there a voltage drop across pin3 n pin6 when u measured? Mine drops by 0.7V

    1. Jearil Avatar
      Jearil

      When I did it I did not have a voltage drop that I remember. It’s been a while since I used this chip though.

  3. Yama Ploskonka Avatar
    Yama Ploskonka

    yop, I also spent a lot of time and frustration before I realized that pull-down resistors were needed for the A pins, to be able to test stuff sans ‘duino. The good news is that now I can operate DC motors plain and fancy, and even 4-wire steppers!

    1. akankshha aggarwal Avatar
      akankshha aggarwal

      wonderful write up for starters atleast……i found it extremely helpful to undersatnd about the working of this ic..ill be using it to make my bot

  4. Pedro Avatar
    Pedro

    I know it’s been a while, but it’s been useful to me.
    Thanks!!

  5. Etienne38 Avatar
    Etienne38

    Do you think pins 1 and 9 can be used to create kind of a chopper (with a 5V/1kHz square signal) ? Or will it dammage the chip ?

  6. Amadeus Van Kerckhoven Avatar
    Amadeus Van Kerckhoven

    I can’t get it to work. Pins 3 and 6 give me a low, but both positive voltage (0.65 v). Also measured directly on pin8, the voltage drops to 1.7v (from a 5v source).
    Does this means the chip might be broken ?

Leave a reply to Jearil Cancel reply