ESP8266: Differentiate wakeup due to sleep interval or button press

sayanee wrote 09/22/2017 at 00:31 0 points

http://www.falstad.com/circuit/circuitjs.html?cct=$+13+0.000005+24.46919322642204+50+5+13%0Ar+224+96+224+144+0+1000%0Ac+224+320+288+320+0+0.000001+-0.0015048369024333041%0As+176+320+208+320+0+1+true%0Ad+224+192+224+240+1+0.805904783%0Aw+224+240+224+304+0%0...


I have an ESP8266, ESP-12F modules that is in deep sleep mode.


It wakes up every 6 hours to read a humidity sensor, display it on LED and then post to IFTTT. Because it is every 6 hours, it actually wakes up every hour just to check an EEPROM stored counter to see if the 6 hour has elapsed. Otherwise, it will increase or reset the EEPROM counter accordingly. 


I also want the user to press a button to wake up the ESP, read the humidity sensor, display it on the LED and send to IFTTT even if the 6 hours have not elapsed.

Here is the on-going project link: https://hackaday.io/project/26927-ariel-measure-humidity-with-esp12-ifttt-si7021


Is there a way to differentiate wakeup due to sleep interval vs a button press reset? In both cases the reset reason is from ESP is 5. I have used ESP.getResetInfoPtr in this case.


I'm open to both hardware and firmware solutions.


I have also tried to simulate a possible circuit in falstad. But the GPIO12 (which I am trying to read as LOW right after ESP wakes up) does not hold on to the LOW value long enough for me to read it right after wake up.