I'm building an IR to wifi bridge using an esp8266. Basically I'm building an IR receiver connected to an esp8266 inside an IR remote control, to forward received IR Remote keypresses over wifi to a server. I'm using a Wemos D1 Mini.
I already have the IR decoding and network forwarding part working, but it is always on, which uses a lot of battery, especially considering that 99% of the time no buttons are being pressed.
I want it to go into deep sleep when a button hasn't been pressed for a certain time.
If I connect the IR receiver to the RST pin, that can wake the esp up from deep sleep, but the problem with that is that it will keep resetting the esp over and over as the IR keeps coming in, which will make the esp unable to actually decode the IR commands because it is continually being reset.
I need it to wake the esp up from deep sleep via RST, but then to ignore further RST activations until I programmatically send it into deep sleep again.
What I really need is a proper gpio interrupt so I can ignore further resets until I go to deep sleep, but AFAIK esp8266 doesn't support gpio interrupt wake from deep sleep.
I need some kind of resettable one-shot trigger to only issue one reset until you tell it that you're going to sleep again.
I'm not sure how I'd be able to implement this? Anyone have any ideas? I would rather not have to use another external microcontroller just to reset the esp8266, also space is tight inside the remote control so I'd rather not have to use a lot of external parts.
This is a circuit that I use to allow for one shot interrupt to wake up from deep sleep on ESP8266. It operates by allowing interrupt to reset only after the deep sleep timer activated (D0 is pulled low). Put a short timeout on your deep sleep function to enable interrupt right away.
After some testing, I find that the circuit above does not save as much power as I thought because it only prevents the chip from start up but internal part of ESP is active and draw around 15ma waiting for reset. This is a lot more than 60ua in deep sleep!
If you have a signal that stay on for a few seconds after activation (like a PIR motion sensor) then the circuit below may work. It uses a capacitor to allow only edge trigger then running code can check input signal on GPIO4. However, overall power usage is still not good because the ESP8266 max sleep time is about 1 hour. This means the ESP8266 still wakes up and uses 15ma for a few seconds before going back to sleep. At 5 minutes deep sleep cycle, a 1500mah would be good for around 5 days.