ATMega168 stops working


This is the secound time I experienced the crash of my pololu 3pi.
It was both times the same way: (after the first crash I replaced the AtMega168 and everything worked just fine again)

After programming 3pi refuses to execute its uploaded program as well as it refuses to be reprogrammed.
When I try to upload the programm I only get this from avr-dude:

I use a single lipo-cell to power my pololu. I tell u this because u mentioned in other threats that the problem can be due to low battery voltage.
Other to that I experienced, that the lipo works just fine powering the pololu.
(The configuration with the stepup voltage regulator is fine with 3V as well as with 4,5V isn’t it?)

I wonder what the real problem with this crashes might be?
Wouldn’t it be sufficent to add a bigger capacitor to the Vcc line in order to stabilize the voltage better?

Please help me with this.
I figure this is a real problem with the 3pi (wich is a realy great robot) wich should be solveable?!


There are several reasons why we recommend against using a LiPo battery to power your 3pi. The lower voltage requires more current through all of the power components, which will more quickly discharge your battery and lead to a more abrupt drop in voltage as the battery discharges (discharge curves often have a sharp drop at the end under constant resistance or constant current conditions; the 3pi’s boost regulator draws more current as voltage goes down, which makes this drop even more sudden). There are also MOSFETs in the power path prior to the boost voltage regulator that won’t be as well turned on at lower voltages.

The 3pi gives you direct access to the ATmega168 microcontroller via its programming lines, and the mega168 can get corrupted if it loses power during programming. That’s why it’s important you avoid programming the 3pi when its batteries are low, since low batteries increase the chances that power will cut out unexpectedly.

Are you using our Orangutan USB programmer? This programmer tries to detect when power is lost and abort programming, but unfortunately, the very act of putting voltage on the programming lines can put enough voltage on the Vcc lines to keep the programmer from detecting that the voltage is unacceptably low for programming.

We are working on a second-generation AVR programmer that can more accurately and quickly detect when the target voltage is unstable or too low, which should better prevent (if not completely prevent) situations like this.

If the corruption changed the 3pi’s clock to a lower frequency, you might still be able to talk to it (and reprogram the fuses) if you lower the programmer’s ISP frequency. If this doesn’t work, you will probably need to replace the microcontroller again.

- Ben


In my case the Lipos ware the only possible choice because Iam developing a little soccer plattform on the basis of 3pi.
When you use a lipo you dont have to always remove the adapter platine if you want to charge the AAA-cells (I really didnt want to load the 4 cells in series via the charger pins -> ballancing problems and due to this under or overcharge)
On the adapterplatine for the platform is a nice little which can load the Lipo-cell from an USB port.
Thus you can load many soccerbots from just one USB Hub.

Which ones would that be? And wich problems could it cause?

I was using your Orangutan Programmer when this happended.

cooling thing!

What about powering the AtMega168 by the USB power during programming?
Wouldn’t that be a simpler solution? Or could this kill the boost regulator or something?

Do you know how to lower the ISP frequency when working with AVR dude and your Orangutan Programmer?

Thanks so far!


There is a reverse-battery protection MOSFET, and there are some in the pushbutton power switch circuit. The better turned on a MOSFET is, the lower its resistance (and the voltage drop across it). Operating off of a LiPO means that these MOSFETs have higher on resistances than if you used four AAA cells, which will ultimately probably cause your battery to drain slightly faster.

Powering the ATmega168 off of USB could lead to a number of problems. For example, if the user plugged the programmer into a system that was already powered off of a voltage that was different from the USB voltage would produce a short that could damage the system, programmer, or USB port.

I don’t know if avrdude supports changing the ISP frequency. Can you find a Windows computer to install AVR Studio on? Don’t forget to change your programmer frequency back to a higher speed after you test it at the lowest frequency since the lowest available frequency is too slow to program with (you can use the lowest speed to set fuses, perform a chip erase, and read the device ID, though).

- Ben

Can you tell me wich MOSFETs you used? I would like to have a look at the characteristic diagram of the MOSFETs to be able to calculate the voltage drop in the powerline.

I see the problems with the programmer.

Ok I will try it with a windows pc. Thanks.

My work around for the powerloss-during-programming-problem is to charge the lipoly while programming. this ensures enough power for the µC.
Since I used this “method” there was no problem with programming.



The MOSFETs are Fairchild FDMA291P or similar. It might be difficult to measure Vgs on them, so you might be better off measuring the drop from the battery to the nodes labeled Vbat on the PCB.

- Jan