Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Vincent Lê
#30789 Hi,

In the init functions, I want to know if the ESP has waken up naturaly after its deep sleep mode, or it has been triggered by user in the middle of the "night".

Maybe one path would be to follow the timestamp given by tmr.now() : if the new value is around the expected dsleep length, I would be in normal mode ; if the difference is less than that, then I would be in the user triggered case.

BUT, the simetamp is a int31 in uS, so it is looping every 30', then I cannot use that timer for my reset frequency witch is arount few hours.
User avatar
By Barnabybear
#30806 Hi, if the wake up from exernal source is more than 250mS (boot time) you could read it on another pin.
So, Pin low = normal wake from deep sleep, Pin high = woken by external source.

Depending on what you are doing this is an alternative to deep sleep.
viewtopic.php?f=11&t=4458
User avatar
By Vincent Lê
#30808 The external source is a button, so it is less than 250ms.

With this idea, I'm trying to implement a RC circuit between my button, the reset pin and a gpio pin. This will electronically store a value in the capacitor.

I think this is the good idea, unfortunately I am failing to implement it. How would you do that?
User avatar
By Barnabybear
#30824
Vincent Lê wrote:The external source is a button, so it is less than 250ms.

With this idea, I'm trying to implement a RC circuit between my button, the reset pin and a gpio pin. This will electronically store a value in the capacitor.

I think this is the good idea, unfortunately I am failing to implement it. How would you do that?


Hi, some thoughts. All assume that you are connecting GPIO16 to RST to get out of deep sleep via a 1k resistor and the RC needs to keep the pin high for about 1 sec.
1. Dual pole switch. One side to RST to wake from deep sleep. Other side to GPIO of your choice, with RC (to provide delayed off). Assumes the button press is long enough to wake ESP.
2. Single pole switch. Assumes the button press is not long enough to wake ESP. Switch charges RC – that provides voltage to GPIO of your choice & RST via diode (diode stops GPIO going high during normal wake from sleep).
3. Long shot but simple. This assumes that GPIO 16 goes high to wake the ESP for long enough to be read by another pin. Single pole switch provides voltage to RST.
IMAGE REMOVED OR MY DROPBOX GETS FULL - PM me if you think it might have been of use to you.
That should keep you busy for an hour or so.
Last edited by Barnabybear on Thu Oct 08, 2015 7:34 am, edited 1 time in total.