In reference to my question Arduino Controlled Power Supply for more details and a test program.
Why is it that my circuit involving a transistor does not work (see below) whereas a similar circuit using a MOSFET does work?
Also, why is it that when the power is cut in the transistor based circuit, the Arduino dies instantaneously, whereas in the MOSFET based circuit, the Arduino gradually fades away over a period of 3-4 seconds? When I say it "fades away", the LED's will dim over that 3-4 seconds. It is like there is some capacitance that keeps it going until the charge is exhausted - but this does not occur in the transistor based circuit.
The idea behind this circuit is to maximise the life of a 9V battery powering the Arduino. The idea is to allow an external physical event (pressing S1) to power up the Arduino. Then, the Arduino, via Pin D2, will keep the power on after S1 is released until such time as it has done what it needs to do. Finally the Arduino will drop Pin D2 to a low state to shut off the power.
Following are the two circuit diagrams.
Firstly the transistor based circuit - which does not work (the Arduino dies as soon as S1 is released - and it dies instantaneously).
Secondly, the MOSFET based circuit - which achieves the desired result, but the Arduino gradually "fades away" when D2 goes LOW. This is OK, but it would be nicer if the Arduino powered down much more quickly.