DC Motor crashes cpu when it nears full speed.

I've confirmed that this happens with my Arduino Mega 1280, Uno and a breadboard atmega328 running standalone. Sometimes after it crashes the cpu the only way to recover is to reflash my program. I thought it may have been my code so I setup a simple pwm output with a potentiometer program and it still crashes when the motor is approaching full rpm. Sometimes it does not crash right away, But it usually doesn't last more than 30sec at high speed.

for the motor power I've tried two power supplies, one 18v and another 14v. On my breadboard arduino this power supply is also powering the atmega328 chip with a 7805 regulator, on my mega and uno the power supply is only powering the motor, The DC motor can support up to 18v. It's just a off the shelf toy dc motor that I got from "The Source" (canadian radioshack) I'm using a TIP120 transistor to control it with a 2.2k resistor (I've tried other combinations) between the output pin of the arduino and the base of the tip120. I've put a 0.01uf cap between the power legs on the motor as well as a 1n4004 diode. I've also extended the wires and moved the motor further away from the breadboard where the arduino is and it's still locking up the atmega chip.

I believe I've tried everything except more 0.01uf caps between the power legs of the motor to the motor case to further cut down on interference so I'm currently at a loss as to why this is happening.

In my searching I can't really seem to find anyone else with this issue that couldn't solve it by doing at least one of the things I already have tried.

Typically one could start looking with an oscilloscope to see what the Vcc voltage looks like and possibly how you have the arduino and motor ground wires routed to the negative terminal of the power source, they should not share the same conductor anywhere and be connected together only at the power supply.

It can be solved but you have to have good tools to see what you are up against and what effect any changes you make have on the situation.

Lefty

Chances are you have a common ground wire or ground loop or similar issue. Post a photo of your setup.

retrolefty:
Typically one could start looking with an oscilloscope to see what the Vcc voltage looks like and possibly how you have the arduino and motor ground wires routed to the negative terminal of the power source, they should not share the same conductor anywhere and be connected together only at the power supply.

It can be solved but you have to have good tools to see what you are up against and what effect any changes you make have on the situation.

Lefty

it's pretty much setup like this
http://bildr.org/blog/wp-content/uploads/2011/03/tip120-solenoid.png

my power connections for the motor are connected to the dc supply, before the 7805 regulator. Maybe I'll rip it apart and start from scratch with the uno, then move to the breadboard arduino when that's functioning, Although I've done that already a few times.

dc42:
Chances are you have a common ground wire or ground loop or similar issue. Post a photo of your setup.

I'm creating what I currently have in Fritzing. I'll post that when it's done, my breadboard is a mess of wires and you wouldn't be able to tell where anything is going.

If you can't figure this out, you could try separating the motor from the Arduino.
You could use an optocoupler, as the control signal is digital.
In this case, to have 100 % isolation, you should also use a different power suply to the motor.

So it can be solved anyway, but it's always good to know what causes this so you (as well as us) can avoid this in the future.

Can the motor supply drive the motor at full speed (ie directly connected, no transistor) without the
voltage falling below the nominal value? (ie is the power source up to the job?)

Have you ensured both power and ground wires to the motor circuit branch off before the 7805, that the 7805
has suitable decoupling right next to it?

MarkT:
Can the motor supply drive the motor at full speed (ie directly connected, no transistor) without the
voltage falling below the nominal value? (ie is the power source up to the job?)

Have you ensured both power and ground wires to the motor circuit branch off before the 7805, that the 7805
has suitable decoupling right next to it?

I ended up swapping over to a different brand of motor and I don't seem to have this issue now.
But yes, the motor positive and negative are connected to the power supply before the 7805, and at the 7805 I have a 10uf cap before and after it as per the instructions found here: http://arduino.cc/en/Main/Standalone
maybe the caps need to be larger?

I read the motor running at full speed and it was drawing around ~400MA, both the power supplies I tested could support 900MA and 1000MA