Since a while, I’m trying as I can to reduce the power consumption of my Arduino based system. Remember, I wrote a post about optimizing Arduino consumption few months ago.
In this post I will explain how to use the Arduino internal quartz reducing significativelly the power consumption and making system last longer with 2 LR6 batteries.
Using the internal clock instead of a 16mhz resonator helps my system to last longer on batteries : from 17 days to 3 or 4 months
The bootlaoder to use internal clock
First we have to load the right bootloader to the Atmega. To set up the bootloader I use a classical Arduino UNO: Here is how to wire a Atmega and the Arduino uno to load the new bootloader (see http://www.homautomation.org/2014/03/06/running-atmega328-in-a-standalone-mode-without-arduino-shield/)
Then you have to well configure your Arduino IDE:
- Download the bootloader (8 MHz internal clock) HERE.
- Go to your Arduino Folder (I’m using MacOS, the path is /Users/doume/Documents/Arduino)
- Create a folder named hardware and Breadboard in it (/Users/doume/Documents/Arduino/hardware/Breadboard)
- Unzip the bootloader and put the boards.txt file in the previous folder (/Users/doume/Documents/Arduino/hardware/Breadboard/boards.txt)
- Now connect your Arduino to the USB port
- Launch Arduino application
- And load ArduinoISP sample (File > Sample > Arduino ISP)
- Load it to the Arduino Uno
- Now its time to load the bootloader to the connected Atmega:
- Choose the right Board (Tools>Boards>ATmega328…)
- Select Arduino as ISP as programmer (Tools >Programmer>Arduino as ISP)
- Burn the bootloader (Tools>Burn bootloader)
This can take some so just wait…
Programming your bootloaded Atmega
Now wire your Atmega to the Arduino Uno board following this schema
Remember to remove the Atmega on the Arduino Uno board.
Finished – you can now program this Atmega as you did usually – just put back Arduino environnement parameters to default expect the board configuration (keep internal clock settings).
My first try is to measure the power consumption of a simple system (using Blink sample):
- Atmega standalone with an 16mhz external resonator at 5V
- Atmega standalone using internal clock at 5V
- Atmega standalone using internal clock at 3V
Here are the results:
|Led Off||Led On|
|5v – 16mhz||18.4mA||22.8mA|
|5v – internal 8mhz||8.2mA||11.8mA|
|3v – internal 8mhz||2.9mA||4mA|
The winner is just obvious!
Next – A more complex system
In a previous post I explain how to make a connected temperature/humidity sensor: http://www.homautomation.org/2014/09/26/internet-of-things-measure-environnement-data-with-arduino-and-push-it-to-the-web-via-raspberry-pi-and-nrf24l01/
The Atmega part of this consume about 2mA while waiting and 8mA while sending: so the average consumption is about 2mA (I send data each 30 minutes) – Using 2 LR6 AA batteries (0.8A/hour) it lasts around 17days.
I did the same system with the internal clock and I get 0.4mA while waiting and 7mA while sending. So an average of 0.42mA. This one lasts at least 90 days with same batteries.
I’ve tested some code coming from this page. And I was able to drop the current to 0.05mA on a simple Atmega. So more work is needed probably on the code side…