Chat freely about anything...

User avatar
By sayanee
#70126 I have an ESP8266, ESP-12F module that is in deep sleep mode and wakes up every hour to read a humidity sensor, displays the value in LED and post to IFTTT.

But I also want the user to press a button to wakeup the ESP, read the humidity value from the LED and post to IFTTT manually.

Is there a way I can differentiate the reset wakeup reason due to sleep interval or due to a button press? Currently, the reset reason for both is 5.

I'm open to a hardware and / or firmware solutions.
User avatar
By rudy
#70129 I have a project that enables the ESP-12 rather than a reset. I have three buttons and all of them go to separate port pins but they also connect to a circuit that ORs the signals together and then that signal is used to turn the enable pin high.

I also will be using the sleep mode to turn off the ESP but I do not plan on having the timer/pin 16 start it up again. No automatic wake, just user press.

So in your case you could have the user switch cause a reset and have the ESP read the state of the switch input on startup.
User avatar
By jarnoldbrown
#70137 If you have a spare input, you could try having one side of the push button to Gnd, and having the other end connected:
a) Via a iuF cap to the /RESET pin
b) Via a Schottky diode to an input pin with a pullup. Cathode to button, anode to input.

You will also need a diode between GPIO16 and /RESET, if that's how you're doing the sleep/wake thing at the moment.

The cap should produce a short low on the /RESET. The diode should allow the ESP to read the state of the button at reset, if you read it right at the beginning of the code.

I'd draw it, but I'm a bit busy.

P.S. I have not tested this.