Very DeepSleep and energy saving on ESP8266 – Part 6: Power DOWN/UP

The easiest way to save power on an ESP8266 is in fact to switch it OFF when not needed and Switch it ON when needed. A typical example of that is a notifier that mail has been delivered or a door has been opened. Opening a mailbox or opening/closing a door activates a Switch that connects the Vcc to 3V3 and the ESP8266 boots up and does its thing. This seems ideal for the ESP8266-01 that does not have gpio16 broken out and therefore is hard to use in regular deep sleep.
This concept will not work though if the switch prematurely is deactivated and the ESP8266 has not finished its job yet. You need some way to keep the ESP running til it’s job is finished and this means it needs to maintain power and thus the regular ‘deep sleep’ seems the only option.

In deep sleep the current consumption is about 20uA. That is not much but it can be brought down even further to 3uA. For this we do not use the regular deep sleep but we will power down the ESP8266 by pulling the CH_PD (=chip power down) pin LOW to Power it down whereas a Switch (or a HIGH output from a sensor) will Power the ESP8266 up and a gpio pin is used to keep it powered up as long as necessary. This is according to an idea by ‘barnabybear’.

The hardware needed looks as follows:


The workings are like this:
When the switch closes, the CH_PD pin as well as GPIO0 and GPIO2 are taken HIGH and the ESP8266 powers up. Once booted, GPIO0 should be set to HIGH in the software so the CH_PD pin remains HIGH, even when the switch is opening again. The ESP8266 does what it needs to do and when it is done the program sets GPUIO0 LOW and the chip powers down. GPIO2 is directly connected to the Switch, or to a sensor so it can always read the state of the switch or sensor.

The program looks like this:

void setup(){
pinMode(0,OUTPUT);
digitalWrite(0,HIGH);
pinMode(2,INPUT); //not necessary, depending what you want to do with it
}
void loop() {
//do stuff
digitalWrite(0,LOW);
ESP.deepsleep(0);//not necessary
}

Strictly speaking the line ESP.deepsleep(0); is not necessary. It is just there to put the ESP in deepsleep in case the switch remains activated.

There is a caveat however. This technique requires the ESP8266 module to NOT already have an onboard pull up resistor for the CH_PD.
The original ESP8266-01 is OK, However, the ESP8266-01S has built in resistors.
Modules without internal pullups: ESP-01, ESP-07, ESP-12E, ESP-12F, ESP-12N Modules with internal pullups: ESP-01S, ESP-07S, ESP-12S.

8 thoughts on “Very DeepSleep and energy saving on ESP8266 – Part 6: Power DOWN/UP”

    1. Evgeny, sorry to hear you have problems. I tried checking your circuit but i only see a thumbnail and in order to see the full picture i need to subscribe to some russian site.
      My first question would be which exact esp8266 you are using? The 01 or 01S?

      1. 1. First aim was solved!
        There is a 92ms delay before deep sleep if you use ESP.deepSleep. You should use ESP.deepSleepInstant function. Correct turn off saves 7uA.
        2. Video about the problem (LOG_OFF in my code): https://www.youtube.com/watch?v=YBlNOr0Uuyg
        01 or 01S – not depends.
        Prepare:
        01s: removed a resistor between EN and Vcc.
        01: removed a power resitor.
        Scheme: https://github.com/dontsovcmc/waterius/blob/master/Board/scheme.png

      2. 1. Good to know
        Indeed the 01s need to have the resistor removed, hence my list of 8266 types to use

  1. ESP.deepsleep(0); You got about 15uA leak. Check deepsleepinstant(0) instead.

  2. If I understand this correctly this means for a timer based application (wake up 4 times a day and post to database via HTTP) I can’t take advantage of the 3uA consumption as the ESP is not running. So I have to make it work at 20uA, right?

    1. Not sure if i fully understand you. It is indeed timer based and runs at 3uA when it is dormant. When it is active say 4 times a day it consumes whatever it needs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.