-->
Page 1 of 4

Long press reset button?

PostPosted: Sat Apr 16, 2016 5:21 pm
by mattrix
Hi,

I would like my ESP8266 to be able to detect a long press on a button that also does a hardware reset.
I use deep sleep, so an interrupt won't work.

Detecting the long press is easy in the setup, just time how long the button is pressed - if more than 1second, then wipe WiFi data.

However, the ESP8266 does not boot while the Reset button is still grounded.
Therefore, I think I will need to use another pin for my new reset button.

Then, need some hardware so when the button is held, it quickly GNDs the reset pin just once to reboot and then I can see how long it's pressed for in the setup().

My goal is just to have 1x simple reset button. If held then does a 'factory reset'

Any ideas?

Could I maybe use a gpio_pin_wakeup_enable ?
Can you call that before a deep sleep?
I really want deep sleep as it needs to be very power efficient.

Re: Long press reset button?

PostPosted: Sat Apr 16, 2016 5:30 pm
by mattrix
I'm not a hardware guy but would this circuit do the trick

viewtopic.php?f=13&t=719#p4003

If I held that button, would it simply reset once and then I can then time the press on setup()?

Re: Long press reset button?

PostPosted: Sun Apr 17, 2016 12:40 am
by chaeplin
an npn tr + gpio 16 + pulse in ?

https://raw.githubusercontent.com/chaep ... /npntr.png

I think gpio 16 can be used as input.

Re: Long press reset button?

PostPosted: Sun Apr 17, 2016 7:05 am
by martinayotte
Unfortunately, the circuit in the above link provided by @mattrix is attached to CH_PD, not RESET.
Also, both CH_PD and RES can't be used as GPIO input, so firmware can read them to figure out any special reset mode.
Therefore, it would require a separate GPIO anyway, such the GPIO16 mentioned by @chaeplin ...
But the schematic provided by @chaeplin doesn't do the job either, since it is only disconnecting the RES switch when transistor base is low.