Close

Power Consumption

A project log for Breaduino

Something to keep you busy for a couple of hours!

agpcooperagp.cooper 01/29/2018 at 00:342 Comments

Power Consumption

While searching the Internet for the auto-reboot solution, I came across a lot of low power Arduino projects. Given "coin battery" projects are the favour of the month, I though I would test the power consumption of the breadrino using the clock divide settiling.

Here is the test code:

/* Clock divide power consumption test */
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  int i;

  // Signal start of loop
  cli();
  CLKPR=0x80;
  CLKPR=0;
  sei();
  digitalWrite(LED_BUILTIN,HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN,LOW);
  
  // Loop through Clock divides (1/1 to 1/256)
  for (i=0;i<=7;i++) {
    cli();
    CLKPR=0x80;
    CLKPR=i;
    sei();
    delay(8192>>i); // Enough time for the multimeter to settle
  }
}

Pretty simple, flash the builtin LED to signal the beginning of a loop and then progressively lower the clock speed. Hold the clock spped for about 8 seconds to allow the multimeter to settle.

Here are the results:

It looks like 1 MHz is a sweet spot for low power consumption using a 16 MHz crystal and no other power saving options.

Note: with a commerical Arduino board you probably have a power LED burning 5-10 mA on top of these reading (no wonder some people remove the power LED).

Slowing down the clock has other consequences. Off the top of my head: millis(), delay(), delayMicroseconds(), micros(), Serial, SPI, tone(), servo() etc. and any other timing related code will need to be adjusted. You can always adjust the code by going back to full clock speed for those sections of code.

However, there is generic board information and bootloader hex files available for 1 MHz operation on the Internet. Worth having a look!

Magic

Discussions

agp.cooper wrote 01/29/2018 at 08:09 point

Yes, very likely in the "boards.txt" you can change the CPU frequency and most things should work. But I have not tried as of yet. I found a custom bootloader (hex) and board definition for 1 MHz, so that should be interesting. I intend to have a look at this but it requires quite a bit of in-depth understanding of the ATMega and Arduino internals which will take time. I have some other projects to finish first, this was a bit of a distraction.
Really I was just interested if it would work as most of the blogs I looked at were about various sleep modes and they (appeared to) skipped this.
I want to look at low voltage (1.8v!) operation as well.
---
When you post a review on eBay you are forced to make a comment and "magic" was my favourite. Modern electronics and the Internet are "magic" compared to 20 years ago!
AlanX

  Are you sure? yes | no

Ted Yapo wrote 01/29/2018 at 01:44 point

Tell me about the Magic at the bottom of these logs...

Also, there are #defines for the clock frequency in some file or another, IIRC.  You can change them there, and the standard timing functions should work as normal.

  Are you sure? yes | no