Running Atmega 328P without external quartz

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/)

loader

 

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)Capture d’écran 2014-11-27 à 18.43.51
  • Load it to the Arduino Uno
  • Now its time to load the bootloader to the connected Atmega:
  • Choose the right Board (Tools>Boards>ATmega328…)
  • Capture d’écran 2014-11-27 à 18.46.24 Select Arduino as ISP as programmer (Tools >Programmer>Arduino as ISP)

Capture d’écran 2014-11-27 à 18.49.14

  • Burn the bootloader (Tools>Burn bootloader)

Capture d’écran 2014-11-27 à 18.50.14

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.

programmingFinished – 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).

 

Power performances

My first try is to measure the power consumption of a simple system (using Blink sample):

  1. Atmega standalone with an 16mhz external resonator at 5V
  2. Atmega standalone using internal clock at 5V
  3. 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.

16

 

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.

8

 

 

Next Step

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…

Sources:

http://www.gammon.com.au/forum/?id=11497

http://www.instructables.com/id/Atmega-Standalone-Running-without-crystal-oscillat/?ALLSTEPS

11 Comments

  1. Hello,

    Thank you for this tutorial. I’ll try it as soon as possible, because I need to save power for one of my projects.

    Just a question : on your final pictures, we can see capacitors, resistors and diods. But we agree on the fact this is just a usage sample ? I mean, after burn the bootload and transfer a program, no other component than the Atmega is required right ?

    (for instance, the “blink” program, you just need 3V-power supply, atmega, resistor and led, nothing else) ?

    Thank you.

    Reply
  2. It almost worked directly !

    In fact, the ATMega328P-PU I have is already “arduino-bootload-burnt” but to work with a 16 MHz oscillator. So, the burn you described was not able to work … until I read this other (french) blog : http://thepolyscope.com/fr/graver-un-bootloader-sur-atmega328p-pu-avec-un-arduino-uno-et-sans-cristal/

    There is a tip I followed : temporary plug a 16 MHz oscillator between the ATMega pin 9 and 10.

    It worked for me and I would like to share this tip with you (and your readers) 🙂

    Reply
  3. hi,
    I am using atmega328p-pu chip, i follow the instruction exactly but i come out with an error,can you guide me how to solve this?
    The error is as show, below:
    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.

    Reply

Leave a Comment.