PWM Motor noise issues

My Circuit: http://cl.ly/image/2y0R233E3J2X

Hi, I have two DC motors that I am driving at 5V using PWM and an N-Channel Mosfet to drive. The motors start at 0% duty cycle then ramp up to full. The frequency I am using is around 245Hz using Timer0. One motor works alright, but two motors induce too much noise and cause the system to reset each time it tries to ramp up. If I give the motors a spin up to speed sometimes it will be able to ramp up and work.

I have been throwing different bypass capacitors at the problem. Some help me start up but then seem to kill my control over the motors by smoothening my PWM or not letting them power off.

Any suggestions? Thanks!

Probably, not enough juice / current from power supply. What is the motors stall current?

Not sure, some mystery motors. But I do know that these motors have previously been powered from this power supply. They work fine if I drive them directly from the power. I can get a 4Amp plug later, but they are being used without any load at the moment.

Thanks!

For future reference, if you were running the motors from the +5v line on the arudino, that was your problem. The motors were drawing too much power causing the voltage in the atmega to cause it to reset. Always run high current devices from other supplies.

Both are powered directly by the 5V 2A supply. The Atmega is not powering the motors. How would I isolate them further?

Thanks!

How is your arduino connected to the power supply? Is the supply being applied to 'vin' or '5v'

I am using a bare Atmega. The 5V from the supply plugs into the 5V pins of the Atmega. The 5V supply also directly plugs into the motors. They share a power source but the ATmega doesnt power the motors.

Hmmm…This is tricky. You might want to try to add a capacitor (about 100uf) across +5 and GND to filter out noise. If that does nothing, I would suggest a more powerful supply.

When I add a big Cap I get some very off effects. For example, with a big cap the motor wont turn off sometimes. I think using a cap filters my PWM as well as the undesired stuff. Ill try a bigger supply.

Thanks!

I tried a 4A PSU and that didn't change anything. Adding caps has varying effects depending on the values, BUT it seems they interact with the PWM signals.

Thanks

It's not clear, if 2 motors switched by same MOSFET or use separate? What is the power supply, have a link to datasheet?

You say the Arduino isn't powering the motors yet that is how you have it drawn? Just plugging a larger power supply up to the Arduino doesn't mean you can push more power through the pins. Just want to make sure we are on the same page here.