Saturday, March 5, 2011

Power consumption

Instead of trying to get long transmission lengths, panStamps have been specially designed to consume low currents and sleep during periods of inactivity. For the current test, one of the stamps has been programmed to send a message, then sleep for 8 seconds, then wake up and send a message again; all this in a cyclic manner. The result is more than good: 5 uA during sleep (8 sec) and 2.5 mA at the moment of transmitting (0.15 sec approx).

Video showing packet reception (console on the right) on panStamp A and packet transmission (current meter on the left) from panStamp B.

Atmega's watchdog is used to periodically wake up the microcontroller from Power-Down state, the lowest power mode available on the Atmegas. Enabling the watchdog is actually adding some additional microamps to the bill; if we wanted to still reduce the current consumption, we could use Timer 2 instead of the watchdog, with an external 32.768 Khz crystal connected to the TOSC pins. According to the datasheet, we could switch from 5 uA to around 1 uA in Power-Save mode using Timer 2!

Arduino code used to put the panStamp in sleep mode:

/**
 * sleepFor
 *
 * Put panStamp into Power-down state during "time".
 * This function uses the internal watchdog timer in order to exit (interrupt)
 * from the power-down state
 *
 * 'time'    Sleeping time:
 *  WDTO_15MS  = 15 ms
 *  WDTO_30MS  = 30 ms
 *  WDTO_60MS  = 60 ms
 *  WDTO_120MS  = 120 ms
 *  WDTO_250MS  = 250 ms
 *  WDTO_500MS  = 500 ms
 *  WDTO_1S = 1 s
 *  WDTO_2S = 2 s
 *  WDTO_4S = 4 s
 *  WDTO_8S = 8 s
 */
void PANSTAMP::sleepFor(byte time)
{   
  // Power-down CC1101
  cc1101.setPowerDownState();

  // Power-down panStamp
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  setup_watchdog(time);
  delayMicroseconds(10);
  // Disable ADC
  ADCSRA &= ~(1 << ADEN);
  // Unpower functions
  PRR = 0xFF;
  // Enter sleep mode
  sleep_mode();

  // ZZZZZZZZ...

  // Exit from sleep
  sleep_disable();
  wdt_disable();
  // Re-enable functions
  power_all_enable();
  // Enable ADC
  ADCSRA |= (1 << ADEN);
  // Reset CC1101
  cc1101.reset();
}


It's obvious that only battery-operated applications are interested in achieving so low consumptions. As an example, I've calculated the expected autonomy of the above application (WDT enabled) when powering the board from a couple of 1.5 AA batteries. The nominal charge of an AA battery (1.5 V) is around 2500 mA. If we connect the batteries directly to the panStamp, the panStamp will work only whilst the batteries are able to provide 2.7 V or more. This means that only a fraction of the charge – let's say 50% of the nominal charge - will be used for powering the boards. The rest will remain into the batteries. OK, so let's assume we have 1250 mAh of charge. With all those mAh available, we'll get the following numbers:

The panStamp sleeps (5 uA) during 8 sec → 98.33% of an hour
The panStamp transmits (2.5 mA) during 0.15 sec → 1.67% of an hour

The above percentages give us 0.0466 mAh, that means more than 3 years of autonomy when powering the board directly from the couple of AA batteries. All this with the watchdog enabled and powering the boards without an intermediate step-up regulator capable to drain the batteries below 2.7 V.

1 comment:

  1. The result is more than good: 5 uA during sleep (8 sec) and 2.5 mA at the moment of transmitting (0.15 sec approx).speech recognition software

    ReplyDelete