Left for archival purposes.

User avatar
By Barnabybear
#39259
vanderbreye wrote:+1, also searching for a solution.
My story: i try to weakup the ESP-01 from sleep with a button - but i have to measure the time the button is pressed after it weakes up.

short press: esp wakes up
3secs press: esp wakes up and opens AP...

with the button wired to pull down RST & GPIO0 the esp wouldnt boot. :(

I'm on Arduino IDE....
is there any solution?

Hi, have a look at this posts http://www.esp8266.com/viewtopic.php?f=11&t=4458&hilit=PIR
https://www.hackster.io/iboboc/smartbutton-pro-06ce5d
They will give you some ideas.
User avatar
By Nhoj
#39550 The solution to this is fairly staight forward but you need a little more circuitry.

In order to cause a reset you need to pulse the rst line from high to low and back to high. That of course is obvious and you've already implied this. To do this we need to use a mosfet and a series capacitor to generate an inverted pulse on the rising edge of the flood alarm signal. The circuit shown will do this and has enough drive strength to overcome the ESP's on board resistor holding up the rst line.

image.jpeg
Pulse rst circuit using N-channel mosfet


A rising edge causes a pulse to be injected into the gate of the mosfet. The pulse turns the mosfet on momentarily, connecting the rst to ground. Once the flood alarm reaches 3.3v, the pulse returns to 0v turning the fet off. The ESP on board resistor on the rst line pulls the rst line high again. The diode from the gate to ground clamps the gate to >-0.7v when the flood alarm signal returns to 0v avoiding damage to the fet gate. The larger the capacitor the longer the pulse takes to return the fet to an off state. The values shown should work, but increase the capacitor to 0.01uF or higher if no rst occurs. Monitor the flood alarm signal with gpio2 to keep the processor on as long as there is liquid if you need to keep reporting the alarm before going back to sleep.

Have fun and let me know if there are issues and I would be glad to help sort it out.
User avatar
By Andrei Bucur
#45098
Nhoj wrote:The solution to this is fairly staight forward but you need a little more circuitry.

In order to cause a reset you need to pulse the rst line from high to low and back to high. That of course is obvious and you've already implied this. To do this we need to use a mosfet and a series capacitor to generate an inverted pulse on the rising edge of the flood alarm signal. The circuit shown will do this and has enough drive strength to overcome the ESP's on board resistor holding up the rst line.

image.jpeg


A rising edge causes a pulse to be injected into the gate of the mosfet. The pulse turns the mosfet on momentarily, connecting the rst to ground. Once the flood alarm reaches 3.3v, the pulse returns to 0v turning the fet off. The ESP on board resistor on the rst line pulls the rst line high again. The diode from the gate to ground clamps the gate to >-0.7v when the flood alarm signal returns to 0v avoiding damage to the fet gate. The larger the capacitor the longer the pulse takes to return the fet to an off state. The values shown should work, but increase the capacitor to 0.01uF or higher if no rst occurs. Monitor the flood alarm signal with gpio2 to keep the processor on as long as there is liquid if you need to keep reporting the alarm before going back to sleep.

Have fun and let me know if there are issues and I would be glad to help sort it out.


Hi,
I was created the circuit above (instead BS170 I use 2N7000) and the problems are:

1. If the input of 3.3v it's applied quickly after the circuit it's powered on the reset it's working only ONCE ... (until the capacitor is fully charged) after that the MOSFET remain stuck !?
2. if the 3.3v is applied directly to the Gate (I pulled up the capacitor) the drain it's open and the ESP is not resetting until the input goes back to 0V

thank you
Andrei