L293D - Motor Driver Walkthrough
In this walkthrough I will show one simple way to use L293D H-Bridge, and build a basic Motor Driver for Arduino. I only tried this with Arduino Diecimila and it works well.
There may be other ways to do this, but since this works for me and feeds my needs, I assume this might be useful for more people.
NOTES:
- 9V little batteries are good to power the Arduino, LED´s and one or another sensor, but not so good to power DC motors or servos;
- If you want to have more devices, like another motor, servos, sensors, it is better to have a stronger power supply like an RC Car battery pack, or, AA batteries together with 9V battery and in this case you should connect both GROUNDS;
- be very carefull when dealing with power supplies, sometimes small mistakes may cause short circuits and damage your MCU, sensors, motors.. and you don´t want that!
- If you see something wrong with your motor, like stop, stall, or erratic behavior maybe your battery needs to be recharged, or your battery is not supplying enough power to your motors. Always use your batteries fully recharged;
- If you see erratic behavior in your servo, like going into one direction and staying there, or becoming noisy maybe it needs more current to operate, or your battery needs to be recharged.
So let´s start:
L293D gives you the possibility to control two motors in both directions - datasheet

Pins 1, 8, 9, 16 - POWER Pins 4, 5, 12, 13 - GROUND
Pins 2, 7 - Input 1 Pins 3, 6 - Output 1
Pins 10, 15 - Input 2 Pins 11, 14 - Output 2
The picture shows:
- one motor connected to IC pins 11 and 14.
- IC pins 10 and 15 connect to the Arduino PWM pins 5 and 6. Using PWM you are able to set different motor speeds.
- The Arduino is being powered from USB. Note the jumper next to the USB plug is set to USB Power mode.
Here we have a different setup:
- Note the jumper next to the USB plug is set to EXTERNAL power supply.
- The batteries pictures are symbolic. You should design your power setup regarding the MCU, motors and servos current needs. Ask in the forum what best fits your hardware.
Breadboard example:
The L293D only drives motors. Servos are driven by the MCU or Servo Drivers.
Below are some examples of custom made motor drivers assembled in prototype boards:

This board can control one motor, supply power for Arduino, and one servo.

This board can control two motors, supply power for Arduino, and two servos.


This board can control two motors, supply power for Arduino, and two servos.
I also added female headers to supply power for other components (ex: sensors, …)



I still don't understand why
I still don't understand why you are only using one power source to power the motor driver AND the mincrocontroller. It looks like you are sharing 5 volts with the microcontroller and the motors. Shouldn't you use 2 different power sources so the motors get a much higher voltage? The grounds should be shared between the two, but not the voltage (red line).
Also shouldn't the resistor connect voltage to the LED not the LED to ground?
Maybe I'm wrong, feel free to correct me.
EDIT: I guess this does give the benefit of controlling the motor in both directions so it DOES achieve it's goal. I just think the motors would be way underpowered.
The motors are underpowered
The motors are underpowered yes, they support until 6V. As soon as I make this with another setup I will post it.
As for the LED i guess you´re right! Thanks!
It shouldn't make any
I´ve tested the LED and
But as DerDude said, it´s a good practice to put the resistor on the red wire before the LED.
Must correct the diagram.
Oh my, it is a tough world!
Oh my, it is a tough world! I was so glad that you made and shared this tutorial, and then all sorts of "why this and why that" :D I hope you cope with that and keep it up so we can get a good base for all of us to build on. I plan to use it!
I haven't got enough brains to see anything than it is a great tutorial :) I know how much time you have put into making it, it is very consuming, so thanks.
no problem at all fritsl!!
no problem at all fritsl!! :D I´m glad I could make this so far into the point I can share what I have learned!
I believe that the first thing one should note is.. this works! May not be the "right way", but it works.
I believe there is a "right way" to do this techy things, but since every techy person has it´s own very opinion about the "right way" to do things, for me (arty person) if it works its perfect!! :D
Please keep asking and giving feedback, so we all can learn and make this a better tutorial!! But please, let´s try to make this simple... :)
I'm not being critical at
But I do ask questions...
Fun to watch, and learn from
hurry up on the breadboard tut.
Hahaha. I really think i am gonna build it, where did you get those parts with the screws? thanks. amzaing. Five stars
Terminal Blocks
thanks, oh and sorry to bug
I use this "white bits"
what are the female headers
Looking at the diagram you
thanks men, I understand
I´ve updated pics and
Thanks guibot for this
Thanks guibot for this tutorial, Also I would add that this works without changes for the SN754410 since it is pin-compatible with the L293D. I was able to do this in just a few minutes and it sure works better than my pololu controller. Now I know the h-bridge chip was OK, but the PIC was borked on that one :-/
:-)
The SN754410 is pin
It does have diodes as the L293D does
Check the datasheet on page 2, for the "Typical of all outputs" diagram :
http://focus.ti.com/lit/ds/symlink/sn754410.pdf
So this tell us they do
So this tell us they do exactly the same?
Because if they do, I must think in getting some SN754410, they are a lot cheaper than L293D.
No, it doesn't. Just because
No, it doesn't. Just because there are diodes in the specs doesn't mean that it's clamping diodes. If you read the spec, clamping diodes are not mentioned with one word. They are, if you read the spec for the L293D which has them.
Furthermore:
Page 1. "Improved Functional Replacement for the SGS L293" It says "L293". Not "L293D"
Page 6. If you look at their application example, they have external clamping diodes.
Researched it a bit more. I
OK!!!Thanks jka ;)
OK!!!
Thanks jka ;)
Sorry about that JKA, I'd always seen them as clamping diodes
Thats ok. It loks like
Hi! thanks!! It´s good
It´s good to know this works better than the polulu controller :D
Thanks for the tutorial!
Thanks for the tutorial! When I start playing with micro-controllers I'll use it as a reference. Do you have expierence with the other controllers (Pic Axe, Pololu, Basic Stamp, or BOA's favorite the PIC16F690)? How would you compare them with the Arduino?
Hopefully, this will not turn into another geek-tosterone laden "My PIC is better than yours" debate....
Hi! Glad you like it!! :)I
Hi! Glad you like it!! :)
I only have experience with Arduino, so I cannot compare it with other microcontrollers.
I know there is a comparison sheet somewhere, but can´t find it right now.
Ok, first, I know I asked