如何在不进行连续重置的情况下将esp8266从深度睡眠中唤醒 [英] How to wake esp8266 from deep sleep without continuous resets

查看:1003
本文介绍了如何在不进行连续重置的情况下将esp8266从深度睡眠中唤醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用esp8266建立IR至wifi的网桥.基本上,我正在构建连接到IR遥控器中的esp8266的IR接收器,以通过wifi将接收到的IR Remote按键转发到服务器.我正在使用Wemos D1 Mini.

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.

我已经可以使用IR解码和网络转发部分了,但是它始终打开,这会消耗大量电池,尤其是考虑到99%的时间没有按下任何按钮.

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.

如果我将IR接收器连接到RST引脚,则可以将esp从深度睡眠中唤醒,但是这样做的问题是,随着IR不断进入,它将不断反复重置esp,这将使esp无法真正解码IR命令,因为它不断被重置.

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.

我需要它通过RST从深度睡眠中唤醒,但随后忽略进一步的RST激活,直到我以编程方式再次将其发送到深度睡眠中.

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.

我真正需要的是适当的gpio中断,因此在进入深度睡眠之前我可以忽略进一步的重置,但是AFAIK esp8266不支持从深度睡眠中唤醒gpio中断.

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.

我不确定如何实现此目标?有人有想法么?我宁愿不必使用其他外部微控制器来重置esp8266,遥控器内部空间也很小,所以我宁愿不必使用大量外部部件.

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.

推荐答案

这是我用来允许单次中断从ESP8266上的深度睡眠中唤醒的电路.它仅在深度睡眠定时器被激活(D0被拉低)之后才允许中断复位.在您的深度睡眠功能上设置短暂的超时,以立即启用中断.

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.

经过一些测试,我发现上面的电路并没有节省我想的那么多功率,因为​​它只能阻止芯片启动,但是ESP的内部部分处于活动状态,大约需要15ma的电流来等待复位.深度睡眠远远超过60ua!

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!

如果激活后有几秒钟的信号保持打开状态(例如PIR运动传感器),则下面的电路可能会工作.它使用一个电容器仅允许边沿触发,然后运行的代码可以检查GPIO4上的输入信号.但是,总体功耗仍然不佳,因为ESP8266的最大睡眠时间约为1小时.这意味着ESP8266仍会唤醒并使用15ma几秒钟,然后再回到睡眠状态.在5分钟的深度睡眠周期中,约1500mah的压力将持续约5天.

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.

这篇关于如何在不进行连续重置的情况下将esp8266从深度睡眠中唤醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆