Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: cooldog on December 17, 2010, 09:42:16 PM

Title: L293D connected to Arduino
Post by: cooldog on December 17, 2010, 09:42:16 PM
Hey guys,

So ill get right down to the point.
I cant seems to find the answers to my questions on google about the L293D motor driver.

I want to connect 2 motors to the chip, then hook the chip to the Arduino. the Logic Voltage is going to come from the Arduino and the motor power is going to come from a 9V battery.

(http://luckylarry.co.uk/wp-content/uploads/2009/07/L293D.gif)

So i get that Pins 2, 7, 10, 15 are for controlling the motor and have to go to the Arduino, and that Pins 3, 6, 11, 14 are for the motors.

But what i don't get is:

What are the "enable" pins for? what what do i have to put to them.
What GND's go where? Because the Vss has to have a ground for the logic voltage, and the motor battery has to have a ground. So what Grounds go where?
Do i have it right that Vss is my logic voltage (5V) and Vs is the motor battery?(9V)

Thanks alot,
cooldog
Title: Re: L293D connected to Arduino
Post by: rbtying on December 18, 2010, 01:02:21 AM
All grounds should be common (connected together).  Enable pins are +V_logic for on, and ground for off.  You can PWM these for speed control.
Title: Re: L293D connected to Arduino
Post by: dunk on December 18, 2010, 04:43:07 AM
hi Cooldog,
the first place to look for this sort of thing is the component's Datasheet.
every component produced has a datasheet and most of them show you a few typical application examples.

on page 9, figure 5 of http://focus.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=l293&fileType=pdf&track=no (http://focus.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=l293&fileType=pdf&track=no)
you can see a diagram of what you are trying to do.


also as rbtying says,
you always need to connect all the GNDs together.
this is true for all digital electronics unless you are trying to do something weird.
the GND is the common reference point from which the positive voltages are derived so it must be the same at all points on your circuit.


dunk.
Title: Re: L293D connected to Arduino
Post by: Soeren on December 18, 2010, 06:00:19 AM
Hi,

Enable pins [...] You can PWM these for speed control.
Using the enable pins for PWM is not a good solution, as they are much slower than the input pins, where the PWM ought to go - to the lower switching element in the bridge, to be precise.
Title: Re: L293D connected to Arduino
Post by: cooldog on December 18, 2010, 06:47:31 AM
okay thanks alot guys, i just needed to clear that up.
Title: Re: L293D connected to Arduino
Post by: cooldog on December 18, 2010, 07:27:42 AM
Can you check my schematic then? i think i figured it out.

Title: Re: L293D connected to Arduino
Post by: VegaObscura on December 18, 2010, 08:44:33 AM
Can someone explain why IC chips tend to have multiple GND pins?  Would it be so hard to connect them all internally and have just one GND pin?
Title: Re: L293D connected to Arduino
Post by: rbtying on December 18, 2010, 11:56:56 AM
Hi,

Enable pins [...] You can PWM these for speed control.
Using the enable pins for PWM is not a good solution, as they are much slower than the input pins, where the PWM ought to go - to the lower switching element in the bridge, to be precise.

Using enable pins reduces the number of PWM outputs you need, and OP is using an Arduino, where the PWM pins are randomly arranged around the board: four PWM outputs to the IC could easily become messy.
Title: Re: L293D connected to Arduino
Post by: waltr on December 18, 2010, 01:05:59 PM
Can someone explain why IC chips tend to have multiple GND pins?  Would it be so hard to connect them all internally and have just one GND pin?
There are various reasons. On the L293 the 4 GND pins are for transferring heat out of the chip (heat sinking) as well as providing a separate, low impedance path for the motor currents which can be quite high and have high frequencies.
A separate ground connection for the internal logic allows for a PCB layout that separates the current path for the motor and the logic. These would be connected together a one point but near the power supply. This to prevent the high motor currents for interfering with any of the low current logic.
Title: Re: L293D connected to Arduino
Post by: Soeren on December 21, 2010, 03:35:46 AM
hI,

Can you check my schematic then? i think i figured it out.
Seems fine, except you have to figure out how to get DC through C1  ;)

I'd imagine that placing C1 between power and ground would make your life a lot easier.
Title: Re: L293D connected to Arduino
Post by: Soeren on December 21, 2010, 03:41:09 AM
Hi,

Hi,

Enable pins [...] You can PWM these for speed control.
Using the enable pins for PWM is not a good solution, as they are much slower than the input pins, where the PWM ought to go - to the lower switching element in the bridge, to be precise.

Using enable pins reduces the number of PWM outputs you need, and OP is using an Arduino, where the PWM pins are randomly arranged around the board: four PWM outputs to the IC could easily become messy.
Oh well, that's a wiring problem and should be solved by good wiring techniques. It's not ground for making bad design decisions.

Besides, there's no need for extra PWM's here, as you'd just AND the PWM signal to the regular output.