As you can see, I use Enable pin for this purpose.
There is an SPDT switch to make it work all the time.
There is a push button which I will use to power it up. When it is pressed, the MCU will take it from there by logic state on the pwrPin, thus stay powered until the condition is made.
Questions:
Does this circuit looks ok? Should I need to change something?
What if I want to power it down with a button? I need another one to give an input to the MCU, or this circuit can be modified?
it's a simple package, can deliver continuous currents from 4A to 16A and you can use the same circuit to shutdown your project by using a simple command pin on your arduino. and they consume next to nothing whilst in off state (~0.01 μA)
you can use the on board button or attach your own button (they have pins for that)
Why, when someone asks how to achieve something, do people answer with 'why don't you just do this....' In this case, a latching button or a switch.
Because clearly he doesn't want to do that!
I have powered an Arduino before with a momentary push button before and used a pin that is told to go high immediately to switch a P channel transistor (via an N channel transistor) to then hold the power on.
Advantage is then you can switch off the Arduino in software.
I'm not sure your switches will work as you want. If SW1 is switched to ground, pressing SW2 will still enable the regulator.
If the GPIO pin in INPUT_PULLUP mode can supply enough current to turn on the NPN transistor, then I think the circuit shown below would let you use the push button to power on the circuit, and then use it as an input source thereafter. Then it could be used to signal the processor to power down, or for something else.
The SW1 should be used only when you want to use it no matter of the SW2 or pin logic state. Say, for testing or uploading a sketch. I think, it will not be exposed and used ever again. You can not upload a sketch if there is no logic to force this pin HIGH. You should keep SW2 pressed all the time. This is the only reason of SW1.
SW2 will be used to power it up, and later keep it powered up with the logic state, until the condition is made.
I believe, in such a case, this should do the job. Just wanted to here if there is some other solution, better, some suggestions... or maybe if I am wrong.