Go Down

Topic: Arduino forgets sketches after a few minutes? (Power supply?) (Read 2 times) previous topic - next topic


Hey guys,

So, ive taken a dive into the Arduino to create a simply stepper motor apparatus. Its going well, but thanks to the "read before posting" i think i found a problem i was going to ask about, but now i have to ask about the soloution.

Im using an arduino Mega 1280 to drive a pololu A4983 step driver. Im powering everything with this beefy little thing


Considaring my stepper motor is a Nema, drawing 1.2A, and i will be adding another down the line, this thing is serving me well...except for the mentioned "dirty power" in the FAQ.

The problem i have is i'll wire everything up, upload my sketch to the arduino, and it will work amazingly. For about a minute or two...then the motor begins the all too familliar squeel and seizes. Rebooting the arduino makes it work for a few seconds, but then back to the original problem. Seems the only soloution is unplugging the arduino from my setup, hooking up the USB and simply reuploading the sketch brings it all back to life.

I read on here that dirty power can cause the arduino to lose its sketch. So how can i go about fixing that? It is at a solid 9V, would i simply use a wallwart to power the arduino? I was using the VCC/GND pins the arduino wired to this PSU.

Reason i ask this is, ive read NEVER power up the arduino when the pololu driver is without power, as you'll blow the arduino. But, if you hookup usb, you get power, soo...

The other issue i'll have is, sometimes the stepper driver starts in the wrong direction, and will usually come back and go through the sketch, which is basically, step 1666 times one direction, pause 6 seconds, step back 1666.

Im sure some "dirt" comes from powering it all up and down, which makes me beleive i should hookup a relay or switch? The motor itself i'm sure destroys my DC signal, so i assume some beefy caps would correct this?

Lastly, i made such a rookie mistake and blew up my arduino last night.  You guessed it. Crossed VCC and ground POOF! That one cap smoked. I have to asses damage today to make sure  my pololu is still working. Anyway i can install a diode to prevent this on the next arduino?

Thanks in advance guys!


A couple of observations:  Its the noise coming from the motors that can be the issue, and one way to minimise this is run power separately from the power supply to both circuits, using thick wire for the motor controller supply.
Adding more decoupling at the Arduino can help. That PSU should be strong enough to cope with the load at least ;)

The running for two minutes or so without problems strongly suggests the motor controller is overheating, leading to misbehaviour - the little Pololu board really needs forced air cooling if used at high current I think - check the temperature (careful not to burn your fingers) of the Pololu controller after a minute or so, if its too hot to touch for any length of time consider a fan.

If you want to be able to separately power the two circuits add 2k2 resistors in series with the logic connections between them, this will provide current-limiting if a logic line is driven high into a powered-down destination - hopefully this is enough to avoid damaging the input protection resistors as well as the output drivers.  The downside is that switching speed is slightly compromised.  Alternatively arrange for the arduino to sample the supply rail of the motor controller and only drive outputs if its powered up.
[ I won't respond to messages, use the forum please ]



Thanks for the reply man. I'll give these suggestions a shot when my new board comes in.

Ive tried ruling out it being a heat issue, as yea, i thought thats what it was right off the bat. For one, pololu says you can push 1A without a heatsink. I run this thing between .9-1.2A, as torque isn't really required for what i'm doing (sweeping a laser beam).

In efforts to rule out heat, I grabbed a RAM chip heatsink and glued it to the pololu. It does heat up, but not too bad to the touch. Also, I placed a fan right next to it and gone as far as timing the moment of shutdown to see if it varies based on heat.

Now you would think IF its heat, that after the initial shutdown, if i waited long enough it would work again, but, not such the case. Doesnt matter if i wait 30 seconds or 30 minutes, i'm stuck with a moot project, unless i simply reupload the code.

The other 2 reasons i think i've ruled it out is, ive seen this thing on a meter go into shutdown, and the current would climb REALLY high, then stop at 0. When it stops now it holds precisely at 1.2A, just stops moving. Also, if i hook this thing up without an arduino, just manually wire all the logic to 5V and GND as needed, it will run indefinitely.

There are 2 9V outs on this beefy psu, im thinking this time around i'll run the arduino by itself off of one rail, still with the decoupling caps as you suggested, and see if i can come up with another 5V supply for the chip other than the arduino, so that the arduino is simply providing nothing more than logic, as right now i was running the arduino powering 5V to the pololu.

Thanks again mark!


Hmmm. Odd.  just checking you're not taking motor power through the Arduino regulator?
[ I won't respond to messages, use the forum please ]


Nope, motor power comes from that beefy supply. The a4983 5V comes from arduinos regulated 5v out. I was running the arduino in paralell to the motor for the 9v supply. Pretty much set one side of my breadboard to 9v/Gnd and ran everything off of that. Would it help if i drew up a diagram?

Go Up