ESP8266 Support WIKI

User Tools

Site Tools


esp8266_power_usage

Table of Contents


This comes from an Espressif datasheet which is on Google Docs here
Smart Connectivity Platform: ESP8266.
The Olimex product sescription gives an insight too Olimex Products: MOD-WIFI-ESP8266-DEV.

Sleeping the ESP8266

ESP8266 Electrical characteristics

Section 7.1 of this Espressif datasheet provides data on current consumption. These data are based on 3.3V supply, and 25C ambient, using internal regulators. Measurements are done at antenna port without SAW filter. All the transmitter’s measurements are based on 90% duty cycle, continuous transmit mode.

Mode Min Typ Max Unit
Transmit 802.11b, CCK 1Mbps, POUT=+19.5dBm 215 mA
Transmit 802.11b, CCK 11Mbps, POUT=+18.5dBm 197 mA
Transmit 802.11g, OFDM 54Mbps, POUT =+16dBm 145 mA
Transmit 802.11n, MCS7, POUT=+14dBm 135 mA
Receive 802.11b, packet length=1024 byte, -80dBm 60 mA
Receive 802.11g, packet length=1024 byte, -70dBm 60 mA
Receive 802.11n, packet length=1024 byte, -65dBm 62 mA
Standby 0.9 mA
Deep sleep 10 µA
Power save mode DTIM 1 1.2 mA
Power save mode DTIM 3 0.86 mA
Total shutdown 0.5 µA

In deep sleep mode, the ESP8266 maintains its RTC but shuts everything else off to hit about 60 µA. Respectable, if not MSP430 levels. It can pull upwards of 200mA while it’s transmitting, and I usually measure an average of about 75mA in normal operation. In deep-sleep mode I can get the ESP8266 Thing down to about 77µA.

Deep Sleep Mode

There is a modification to be made – both in hardware and software – to get current consumption low. On the firmware end, the Espressif SDK has made a systemdeepsleep([uint32t timein_us]) function available, which puts the ESP8266 to sleep for a specified number of microseconds. When it wakes up, it begins running the user program from the very beginning. If you’re using the ESP8266 Arduino IDE, they’ve wrapped that function and another into a very nice ESP.deepSleep([microseconds], [mode]) function. Here’s a quick example Arduino sketch for the ESP8266 that blinks the on-board LED 10 times, sleeps for 60 seconds, then repeats.

#include <Ticker.h>     // Ticker can periodically call a function
Ticker blinker;         // Ticker object called blinker.
int ledPin = 5;         // LED is attached to ESP8266 pin 5.
uint8_t ledStatus = 0;  // Flag to keep track of LED on/off status
int counter = 0;        // Count how many times we've blinked
void setup() 
{
  pinMode(ledPin, OUTPUT);      // Set LED pin (5) as an output  
  blinker.attach(0.25, blink);  // Ticker on blink function, call every 250ms
}
void loop() 
{
}
void blink()
{
  if (ledStatus)
    digitalWrite(ledPin, HIGH);   
  else  
    digitalWrite(ledPin, LOW);
    
  ledStatus = (ledStatus + 1) % 2;             // Flip ledStatus  

  if (counter++ > 20)                          // If we've blinked 20 times 
    ESP.deepSleep(60000000, WAKE_RF_DEFAULT);  // Sleep for 60 seconds    
}

To wake itself up, the ESP8266 uses the XPD pin to trigger its reset line so those two pins need to be connected together. XPDDCDC connects to EXTRSTB with 0R
Wiring up XPD to DTR works. ( Note there is a small capacitor between them on Sparkfuns Thing board on the DTR line)

More data from expressif

6.system_deep_sleep

Function:
Configures chip for deep-sleep mode. When the device is in deep-sleep, it automatically wakes up periodically; the period is configurable. Upon waking up, the device boots up from userinit.
Prototype:
void system
deepsleep(uint32 timeinus)
Parameters:
uint32 time
inus : during the time (us) device is in deep-sleep
Return:
null
Note:
Hardware has to support deep-sleep wake up (XPD
DCDC connects to EXTRSTB with 0R).
system
deep_sleep(0): there is no wake up timer; in order to wakeup, connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST

7.system_deep_sleep_set_option

Function:

Call this API before system_deep_sleep to set what the chip will do when deep-sleep wake up.\\

Prototype:

bool system_deep_sleep_set_option(uint8 option)\\

Parameter:

uint8 option : //

deepsleepsetoption(0): Radio calibration after deep-sleep wake up depends on init data byte 108.
deep
sleepsetoption(1): Radio calibration is done after deep-sleep wake up; this increases the current consumption.
deepsleepsetoption(2): No radio calibration after deep-sleep wake up; this reduces the current consumption.
deep
sleepsetoption(4): Disable RF after deep-sleep wake up, just like modem sleep; this has the least current consumption; the device is not able to transmit or receive data after wake up.
Note:

Init data refers esp_init_data_default.bin.\\

Return:
true : succeed…….. false : fail

esp8266_power_usage.txt · Last modified: 2016/07/05 18:38 by tumik

Page Tools