This is confusing the heck out of me. I followed the instructions in http://arduino.cc/en/Tutorial/ArduinoToBreadboard and got a bare ATmega328P chip working on a breadboard. I'm using the 8MHz internal oscillator minimal bootloader from that page. I successfully uploaded a sketch to the chip that makes it sleep until woken by an external interrupt. It works great, except that I'm trying to reduce power usage to the microamp level, and for some reason even in SLEEP_MODE_PWR_DOWN the chip consumes 20mA! When woken up, it consumes 30mA. I'm powering it directly from an FTDI cable, so there's no regulator or anything to drain power while the chip is asleep. I have my multimeter in series between VCC on the FTDI cable pin 8 (VCC) on the chip. Any idea what could be going on?
Solved this myself. Apparently just having the FTDI cable connected adds 20mA to the total current usage. When I power from a battery, sleep mode uses 870uA. Much better, although this chip is supposedly capable of 1uA. Here's my sleep code if anyone has any suggestions:
void loop ()
{
//select which sleep mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
//allow sleep to happen when called
sleep_enable();
ADCSRA &= ~(1<<ADEN); //Disable ADC, saves ~230uA
//go to sleep
sleep_mode();
ADCSRA |= (1<<ADEN); //Enable ADC
//woken up, so disable sleep possibility
sleep_disable();
}
Thanks guys! Jack, your code worked perfectly. I also realized that my Adafruit HT16K33 LED backpack consumes a little power even when no LEDs are on, so figuring that out plus using your code got me down to between 0-10uA (my multimeter only has 10uA precision). That's exactly what I was looking for, so thank you.
If anyone else is searching for how to make the HT16K33 sleep (aka standby mode), you have to use this code:
Wire.beginTransmission(0x70); // access the device using its i2c address of 0x70
Wire.write(0x20); // set it to standby mode by accessing the 0x20 register
Wire.endTransmission(); // end transmission
To wake it up again, use the same code except substitute 0x21 instead of 0x20.
osmithy:
so figuring that out plus using your code got me down to between 0-10uA (my multimeter only has 10uA precision). That's exactly what I was looking for, so thank you.
You need to get yourself an EEVBlog micro-current meter!
Adafruit used to sell these. I think Dave is between runs, they seem to be out.
Hahahaha true on both counts!! The current got low enough for my purposes, but I totally put my name and email down to be notified when Adafruit gets them back in stock. That thing looks SWEET.