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.

Although a little more complicated this circuit turns the motors off when your control line is changed to input (high Z).

Motor 1 is wired to always run forward except when a high impedance input disables the motors.
Motor 2 will go forward when the input is high, reverse when the input is low and off with a high impedance input.


I see IN1 and IN2 both wired to +5 volts. Didn't you want one of them (presumably IN2) wired to ground so the motor will have a voltage across it if it is to drive forward? On motor 2 I see a similar situation in that IN3 and IN4 are tied together will be either both high or both low so no current will flow through the motor. An inverter in one of those leads would fix that.

Oops, yes you are correct. I was in a hurry and missed that. I have never actually used an L293D before.

would not the circuit that I drew up also cease movement when the I/O pin went to Hi-Z also? I am not trying to say me too, only trying to learn a bit.

Telefox nailed it!

Hi-Z to a comparitor/op-amp is filtered out as a non-input?

No, there are two 10K resistors that hold the input at 1/2 Vcc when the control line is high impedance otherwise it would be a floating input that could go high or low depending on electrical noise and static charges. A high or low input overrides these resistors. The comparators then compare the high, low or 1/2 Vcc input voltage to 1/3 & 2/3 Vcc levels to determine the state of the input and generate the appropriate digital output.

Very smart.

<-- Older dog. New tricks. :D

If the I/O pin is set to high impedance on your circuit, after a short time the L293's input will be:
IN1 = high
IN2 = low
IN3 = high
IN4 = low

Both motors will be driving forward in this state.
This assumes the resistor connecting IN3 to ground is much larger than the transistor's collector resistor, but this condition is necessary for the circuit to function anyway =)

I failed to label the PICAXE input, but, I'm sure you know where it is. A HI would stop the motor on the IN1 and IN2, and, would, as long as the cap was charged, cause the other motor to drive forward for a short time. A LO would cause both motors to drive forward.

I think Dan might not be happy to see the top motor getting two HI inputs. :)