When I apply power to my breadboarded ATmega 328 with a small DC motor driven through a logic level mosfet, the voltage measures about 5v then drops to around 2v after 4 or 5 seconds. EDIT: I'm referring to the voltage between the output pin and mosfet gate. The rest of the circuit measures 5v where it should measure 5v.
I'm using 6 AA rechargeable NiMH batteries through a 7805 regulator decoupled with .1uF and 22uF on the input and .1uF and 10uF on the output. Edit: 1.5A regulator
Mosfet wiring and datasheet:
see attached photo. I also put a 100 Ohm resistor in series from output pin to mosfet gate per Crossroads and others in other posts. http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Components/General/FQP30N06L.pdf
ATmega 328 wiring:http://arduino.cc/en/Main/Standalone
int StartSpeed=0; // you have to experiement to find the magic number.
int StopSpeed=255;//Again experiment ok
const int MotorPin=3;
unsigned long TimeNow;
unsigned long PreviousMillis=0;
long Delay=10; // experiment with the value ok, the lower the value the steeper the gradiend of speed
unsigned long CurrentMillis=millis();
Things I have tried to fix:
1. 0.1uF capacitor in series with the flyback diode
2. switching regulator
3. changing output pins
4. changing ATmega 328
5. changing code to non-PWM using just digital write high
6. Swapping out motor
7. swapping LED and current limiting resistor for motor
8. using same code, same power, and same ATmega 328 plugged into the Arduino
This is what puzzles me most because I assumed that I had damaged the two ATmega 328's that I am using, but this tells me that they aren't damaged.
Any suggestions are greatly appreciated. Thanks in advance.