8266 with deep sleep, long press to power on/off and short press for normal reset. one button only

Thread Starter

bmbouter

Joined May 29, 2021
41
I have an 8266 that I put into deep sleep for battery saving purposes. It wakes up using a momentary switch that when pressed pulls RST low similar to #2 in this post. I want to have the following functionality, and I think I need an external circuit taking the button input and driving the RST line and possibly one other GPIO. Say a long press is 3 seconds and a short press is < 3 seconds.

# The goal
if deep sleeping, and long press wake up the 8266 (external wakeup so this would have to be RST pin pulling low)
if running, and short press reboot the 8266
if running, and long press have the 8266 go into deep sleep

What would you do if you wanted to make something like this? Thanks in advance, this forum is the best!
 

Ya’akov

Joined Jan 27, 2019
6,275
It seems to me you have the interface reversed and reboot should be the long press to avoid accidentally rebooting the MCU. It seems more rational to make short press wake/sleep and long press reboot.

You can certainly do what you want using something like a 555 timer but the complication is deciding the MCU is running. You could possibly use a GPIO pin to indicate run status, but the ESP8266 doesn’t exactly have an excess of GPIO. Do you have two pins available?
 

Thread Starter

bmbouter

Joined May 29, 2021
41
Switching the user experience around would be ok with me. Yes, I do have two additional GPIOs available, even on the 8266. It's important the circuit work down to 3V and also it needs to have a very low quiescent current. My whole goal is to minimize power consumption.
 

MrSalts

Joined Apr 2, 2020
2,097
Will you be connecting to wifi?
What type of battery (batteries) will you use?
How long do you expect the batteries to last?
 
Top