Go Down

Topic: L293D H-bridge with 2 pins instead of 3? (Read 6394 times) previous topic - next topic

moook

Hey!

so I am using the ever so popular L293D to drive a DC motor with control over speed an direction. But there's an odd thing I noticed.

All tutorials I've seen use 3 Pins to drive one motor: Enable (with PWM for speed) + 2 Digital outs for direction logic & stop.
Like here  http://itp.nyu.edu/physcomp/Labs/DCMotorControl (connections to Aruino added in blue)



but I noticed I can get away with +5 from the arduino on the enable pin, and one digital and one pwm pin for the motor logic, like so:



The control logic then is:

Digital Pin = 0
PWM Pin: 0-255 -> zero to Max speed forward

Digital Pin = 1
PWM Pin: 255-0 -> zero to Max speed backwards

This is working on my beardboard right now, but as I've only seen the 3 pin variant elsewhere, i wonder if there is any disadvantage I'm overlooking?

ash901226

i could only say that yes you can use the 2 pin instead of 3. here's a link that might help you more
http://www.societyofrobots.com/member_tutorials/book/export/html/159

moook

Thanks for that link - I'm still slightly confused, as the schematich there uses an additional "tri-state switch", which I didn't find necessary. But poking arround that website gave me this:
http://www.barello.net/Papers/Motion_Control/index.htm
Quote
There is an alternative way to drive the motor: The Enable bit is left ON all the time. One half of the H-Bridge is set forward or backwards and the PWM signal drives the other half of the bridge. The effect of this technique is that the motor is alternatively driven and shorted with the ratio set by the PWM signal

which I guess is what I'm doing. It even hints at using "locked-antiphase" to use only one pin per motor, but that I haven't understood quite yet.

John_S

I think the truth table in your pictures should say "Slow Motor Stop" when the Enable pin is low.

If you always have the Enable pin high and use PWM on an input for speed control, the output will alternate between HIGH and LOW. When both outputs are either HIGH or LOW, the motor will be braking. Imagine driving your car manually by 1Hz 50% PWM. You would stomp on the gas for one half second, then stomp on the brakes for one half second, and repeat.

If you use PWM on the Enable pin, the outputs will be in the X (high impendance) state when the EN pin is low. In our 50% PWM example, the motor won't be braking during half of the PWM cycle. This is like driving your car by stomping on the gas for one half second, then release it for one half second, and repeat.

moook

Thanks for the explanation, the different stop modes make sense to me.
I think the startup behaviour at pwm settings that just begin to start a rotation is different with the two ways to dive the h-bridge. My current setup doesn't really allow for accurate easurement, but "drive & break" is a description that matches my observations ;)

Go Up