How to wake esp8266 from deep sleep without continuous resets

时光总嘲笑我的痴心妄想 提交于 2019-12-31 10:57:11

问题


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.


回答1:


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.




回答2:


Did you see Espressif doc about sleep ESP8266 modes? It is available here: http://www.espressif.com/sites/default/files/9b-esp8266-low_power_solutions_en_0.pdf

It says:

In Deep-sleep mode, the chip can be woken up and initialized by a low-level pulse generated on the EXT_RSTB pin via an external IO.

So, I'm not sure it is possible to avoid reset (although, maybe some hacky way exists?), but what about another sleep mode? Like light-sleep.




回答3:


This post on electronics stack describes how to do a one-shot button with a couple extra parts. However space-wise they add up to be larger than using another micro, so the OP decided to go with an MCU. The micro will use the fewest additional parts and claim the lowest amount of space.



来源:https://stackoverflow.com/questions/39481196/how-to-wake-esp8266-from-deep-sleep-without-continuous-resets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!