L293D problems

nickbanks

New Member
Hi...

OK I'm using an 18M picaxe with a L293D motor controller. as far as I'm concerned I have set it all up correctly. When I test the L293D by applying a current to the inputs it acts like it should (bi-directional etc).

To test it I just did a VERY SIMPLE programme:

Code:
main: high 3
pause 2000
low 3
pause 2000
goto main
Running this an LED on output 3 it works fine... but as soon as I hook up the L293D to output 3 things start to go wrong...

It runs through the programme fine, but the second time it runs the programme, it seems to hang on the first HIGH. So the motor just keeps spinning?

I have grounded all extra input and outputs on th L293D, and am using 5V to run it all.

any ideas? :confused:

thanks in advance!

- Nick
 

BeanieBots

Moderator
It's not too clear exactly what your setup is.
A diagram would help us a lot.

It might be motor noise making the PICAXE reset.
Fit decoupling caps to the PICAXE. (should go without saying when motors are used).
Fit 100nF across the motor right at the motor.
Also fit two further 100nF caps, one from each motor terminal to the motor case.
 

gbrusseau

Senior Member
Hmm. Grounded all unused inputs and output. Grounding unused outputs would surely blow the L293D if it weren't for the good fortune of grounding the "enable output" pin as well, which disables the outputs in a high impedance state. By all means, remove the ground from the unused outputs.
 

slurp

Senior Member
The biggest problem I find with controller, motor and L293 combination is the decoupling and routing of power to avoid resetting the controller.

Is your 5V to everything regulated?
Is the regulator rated high enough for the motor and controller?
Do you have the controller and driver strung out on the same power line or do they radiate out separately from the supply point.
Do you have any decoupling caps in there?

I guess the circuit and layout would be useful....

best regards,
Colin
 

russbow

Senior Member
I use the L293 and find it a very useful chip, especially by using the enable pins as PWM control.

One little component that is seldom mentioned for decoupling is the ferrite bead ( search on e-bay ). One slipped on each motor lead really cuts down the krud. Surprised we dont hear more of them on the forum.
 

BeanieBots

Moderator
Ferrite beads are indeed very good for suppression.
However, it's not something found in the average junk box and their use is more limited than that of a capacitor.
 

russbow

Senior Member
You're right BB, but I use them as well as, not instead of caps. In a noisy situation I reckon a handful of 1Kp disc ceramics and a few ferrites can save hours.
 

nickbanks

New Member
Circuit diagram attached

Thanks for all the replies guys!



Ok I have attached a rather shabby circuit diagram.

I tried running the entire thing with an LED on the pic's outputs. With the motor connected, the outputs stay high, but as soon as I disconnect the motor, the LED shows me that the output pin is going high and low as it should!

So yes - it definitely seems like there is some noise or something...

I'm very new to all this, so I'm sorry if this all seems completely obvious to you!

Perhaps if you could edit the diagram to tell me what to do?

Thank you again for all the help!

Much appreciated!

- Nick
 
Last edited:

InvaderZim

Senior Member
Cleaning up your ground wires can really help with noise issues. Some things to try:

Tear up all your ground connections.

Use a dedicated ground wire from the PIC ground pin to the ground of the 5V regulator. From the 5V regulator ground, run a wire to the 7.5V return.

Use a dedicated ground wire from the L293 to the 7.5V return.

Add a ~10uF cap at the output of the 5V regulator. Add a 100nF cap right at the PIC power/ground pins.

Add 100nF caps to the motor as described above.
 

slurp

Senior Member
I'm not able to view the circuit at the moment (my problem low bandwidth connection - no pictures) but consider your LED vs Motor in terms of current.

LED low current and unlikely to upset your power supply, Motor high current can pull down supply voltage if it is not suitably rated.

If you swap your high low commands round you might see a very different responce
Code:
main: low 3
pause 2000
high 3
pause 2000
goto main
When you controller resets (after power brown out) it doesn't restart the motor straight away, it'll wait. I'm expecting you to see the motor drive in very small bursts but it'll be off much longer than on.

regards,
Colin
 

nickbanks

New Member
Fixed !

Slurp, you were right about re-writing the programme like that... Yet after about 5 iterations it still hung and the motor kept spinning.

I added a 4.7uf cap (all I had!) on the pic power and ground pins, and now it works like a charm!! even with two motors.

Are all the other caps necessary if it works?

thanks guys!!

- Nick :)
 

BeanieBots

Moderator
Are all the other caps necessary if it works?
Yes, it's a good idea to fit them.
It might work OK today, but tommorow when the motor brushes are little more worn or the weather is a little warmer, it might not work. The extra caps will give added reliability.
 

Rickharris

Senior Member
As a passing thought IF you ground the output of the L293 you will cause it to go into thermal shut down - This will also happen with too large a load on it. Appears not to work at all but is really shutting down to save it's life.
 
Top