- Keep ESP8266 on OFF mode as default
- External 3.3V signal (can be short or long) arrives and turns ON ESP8266
- ESP8266 wakes up and keeps itself awake until a task is perfomed
- Send MQTT data to server
- Put ESP8266 back to power OFF state
- ESP8266 is in OFF state, GPIO0 is low
- 3.3V signal arrives externally, GPIO0 and CH_PD are high, turn ON ESP8266
- First thing ESP8266 does is turns GPIO0 to high, which means CH_PD remain high. So ESP8266 remains ON until GPIO0 is high
- GPIO12 is used to read value of external interupt
- If there is 3.3V external interrupt, GPIO is high and a MQTT message is sent as “Signal Received” or “ON” and keep ESP8266 ON until 0V signal is received.
- If there is 0V external interrupt, GPIO0 goes low and MQTT message is sent as “Signal Vanished” or “OFF” and turns OFF ESP8266
Source code for this idea can be found on my GitHub https://github.com/debsahu/ESP_External_Interrupt/
This circuit diagram has been derived from here.