Go Down

Topic: Protecting the Atmega or auto shut down (Read 1 time) previous topic - next topic


Thank you both for the replies.

I really doubt it's the code. I'll try a few tests with various power supplies and if I don't find the problem, I'll post the code.

@tim7: Yes, once the problem appears the sketch won't run after resets or after turning the unit off and on. I am using Atmega8-16PU chips with the single sided Arduino board. It does not even run the code and it does not seem to get past the bootloader. I am uploading the standard bootloader before I burn the sketch trough the serial port. Should I try uploading without the bootloader with a parallel programmer? 

Yes, the units run on batteries.

This happens only after the unit is left continuously ON for more than 10-12 hours or a few days. If I swap the Atmega with a fresh one or upload the sketch again, it works as it should. Now I remembered that I never tried the fresh chip with the old batteries. The users would change them thinking the batteries are the problem and send the units back with the new ones.

I will try to do 2 tests. One with a battery and one with a power supply that keeps the voltage constant throughout the test. 

I don't know what the brown-out protection is. 


I forgot to mention that when I burn the sketch again, I burn the bootloader again, too.


If the end user can't reflash the chip themselves why not just get rid of the bootloader all together?

If your board runs fine for days at a time plugged into mains power no problem then the brownout settings sounds like a good call to me.  I'm definitely going to have to reprogram my own project with that fuse :p


The brown-out detector (BOD) engages the microcontroller reset whenever the power supply falls below a pre-set voltage level, stoping it from running when there is insufficient power for it to operate reliably.  If the BOD is not set, then there is potential for CPU instructions to become corrupted mid-execution, with unpredictable results.  The BOD is set by the "extended" fuse byte, and if you're using the Arduino IDE this value can be found in the hardware/arduino/boards.txt file.

For example, the UNO board runs at 5V and 16MHz.  By default the BOD is set to 2.7V, but in theory 3.8V is needed to operate reliably at 16MHz.  To be more conservative one would increase the BOD threshold to the next value up, which is 4.3V.

My own experience with the ATmega328 chips is that they run fine at 2.7V and 16MHz, but it may depend on what you're doing with them.  Are you using a standard Arduino board, or something specially designed?  Is there anything connected which draws a lot of power, and is there sufficient capacitance on the power supply to smooth out any glitches?

Coding Badly

It's a sort of ballistic chronograph for slowish projectiles, not bullets


I am looking for a way to stop everything after let's say 2 minutes of not being used

$7 and some of your time will solve the problem.  Pick the one that best matches the battery voltage...


Go Up