Micro-Ampere Engineering: Low Power CPU Sleep
Running an Arduino on a 9V battery normally kills the battery in 48 hours because the 16MHz processor is literally running at a million miles an hour even when it does absolutely nothing. The Low Power Library for Arduino C33 forces the programmer to abandon the delay() function entirely, replacing it with massive, complex ATmega register-level "Sleep States" that plummet electrical consumption down to fractions of a Micro-Amp!

The Sleep Routine (Avr/Sleep.h & LowPower.h)
To create a battery-powered device that lasts for 2 years on two AA batteries, you must plunge the processor into SLEEP_MODE_PWR_DOWN.
- The Architecture Trap: When you put an Arduino to "Sleep," it literally dies. It stops executing code entirely!
- Standard
millis()timers will freeze because the timer hardware is shut down to save power! - The LowPower Execution:
#include <LowPower.h>
void loop() {
readSensorAndSaveToSDCard();
// Violently shut down the entire CPU for exactly 8 Seconds!
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// Code resumes EXACTLY here 8 seconds later!
}
- By shutting down the Analog-to-Digital Converter (
ADC_OFF) and the Brown-Out Detector (BOD_OFF), the Arduino drops from50,000 uAto an unbelievable8 uA!
Waking via Hardware Interrupts
Sometimes 8 seconds is too long. If someone presses a button or an alarm triggers, the CPU must wake up instantly from deep comma!
- You must use
attachInterrupt(0, wakeUpCore, LOW). - When the CPU is deeply asleep, it listens purely to Pin 2 physically.
- If Pin 2 is grounded (Button pushed), the processor physically snaps awake in a nanosecond, runs the
wakeUpCoreinterrupt, and resumes executing the mainloop()!
Power Optimization Core Kit
- Arduino Pro Mini or C33 (Do NOT use an Uno or Mega! They have massive, terrible 5V linear regulators that draw 20mA of power constantly, completely ruining the sleep function. A Pro Mini has almost no extra parts!).
- LowPower.h Library (A brilliant simplification of the agonizingly complex native
avr/sleep.hregisters). - A generic Multi-meter capable of measuring single-digit MicroAmps
(uA). - Coin Cell CR2032 or Dual AA Battery Pack.