ATMega168 resetting when AVRISP2 connected

I'm trying to make a small robot arm with a few 9g micro servos and I'm not a debugging expert, but with flashing leds I've deduced that my chip keeps resetting all the time. When I unplug my programmer header, the resetting stops and everything works fine.

Is this a common, easily solvable problem, or will I just have to plug the header in and out all the time..?

It’s a bit modified version

It’s a bit modified version from this:

http://img217.imageshack.us/img217/113/atmega168.png

Ehm, the programmer is wired exactly like that (pin5 to reset and that’s it), but I’ve got only one power supply (3AA battery holder) and no 5v regulator.

I’ve read somewhere that low battery might sometimes drive the motors ok, but reset the chip on the power usage spikes - is that true? I’ve got both capacitors on just like in the schematic - could the resets be caused by power issues even then?

Only thing - if it’s so, why

Only thing - if it’s so, why does it go away when programmer is plugged out?

You should use a pullup

You should use a pullup resistor for the reset pin (10kOhm between Reset and VCC).

Hmm, funny it wasn’t

Hmm, funny it wasn’t mentioned in that schematic.

Ok, so I googled it, and sort of got it. Hope it helps, thanks guys :wink: