Under voltage protection

Recently, I've made a little PCB that holds the ATmega168 along with the switching circuit LadyAda uses in the MintiBoost.
(MintyBoost - Process documentation)
It runs fine on 2xAA NiMH batteries. (Note, there is no voltage regulator on this board.)

However, I'm concerned about what may happen to the ATmega when the battery and the switcher output falls to low voltage levels.
(I think I may have lost the bootloader on one chip this way.)

I've researched a bit on "low voltage cut outs", and looked at the MAX8211, however, I was wondering if anyone has some thoughts on:

a.) the need to even worry about this
b.) the easiest way to do this if I should worry

I was also wondering that if, when the cut out threshold is reached, I could simply pull the Reset pin low, rather than switching off power completely? This way, I would only protect the ATmega.

Any advice is appreciated.

I was also wondering that if, when the cut out threshold is reached, I could simply pull the Reset pin low, rather than switching off power completely?

This is a very common way of handling the problem.

Mike

check the brownout detection fuse in the ATmega datasheet
it does that exactly

check the brownout detection fuse in the ATmega datasheet
it does that exactly

hi massimo,
am i right that brownout detection is disabled on the atmega shipped with arduinos? if so, is there a reason for it?

best,
kuk

Gentlemen, thank you both for your helpful answers.

I looked at the ATmega datasheet and I now understand that the chip has a BOD that should protect it -assuming that the BODLEVEL 2:0 fuses are set. (Now curious as to what value - 111,110,100 - will check)

I also see that I might be able to check a flag to see if a brown out occurred - MCUSR-BORF.

Since I'm using a 10K pullup on the reset line, the BOD functionality should work (if enabled).
(Now I wonder about those schematics that tie the Reset directly to Vcc.)

All this makes me feel a lot better about using my switcher.

Thanks again!

kuk, (didn't see your post until I finished mine.)
You may be right . . .
http://www.arduino.cc/playground/Learning/Burn168
"Brown-out detection disabled; [BODLEVEL=111]"

If true, is it safe to change that?
From the Reference:
BODLEVEL 110 = a Vbot of 2.7V
BODLEVEL 100 = a Vbot of 4.3V
(BODLEVEL 111 = BOD disabled)

Then I really would feel better :sunglasses:

as far i can tell it's "safe". i enabled BOD on two hands full of atmegas and they're all doing fine running on batteries. still i think there must be a reason not to enable it. i just can't think of one.

I believe the reason it comes disabled by default is that it's possible to run a mega48/88/168 at 1.8 V if your clock speed is 4 MHz or below (which is below the lowest BOD level). If you are running your AVR at 5 V, you should, in my opinion, definitely enable BOD (and my recommendation is to set it to 4.3 V). If your regulated voltage falls too low for too long, your AVR register states can get corrupted and you could end up in some bad/unexpected state without even knowing it. This kind of problem can be very difficult to diagnose and could cause your project to react in dangerous or harmful ways. BOD gives you easily observable feedback that there was a dip on your power line and in general is the safer course to follow.

  • Ben