
When Push Button is pressed, It pulls CH_PD to HIGH which switches ESP8266 ON. An other GPIO such as GPIO-12 is also connected to CH_PD using a diode in the same way.Using a diode, GPIO is connected to CH_PD pin of ESP8266.GPIO side of Push Button is pulled down using 10 K resistor.Connect one side of Push Button to VCC and other side to a GPIO let's suppose GPIO-4.IT WILL NOT WORK WITH ANY OF DEVELOPMENT BOARDS SUCH AS NODEMCU ETC. NOTE: THIS METHOD WILL ONLY WORK WITH BARE ESP8266 MODEULE. Let's suppose we have a Push Button attached to our Battery Powered ESP8266 and we want to publish it's state to our server which is then proceeded to switch a relay connected to some other ESP8266. But here we'll pull CH_PD pin down using 10 K resistor. Normally Reset, CH_PD, GPIO-0 and GPIO-2 are pulled up using 10 K resistors and GPIO-15 is pulled down the same way. Here, is a workaround, using couple of simple electronic components along with CH_PD, our ESP8266 will respond back to us even during deep sleep. As ESP8266 does not support interrupts during deep sleep, how can We accomplish this task under this particular scenario? Sometimes, We require publishing some sort of output to our server and battery is only option to power our project. It's Deep Sleep function is superb with 60 ♚ current consumption which is suitable in our Battery Powered Projects such as Weather Station, where it is required to take few readings during day or night and send them to the server and rest of time, ESP8266 keep itself under deep sleeps. GPIO2 is directly connected to the Switch, or to a sensor so it can always read the state of the switch or sensor.ESP8266 is very popular among IOT enthusiasts due to it's builtin WiFi capabilities which keep our Fun Gadgets connected together. Normally it draws 215 mA current during data transmission and 0.9 mA are consumed during idle conditions when ESP8266 is not doing anything for us except keeping itself connected to our WiFi network. The ESP8266 does what it needs to do and when it is done the program sets GPUIO0 LOW and the chip powers down.
Esp01 deep sleep software#
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. When the switch closes, the CH_PD pin as well as GPIO0 and GPIO2 are taken HIGH and the ESP8266 powers up. This is according to an idea by ‘barnabybear’.

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. That is not much but it can be brought down even further to 3uA.

In deep sleep the current consumption is about 20uA. 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. This concept will not work though if the switch prematurely is deactivated and the ESP8266 has not finished its job yet.

This seems ideal for the ESP8266-01 that does not have gpio16 broken out and therefore is hard to use in regular deep sleep. 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. A typical example of that is a notifier that mail has been delivered or a door has been opened. 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.
