Software Shutoff

I'm trying to find a VERY simple way to make a power on switch, and then leave power off up to the software. I have an idea, but I'm not sure if it will work.

I plan to have the positive end of the battery go through a transistor to VIN on the board. There will also be a switch that allows one to bypass the transistor. Now, one of the digital I/O ports will be connected to the control wire of the transistor. This will be set to HIGH on startup. It will then set to LOW when the power is meant to be shut off.

Will this work? I'm unsure because the output is feeding nto its source. I'm not an electricity expert, so I need to know that this will work and not make a short circuit or something undesireable. Thanks for the help in advance.

The Pololu Pushbutton Power Switch is a patented design

I'm so impressed

One shot monostable multivibrator using LMC555 the cmos version of the 555. You can set this up to take a switch press then output a high for a longer duration. You would then hook the arduino outout to this chips output and it will take over from it when it powers up and your code runs.

http://www.utm.edu/staff/leeb/3b3.htm

http://www.circuitdb.com/circuits/id/107

I'm sure there are other considerations to steer the signals correctly but this is as far as I could research.

I think you'll find you need 2 transistors or FETs because the voltage you are switching is well over what you can supply from an Arduino pin so you need to shift the control voltage up to the VIN voltage.

IE the highest you can drive the base is 5v, so if switching 12v you'll still have a Vbe of 7v and you won't be able to turn it off.

The main transistor (PNP) controls the power and another transistor (NPN) controls the base of the PNP, plus a pullup resistor to VIN on the PNP base.

Hope I got that right, I always get my Ps and Ns mixed up. :slight_smile:


Rob

But would the transistor in my design shut off whenever the pin stopped outputting high? I don't need to power button to work as off. Just on. The power off is controlled by the pin.

Sorry, been away for a couple of days.

I'm not a transistor expert and thought someone more informed in this area might have dropped in by now.

It seems to me that using a PNP would work, possibly with the base tied back to VIN just to ensure it turns off. Your uC OP should be tristated (not driven low) to shut the power off.


Rob

I'm not sure that a PNP would work. With a PNP, it would be on whenever there was no power from the pin. Although this would save power, it defeats the point, because as soon as the pin goes high, the device would shut off and it would go low again, turning the device back on. I think that an NPN is the solution, with a switch to bypass it.

I think that this is what I need.

Of course, maybe I should just pay 5 dollars for that mosfet switch and be done with all of this transistor mayhem.