- Sun Jan 24, 2016 3:38 am
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.
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.