A few days ago I received a special request. It was about a circuit running on an ATmega328 that was supposed to replace and improve upon an circuit based on the much older ATmega8. One of the requirements for the older circuit was an as low as possible power consumption. Now while the 328 is nowhere near a power hog as the whole Arduino board is it still has a respectable power draw, especially when you want to run it off a battery for extended periods of time.
The power consumption of the microcontroller is determined in part by 2 main things.
One is the number of computations it has to do to achieve its objective. To reduce this we can design our code smartly to not have to process too much stuff but there’s a hard limit on this and that’s given by the algorithmic objectives for the microcontroller. Let’s say if we are pooling a temperature sensor and we didn’t expect much variation regarding the results we can always pool the data less frequently and have the processor sleep for more time. More time sleeping is less time using up our precious milliwatts.
The second factor important to power consumption is tied to how the ATmega is setup. Every microcontroller needs power and an clock signal to run. These can have a range of values but the most common ones are : 5V or 3.3V for power and 16 Mhz or 8 Mhz for clock. This gives us 4 combinations:
Option A : The microcontroller can be configured to run with an external 16mhz clock using 5V (this is how the UNO board is set up).
Option B : The microcontroller can use the same 5V and an 8mhz clock. To make things more interesting the ATmega has a internal 8mhz clock so that should cut power usage a bit more.
Option C: 16Mhz clock on a 3.3V power supply sadly this is outside the stable operating envelope of the chip.
Option D: 8Mhz clock on a 3.3V power supply.
Speaking about the envelope at witch the microcontroller can work , the chip is rated up to 20mhz and nothing is stopping you from running all the way down to 1 Mhz , but above I just outlined the most common configurations and you can find bootloaders to setup the chip like this online, but more about that later…