I'm trying to create a circuit where a button press results in a microcontroller booting up and sending a wifi request. I'm relatively new to electronics, so likely have a big knowledge gap.
Similar questions have been asked before, eg:
- Momentary switch power: press to turn on, microcontroller can turn itself off - this is very similar, but there wasn't a clear answer (just a proposed alternative involving a mosfet)
- Power control circuit that lets MCU shut itself off
- How to make a circuit that can power itself off
But the answers there require mosfets, which I don't have on hand (I have BJT transistors, capacitors, resistors, diodes). I'm wondering if something simpler, like the following would work:
Specifics
- I'm using a ESP8266 (ESP01) microcontroller. This source suggests that GPIO3 is pulled high at boot
- My intention is to have this be battery powered, so the power source is likely a battery source connected to a 3.3v mcp1700 LDO.
- Because it's battery powered, there would ideally be no current draw when the device is powered off
The intended functionality is:
- I press the momentary switch S1, which grounds the MCU, causing it to power on in that moment
- Immediately at boot, GPIO3 is pulled high, which activates the BC337 transistor, which also causes the MCU to be grounded
- After a 200ms (or however long a button press lasts), I release the switch S1, but the MCU stays powered on due to the transistor
- I wait for the MCU to boot and send a request over wifi
- I have the MCU set GPIO3 to low, which causes the transistor to cut off grounding to the MCU and the MCU powers off
Note that I'm following the schematic shown on this page which uses a BC337 transistor as a switch to turn an LED on/off.