D1 Mini latch button using rst pin I'm trying to use a Wemos D1 mini as a smart button that will boot up, perform a task, and then shut back down. I'd like to do this as a true power off as opposed to any sort of sleep mode. 

I'm hoping I can do something similar to this post https://www.esp8266.com/viewtopic.php?f=11&amp;t=4458


Tie RST pin to a Low GPIO pin so that it doesn't boot
Push a button that will run 3.3v to RST pin to make it go high and cause a boot up
Flip the GPIO pin that is tied to RST to high so that it stays running when button is no longer pressed
Run some code and flip GPIO back to LOW shutting down


Things I've tried:


Tie to GPIO15 (D8) - This stops the boot and starts booting when button is pressed but never finishes booting up. I'm assuming I am causing D8 to go high by pressing my button and interfering with the boot, but honestly not sure
Tie to GPIO4 or 5 (D2, D1). This doesn't prevent boot. 
I've also tried #2 with a pull down resistor on the GPIO pin, but that doesn't seem to work either


Any help would be much appreciated.
To do this you would usually use MOSFETs to control the power.

Take the following circuit, for example:







simulate this circuit &ndash; Schematic created using CircuitLab

M1 is normally off, having its gate pulled up by R1.

Pressing SW1 pulls the gate of M1 low, allowing current to flow through it to power the D1.

The D1 boots up, and immediately drives the GPIO high.

This then turns on M2 (which is normally off, having the gate pulled down by R2), which in turn pulls the gate of M1 low.

SW1 can now be released since M2 is doing the same job.

To turn off, simply drive the GPIO low, or allow it to float as an input, in which case R2 will turn off M2, which then turns off M1, which stops the current flowing.