Go Down

Topic: Power consumption and bootloader trouble (Read 103 times) previous topic - next topic


I've been practically banging my head against this for the past week, can't seem to figure it out no matter how much I read and google. Maybe one of you can lend me some insight.

I am prototyping a wireless temperature sensor using a  Moteino. I need to get it working at 1.8V drawing as little current as possible for maximum battery life, since due to physical size constraints I am limited to only using coin cell batteries. I also want to stay within the 328p's safe operating area, which means I need to run at 0-4MHz.

The creator of the Moteino, Felix, has a video demonstrating that the Moteino can run off a coin cell sleeping at ~25uA.

Currently, I have an Arduino Pro Mini (328p 3.3V 8MHz) able to sleep at ~20uA after removing the power LED and the voltage regulator (I set my FTDI to 3V power) using LowPower.h with BOD off and ADC off. If I sleep forever (WDT off) I can hit 16.5uA.

All of the above numbers are just stock, no Oscillator modifications made in any way.

I then used a fuse calculator to select internal 8MHz RC Oscillator, clkdiv8, BOD level 1.8V. At one point I wrote the fuses to enable clkout so I could measure it with an oscilloscope, and confirmed that it was running at 1MHz. So far so good. I then wrote lfuse 0x62, hfuse 0xdc, and efuse 0xfe. This is everything the same as above, just minus the clkout enable.

Code: [Select]

#include <LowPower.h>

#define LED 13

void setup() {


void loop() {
  Blink(LED, 1000);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

void Blink(byte PIN, int DELAY_MS)
pinMode(PIN, OUTPUT);

I uploaded the sketch above using my usbtiny programmer, and only noticed a current savings of 1uA! The device is still somehow only sleeping at 19uA! How can this be when the 'p' in ATmega328p is supposed to mean "pico power"? According to the datasheet, the micro should only use .2uA typical and .5uA max when running at 1MHz using the internal oscillator at 1.8V. I'm seeing 40x what the spec says while sleeping, let alone running.

Anyway, that's part one of my problem. If I can't get it to use less power, fine. It sucks, but it's just a prototype after all. The second problem is with the bootloader I've recompiled for 1 MHz.

I managed to find several good tutorials for recompiling Optiboot for 8 MHz or different baud rates, etc.

I added the following to the Optiboot Makefile in my 1.0.6 IDE because my 1.6 IDE install doesn't seem to have Optiboot:
Code: [Select]

#my first attempt at a 1MHz internal Osc... 9600 baud can't reliably get a sketch uploaded
atmega328_ulp_1mhz: TARGET = atmega328_pro_1MHz
atmega328_ulp_1mhz: CHIP = atmega328
atmega328_ulp_1mhz: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=9600'
atmega328_ulp_1mhz: AVR_FREQ = 1000000L
atmega328_ulp_1mhz:  LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
atmega328_ulp_1mhz: $(PROGRAM)_atmega328_pro_1MHz.hex
atmega328_ulp_1mhz: $(PROGRAM)_atmega328_pro_1MHz.lst

atmega328_ulp_1mhz_isp: atmega328_pro1
atmega328_ulp_1mhz_isp: TARGET = atmega328_pro_1MHz
atmega328_ulp_1mhz_isp: MCU_TARGET = atmega328p
atmega328_ulp_1mhz_isp: HFUSE ?= DC
atmega328_ulp_1mhz_isp: LFUSE ?= 62
atmega328_ulp_1mhz_isp: EFUSE ?= 06
atmega328_ulp_1mhz_isp: isp

...and then used omake to recompile. No sweat.

Then, I moved the bootloader files to my 1.6 IDE and added to my boards.txt file:
Code: [Select]

atmega328_ulp_1mhz.name=ATmega328 Optiboot @ 9600baud w/ 1MHz Int. RC Osc.




I burned my bootloader. Fuses are correct. Clock is ticking at 1 MHz. Great. When I try to upload my sketch using FTDI, no good.
Code: [Select]

avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

However, if I use the programmer to read the device signature, it's correct.

My suspicion? Well of course the programmer gets the right signature, the data is synchronous. I believe that the 1 MHz clock is too unstable for serial comms, so I created another bootloader at 1200 baud to try to minimize bit errors. This bootloader didn't work, it could never get in sync with avrdude.

Does anyone have any similar experiences so I know I'm not alone, or any suggestions as to what I could be overlooking?


which means I need to run at 0-4MHz.
I seriously doubt that 0 MHz is a viable option.


Feb 27, 2015, 06:08 pm Last Edit: Feb 27, 2015, 06:09 pm by bartikus
I seriously doubt that 0 MHz is a viable option.

The 328p can run at 128 kHz on the internal oscillator, so that's technically 0 MHz if we're not using decimals. That's also the notation straight from the datasheet.

Regardless, my goal is 1-4 MHz, with 1 being easily obtainable just by using the internal 8 MHz divided by 8.

Go Up