by

Save Power by Disabling Arduino Peripherals

A relatively easy way to same a few milliamp hours of battery energy is to disable features of the ATmega328 your Arduino project isn’t using. Below are some examples of code you can use in your setup function to do this.

void setup(void) {

// The following saves some extra power by disabling some 
// peripherals I am not using.

// Disable the ADC by setting the ADEN bit (bit 7)  of the
// ADCSRA register to zero.
ADCSRA = ADCSRA & B01111111;

// Disable the analog comparator by setting the ACD bit
// (bit 7) of the ACSR register to one.
ACSR = B10000000;

// Disable digital input buffers on all analog input pins
// by setting bits 0-5 of the DIDR0 register to one.
// Of course, only do this if you are not using the analog 
// inputs for your project.
DIDR0 = DIDR0 | B00111111;
}

For more Arduino power saving tips see these posts:

Low-Power Arduino Using the Watchdog Timer
An Efficient Low-Power Arduino Switching Voltage Regulator
Low-Power XBee Sleep Mode with Arduino and Pin Hibernation

Leave a Reply

Your email address will not be published.