Let's Make Robots!

L293 Driver not stopping

So I'm building a line following robot that is directly wired from the Atmega8 to a L293 motor driver chip and then obviously to some motors.

The Atmega8 is sending manual PWM signal to the L293 driver on the forward pins. By that I mean I have code like:

void motor_pacer();{


if( ticked <= duty_cycle)


else if(ticked <= period)





All other pins on the L293 are logic low. Except obviously for the 2 Vcc pins which are supplied by a 6V battery and also for one enable.

Without the L293 motor driver in all the voltages are showing what I expect. Importantly the enable to one motor is high while the enable pin to the other is low and PWM is being sent to one forward pin. However when I insert the L293 motor driver in both motors switch on and the voltage on both enable pins has become high.

How do I fix this?


Comment viewing options

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

So this is my full schematic, as it currently stand. I've removed the pull down resistors from the forward and enable pins just coz i was messing with caps etc, and they don't seem to make much difference.

The holes out on the right are where optocouplers go but I removed them to make sure they weren't screwing me.

Another interesting point is that when I program with the serial the motors start running. This usually means I have to take the motor driver out to program.. which I imagine can't be right.

The schematic's been scaled down too much (probably by LMR) to make out the pin names etc... but the general layout looks ok.

Would it be possible to get an actual photo of the hardware too?

Could it be flyback from motors? L293 doesn't have internal flyback diodes like L293D and your schematic doesn't have them. Here's a quote from the datasheet (http://www.datasheetcatalog.org/datasheet/texasinstruments/l293.pdf):
"On the L293, external high-speed output clamp diodes should be used for inductive transient suppression."

I haven't used L293s myself so I cannot tell how it affects your system if you don't have flyback diodes (I have only used L293Ds). Anyway it could be worth trying to add flyback diodes if you don't already have them. Block diagram on the page 2 of the datasheet shows how to connect them.


Oh sorry it is a L293D.

Question are the pull down resistors needed on the input pins?

Could capacitors help?

The pull-down resistors ensure that the inputs go logic low when there's nothing driving them. In your case every input pin is connected to an output on your Atmega, so they're not really required.
Capacitors can help filter out noise on the signal lines, but unless the lines between the Atmega and L293D are really long there shouldn't be much noise picked up anyway. Also your Atmega outputs are driving the lines directly, which would suppress any minor electrical noise you might pick up.

What sort of power supply arrangement are you using? A photo of your setup might anwer some questions if you can post one (or a few even).

The power supply is 4x1.5V batteries in series. However they've long since run out so I'm now running off a variable DC power supply at 6V. Sorry I don't have a camera on me, but full circuit has been posted.


What's the current rating of the variable supply?
If the current draw of the Atmega + motors, etc, exceeds the rated supply then you'll usually get continuous resets on your microcontroller, which causes some weird behaviour.

ah.. I think the max is 3V. However when I'm using it for the robot, its says 0.44A

its a Topward dual track dc power supply 6303D

Sorry i meant 3A.

Also does solder flux conduct?

I have a spray remover.. but not sure how to use it.

Do you just spray it on and get a cloth to wipe away?


So after some cleaning with the spray and a brush, i can now get either motor going!

However I cannot get two... when I ask for two only one goes