This is my first time on this forum and I'm not sure if it is the right forum or the right place on the forum. I'm trying to create a circuit so that an Arduino turns on immediately and stays after depressing a push button (S1). After that, the Arduino can turn itself off (by taking pin D6 high). Here is my failed attempt:
Without R3, the MOSFET was never turning off. Without R2, the circuit only latches after the code explicitly takes D6 low (after boot which takes a second) , but not before. With R2, the MOSFET latches on immediately, but does not turn off when D6 goes high. Any help would be appreciated.
The requirements are as follows:
What I'm trying to do in the circuit above:
The MOSFET acts as a low side switch for the Arduino and the battery, so the 9V and 5V grounds are connected when the switch is pressed. When S1 is pressed, power goes to the Arduino and the MOSFET gate is turned on via the PNP transistor. With the MOSFET on, the Arduino stays on even after the push button is released. At some future time, the Arduino code brings D6 high turning off the MOSFET and therefore the Arduino. The circuit almost works. The problem is that D6 floats during the boot, so the circuit only latches after the code brings D6 low. Adding R2 (tried various values) keeps the pin from floating, but then for some reason, the MOSFET does not turn off when D6 is brought high.
Without R3, the MOSFET was never turning off. Without R2, the circuit only latches after the code explicitly takes D6 low (after boot which takes a second) , but not before. With R2, the MOSFET latches on immediately, but does not turn off when D6 goes high. Any help would be appreciated.
The requirements are as follows:
- The Arduino starts completely off, not in sleep or standby
- On the press of a momentary push button, the Arduino comes on and stays on. After that, the push button does nothing as long as the Arduino is running.
- At some future time, the code running on the Arduino can turn itself off. In the above circuit, it would bring pin D6 high.
What I'm trying to do in the circuit above:
The MOSFET acts as a low side switch for the Arduino and the battery, so the 9V and 5V grounds are connected when the switch is pressed. When S1 is pressed, power goes to the Arduino and the MOSFET gate is turned on via the PNP transistor. With the MOSFET on, the Arduino stays on even after the push button is released. At some future time, the Arduino code brings D6 high turning off the MOSFET and therefore the Arduino. The circuit almost works. The problem is that D6 floats during the boot, so the circuit only latches after the code brings D6 low. Adding R2 (tried various values) keeps the pin from floating, but then for some reason, the MOSFET does not turn off when D6 is brought high.
Last edited: