Change MCU input voltage while running.

Hi,

I'm working in a low-power application and I like to implement some of the power saving techniques presented by Nick Gammon here, which include running the Atmega328 at lower voltages. Therefore I plant to power the Atmega328 runing at 8MHz directly from a Li-Ion battery (2.5 to 4.2v) with no voltage regulator. But, eventually I'll need to read voltages on the analog pins (which will requiere a fix voltage reference) or communicate to other components at 3.3 or 5v.

Now my question: Does something bad happens if I'm running the MCU at let's say 2.8v and suddenly, while still running I switch to a 5v power source, do the voltage readings/comms and then go back to 2.8v??

Now my question: Does something bad happens if I’m running the MCU at let’s say 2.8v and suddenly, while still running I switch to a 5v power source, do the voltage readings/comms and then go back to 2.8v??

In general there should be no problems as long as any electronics that interface with the chip are not messed-up at different operating voltages.

And, a “sudden” change could noise on the power supply and a glitch.

But, eventually I’ll need to read voltages on the analog pins (which will requiere a fix voltage reference) or communicate to other components at 3.3 or 5v.

Just make sure your analog voltage and reference voltages don’t exceed the supply voltage.

crada:
. . . eventually I'll need to read voltages on the analog pins (which will require a fix voltage reference) or communicate to other components at 3.3 or 5v.

If it's just a matter of needing a fixed voltage reference, consider using the internal 1.1 V reference which is nominally independent of the microcontroller's input voltage: analogReference() - Arduino Reference

If you need to communicate with peripherals running at different voltage levels then logic level converters may be an appropriate solution: https://www.sparkfun.com/products/12009

Thanks MrMark, those are great suggestions!

crada:
Now my question: Does something bad happens if I'm running the MCU at let's say 2.8v and suddenly, while still running I switch to a 5v power source, do the voltage readings/comms and then go back to 2.8v??

You should play safe and use a gradual switchover(*). The ADC unit will probably need clearing out with a couple
of conversions.

(*) You should normally do this anyway as high currents will flow into decoupling capacitors if
switched hard, these high currents could induce noise into other signals and corrupt them.

A FET with a deliberately large gate resistor will switch gradually.