Motor/PICAXE Help

I have a problem. My PICAXE and my motors don't really like each other. The PICAXE runs the program fine, but then when the motors are added on, the PICAXE freaks out and skips lines of code. This happens all the time and I'm really frustrated.

I'm using the PICAXE 20x2 to send signals to a L298 Motor driver.

Here's my set up:

Motor_Driver.jpg

Show your setup

Need a picture. Could be draw-down on your batts leading to brownout. Could be elec. noise and just needs some caps.

Need Pics

Would a Picture of my

Would a Picture of my breadboard be fine?

Yup

Sure, just include some links or model numbers in terms of the parts you are using.

Better photo

We’ll need a better photo… In focus maybe?

I have been staring at this for a while now…

Why is the motor drive all bent to ■■■■■ It looks like it is in sideways. Is it? Is it just the picture?

It is a L298

It is a L298

Does 9v battery supply

Does 9v battery supply enough amps for your motors? I  do not know how much amps 9v supply but i do not think its that much. Are your motors rated for 9v? I do not know if this is causing your problem but it could cause a problem.

Ok I got it now…

It is a L298 not a L293. Why are you using a L298? Are you using anything other than regular old gear motors? Anything bigger than what is on the start here or similiar? Not to mention, the 298 has a staggered pin pattern so you had to bend them all funny to get it in your bread board. You could have easily damaged something when you did that -or- some of the legs could be rubbing together and shorting.The L293 is sorta the standard around here, if you were using it, there would be a lot of walk-though posts.

I agree with patrick --9v? You are not using a 9v battery to run your motors, are you? Are you sharing grounds? Are you sharing 5v and 9v? --You should not be. Is there an issue with the servo set-up? Remove it and try again. Simplify. Remove as much of what “it could be” as possible and test what is left. Test just one side of the motor driver. Remove the motor and check with a multi-tester. Test just the outputs from the picaxe with leds. Test the motor driver by feeding high and low into the inputs manually. Add a LED blink different points of your code as a way of seeing exactly where (and if) it is actually skipping code. Write simpler code and test. Add more, test more. Experiment!

I had very similar problems

I had very similar problems when powering a micro and motors from the same power source.  Providing a separate power supply for the micro solved my problems.

Do you have access to a storage scope or something to measure how low the battery voltage sags when the motors are first starting up?

Good luck!

You will need flyback diodes

You will need flyback diodes on your motor outputs. It will not work properly without diodes. Look here for a schematic:

http://www.logicalzero.com/blog/images/motorboard_schematic.png

Also recommended is to put a 100nF capacitor from VS to GND and from VSS to GND.

 

 

Thanks for your help. I

Thanks for your help. I changed up the code and put capacitors around it. So its starting to work, but it still has some glitches. When you said why am I using the L298, did you mean it is a bad chip? Is there a motor driver chip you recommend that’s better than it?

Thanks, I’ll try thins

Thanks, I’ll try thins

Nothing wrong with that chip

There is nothing wrong with that chip, in fact I think it handles more power than the L293. However… First, it has staggered pins and will never really work right in a breadboard and any kind of pre-drilled PCB won’t work either. On top of that, the L293 is sorta the “standard”. I.e. the start-here bot uses it (the 28x board uses it) and there a ton of forum posts, tips/walks, questions and answers posted about this motor driver to assist you with any problems you might run into. Case in point, I myself had to look up the data sheet for your driver to check your pins --If you were using the L293, I would have that info on the top of my head as would a lot of other people here.