Saving Power with your ATmega
As many projects using an MCU end up running from batteries, it’s nice to have those batteries last as long as possible. There are a numerous different ways of doing this, depending upon your circuit, but there are two that I’ve been reading up on recently: reducing the clock speed of the ATmega, and sending it to sleep. These techniques might even be essential if you’re planning a solar-powered project.
On an Ardunio board, chip timing comes from a 16MHz oscillator; it probably looks like a little rounded rectangular can just north of the ATmega. This makes sure you get good execution and serial programming speeds, but if your project is simple or doesn’t require that speed, it makes sense to reduce the rate at which the chip is running. Fewer cycles per second should mean fewer milliamps required in use.
In my earlier article I wrote about running an ATmega168 at 8MHz using its internal oscillator to reduce parts. But what about dropping down to 1MHz?
Reducing Clock Speeds
Microcontrollers like the ATmega have a set of ‘fuses’ which control various operational parameters of the chip. These persistent values are usually set when you flash a bootloader and they determine the behaviour of your MCU, including whether to use the internal 8MHz oscillator and whether to divide that value by 8 for timing. Set a fuse bit appropriately and your ATmega will be running at 1MHz.