Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an ATmega328P running at 16 Mhz on CR2032 with a few sensors and radio for about a week now. It started out at 3+ Volts and is currently measuring at 2.96 Volts. At present, I am not using boost regulators to regulate this. I use the low power sleep mode using the jee lib libraries, sleep for a few seconds then wake up for less than a second, take a few readings, transmit and go back to sleep again.

Of late, I noticed that the sleep duration had shrunk by a few orders of magnitude. It seems to sleep for ~50 or so milli-sec, instead of the 5 sec sleep that it used to work at. If I switch to the 2xAA (2.84 Volts), I still get the full 5 sec sleep cycle.

Is this behavior due to the ATmega328P switching back to use the internal 8 MHz instead of the external 16 MHz? Also not sure how the timing/sleep works fine with 2xAA at 2.84 Volts but not with CR2032 at 2.96 Volts?

share|improve this question
Instead of the intended sleep, you might be experiencing a repeating cycle of brownout and reset. Try watching the supply voltage with a scope. – Chris Stratton Aug 8 '14 at 3:51
up vote 1 down vote accepted

A few things. You are most likely measuring the battery at no load. Even if connected and running, a multimeter does not see quick power draws. An oscilloscope is needed for millisecond power draws. Remember, CR2032s are designed for low current long term usage. 250mAh @ a few mA. Your micro and sensors coming out of sleep causes inrush, and the CR2032's high ESR (equivalent series resistance) as causes voltage droop. Do you have a decoupling capacitor in parallel close to the power pins?

And voltage drops won't make the ATmega drop down to a slower speed. That's too advanced a feature for most lowly micros. It will continue to try running at 16MHz, with an unstable clock. Brownouts are likely.

You could run the ATmega at 8MHz for all voltages to avoid the issue, and adjust your delays/timers based on that.

share|improve this answer
Thanks for the info. Yep, Voltages were measured at no load. I did try out a few decoupling capacitors - 1uF, 10uF (couldn't get hold of a 0.1uF) but they didn't change the output behavior. I use the low power nrf24l01+ radio and tmp36 sensor.. and they appear to have very low current needs. Currently ATmega328p-pu is running the Arduino Uno bootloader. Would you happen to know if I use the 8 MHz boot loader I could still use the same ATmega commands that utilize the low power sleep modes (jeelabs.net/pub/docs/jeelib/classSleepy.html)? – user46743 Jul 3 '14 at 18:29
You should, just divide your expected delay times by half then test. (Half the clock, it takes twice as long to count to the same number) – Passerby Jul 3 '14 at 21:20

It looks like you're running the MCU outside the safe operating area with a coin cell. According to the ATmega328P datasheet, page 316, the minimum safe supply voltage for 16MHz is around 3.8V (the red markings are mine). You should expect to see erratic behavior in that case. In practice, you're just overclocking your MCU. See what Russell McMahon has to say about this.

ATmega328P safe operating area

As for the AA vs. coin cell question, it has to do with the fact that AAs have a much higher discharge rates (AAs can deliver a few amps). Coin cells (see a sample datasheet) may deliver up to a few mA for short pulses.

share|improve this answer
Thank you for the info. I did realize it was out of spec for this test but the results appeared to have a pattern unlike the values that I usually get when I lower the voltages further down and force a brown-out. So was trying to figure out if it tries to switch down and operate @ 8 MHz before it throws in the towel. – user46743 Jul 3 '14 at 18:56
Right. As Russel says mockingly in his post (which I linked), by going past the specs, you'll be venturing in unknown territory. As you test the MCU limits, things may seem to work, but you may get erratic behavior when you least expect. By the way, I hope you didn't take offense me linking to Russel's answer, as it's a bit too humorous - but it does illustrate my point well. – Ricardo Jul 3 '14 at 19:19
But no, the ATmega won't change its clock. It would be useful if it did, but it just gives up in unexpected ways. – Ricardo Jul 3 '14 at 19:20
Thanks for the link. No offense, not at all. Concise and clear explanation. The link was pretty funny and informative, as well. I just wish stackexchange had a feature to mark more than one solution as an acceptable answer. – user46743 Jul 3 '14 at 19:23
+1 for the link to Russel's marvelous post. – Spehro Pefhany Jul 3 '14 at 19:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.