Electrical – NodeMCU / ESP8266 – Light Sleep Wakeup via SIM808 RI (Falling Interrupt)

esp8266interrupts

I have a NodeMCU v1.0 and a SIM808 Circuit board. To save power I put the NodeMCU into Lightsleep via:

wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // set sleep type, the above posters wifi_set_sleep_type() didnt seem to work for me although it did let me compile and upload with no errors 

gpio_pin_wakeup_enable(CONFIG_GSM_RING_PIN, GPIO_PIN_INTR_LOLEVEL); // GPIO_ID_PIN(2) corresponds to GPIO2 on ESP8266-01 , GPIO_PIN_INTR_LOLEVEL for a logic low, can also do other interrupts, see gpio.h above

wifi_fpm_open(); // Enables force sleep
wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time

With that code the NodeMCU wakes up when the RI goes from HIGH to LOW to HIGH again, which would be OK for SMS, but for calls it mean the Node wakes up when the call is already gone.
So the idea was to use GPIO_PIN_INTR_ANYEDGE / GPIO_PIN_INTR_NEGEDGE as interrupt condition. But the Node seem not to support that.

Any ideas how to solve that?

enter image description here

Best Answer

Invert the RI signal of the SIM808 so you will have a rising edge at the ESP8266's pin when RI goes low. You can use a couple of resistors and a NMOSFET.

schematic

simulate this circuit – Schematic created using CircuitLab

When RI is high the WAKEUP pin will be on ground, if RI goes high then WAKEUP will be pulled up to VCC through R2. Here is a simulation, you can click on the left "L/H" to switch the input level.