Let's Make Robots!

Driving an L293 with one I/O pin?

There's the circuit, here's the plan...

I remember the remote control cars from yesteryear (the ones connected to the controller with a wire!). They had a joystick that just went forwards and backwards. When pushed forward the car would drive forward in a straight line. When pushed back, the car would back up while turning. There was no real directional control. I'm trying to acheive a similar level of control with this circuit. The idea is:

  • While the I/O pin and IN1/2 are low, the inverter transistor sets IN3/4 high. This configuration makes both motors drive forward. During this time C1 gets charged up.
  • When IN1/2 changes to high, the inverter makes IN4 low, causing the motor on IN2/4 to reverse.
  • For a short time while the motor on IN2/4 is reversing, C1's charge keeps IN3 high, causing the motor to stop. D1 prevents the same thing from happening to IN4. This should make the robot turn a little bit before R1 (with a high value) lets C1 discharge after... one second, let's say. Just enough time to point the bot in a different direction.
  • At about the same time C1 discharges to the point that IN3 goes low and causes both motors to go in reverse, the I/O pin is turned high again, preventing any possible backing up off of a cliff. 

Thoughts? Critiques? Phoolhardy physics? An easier way? Let me hear it :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Yes, this looks like it will work as long as you use a capacitor that is large enough.

...would you be upset about two high states on the first motor, as bird pointed out? Is it better to do two lows instead?

What birdmun alluded to was that it appears that all L293Ds are not the same.

From what I read the ones made by Texas Instruments have a built-in short protection that will not allow the condition of both leads high making a short. However all other manufacturers of this chip do not have short circuit protection built in.

I found one page that said "under NO circumstance" should you allow both inputs to be high at the same time, and then a couple sentences further on, they say that it "might be alright providing" it is an L293D chip made by Texas Instruments.  I thought that was hilarious.

  —"Under NO circumstances...   but it might be okay providing...."

It seemed to me they heard it as a rumour, and were hoping to cover their rears in case someone tried to sue them after following their recommendations and burning up some equipment.  That is just how I will leave it, too.  I could not verify that the Texas Instruments ones are protected against short, so I advise caution in all cases, and if you decide to do something that results in catastrophic failure, then that was your decision.

2 HIGHs or 2 LOWs give the same response BRAKE. From what Dan mentioned in the shoutbox this morning, he couldn't find a definitive answer as to how the 293 actually deals with 2 HIGHs. I believe he said his research was 2 to 1 against liking 2 HIGHs.

I got one right! Bird had a transistor inverter circuit at one time too, and I used a 74hc14 successfully instead of the 4069. I like using the ICs because it's fewer components/solder joints, but then you're also wasting three quarters of a chip when you do it my way.

I'm going with the discrete BJT inverter as this is a super tiny project, In fact, this is my first all-SMD component bot (crossing fingers). The L293D chip is the monster on the PCB. Another chip in addition to the uC will be a tall order to fullfill.

I just realized that I can simply wire one of the '293s inputs to ground V+ and it will acheive the same thing I was looking to overcomplicate. Thanks for holding my hand, Max :D

I'm not sure I understand the pin configuration you've got in mind here, but the way I understand it with this pinout (1&2 always the same and 3&4 always the same) it would be on brake all the time. 

The cars you mention from our childhood usually only had one motor that drove both rear wheels either forward or reverse and had a "slip-wheel" that, when in forward mode, was parallel to the direction of travel but that in reverse slipped into a position perpendicular to it.  Usually they didn't use a differential drive.

Here's a modified version of Fizikus's Ar-Du control circuit that might do what you're after if I understand correctly:

I've never done it quite this way before-Bird assures me that you can keep the enables high just hooking them up to Vcc instead of a PWM Pin, but this would theoretically drive two motors the same direction all the time and reverse them on a digital signal.  This would work with two rear motors and the "slip-wheel."  You could also acheive roughly the same thing using differential drive by taking one of the motors off of the digital control all the time (ie, always running forward.)  Then the other motor would "back it around" when the pin went high.

On the other hand, I may not understand at all what you're after

Yes, I got my 1s and 2s and 3s n 4s mixed up. You understand exactly what I'm after. And you knew the term "slipwheel." I knew they weren't differential drives but I wasn't going to longhand a description of said slipwheel :)

I never thought of taking one of the pins off reverse. As you say, "backing it around" would work nicely. So simple, no wonder I didn't think of it.

JAX aka The Overcomplicator lol