Saturday 21 May 2016

Part 2 - Configuring an Arduino Nano for Ultra Low Power Operation

Configuring an Arduino Nano for Ultra Low Power Operation

The Arduino Nano is good, low cost microprocessor for simple jobs.
With small modifications to the standard Arduino Nano, and with the appropriate software design, it possible to operate an Arduino Nano for periods approaching one year on a pair of AA alkaline Cells.

Without modification a standard Arduino Nano would probably only last a few weeks on AA batteries.

The physical modifications to reduce the power consumption of the Arduino Nano are as follows:
  • Remove the Power LED labelled PWR in the upper image below.
  • Remove the 5V Linear Regulator shown in the lower image below.
  • Connect 3Vdc power to the connections labelled 5V and GND in the upper image below.
Note: Operating current is considerably reduced by running at 3Vdc compared to 5Vdc.

Top View and Bottom View of the Arduino Nano



The key software design issues for running an Arduino in Ultra Low Power are as follows:
  • Disable the Analog to digital Converter
  • Disable the Brown-Out detection
  • Use Sleep mode
  • Use the Watch Dog Timer (WDT) to wake the microprocessor, to perform the operation and then return to sleep.
  • The maximum time the WDT can operate is about 8 seconds.


Some example code is provide below, that simply flashes the LED approximately every 8 seconds.
Between the 8 second flashes, the current consumption was measured at approximately 66uA with a 3Vdc supply.  


#include <avr/sleep.h>
#include <avr/wdt.h>
const byte LED = 13;
// watchdog interrupt
ISR(WDT_vect )
{
        wdt_disable();  // disable watchdog
// end of WDT_vect
void setup() { }
void loop()
{
       pinMode(LED, OUTPUT);
       digitalWrite(LED, HIGH);
       delay(50);
       digitalWrite(LED, LOW);
       pinMode(LED, INPUT);

        // disable ADC
        ADCSRA = 0;
        // clear various "reset" flags
        MCUSR = 0;
        // allow changes, disable reset
        WDTCSR = bit( WDCE) | bit( WDE);
        // set interrupt mode and an interval
        //WDTCSR = bit(WDIE) | bit(WDP2) | bit(WDP1);    // set WDIE, and 1 second delay
        WDTCSR = bit( WDIE) | bit( WDP3) | bit( WDP0);    // set WDIE, and 8 seconds delay
        wdt_reset();  // pat the dog
        set_sleep_mode(SLEEP_MODE_PWR_DOWN );
        noInterrupts();           // timed sequence follows
        sleep_enable();
        // turn off brown-out enable in software
        MCUCR = bit( BODS) | bit( BODSE);
        MCUCR = bit( BODS);
        interrupts();             // guarantees next instruction executed
        sleep_cpu();
        // cancel sleep as a precaution
        sleep_disable();
} // end of loop
 

References:
The following website provides good information on running an Arduino using low power techniques.

https://hwstartup.wordpress.com/2013/04/15/how-to-run-an-arduino-clone-on-aa-batteries-for-over-a-year-part-2/



No comments:

Post a Comment