Go Down

Topic: Soft Power Switch (Read 3 times) previous topic - next topic

CowJam

I've made a soft power switch.  I'm sure it's been done before, but I thought I'd share.



Set pin8 as high in setup().  

To start, press and hold the button until the relay clicks.  You can then let go, and power stays on until pin8 is set to LOW in the software.

You can use an interrupt for power off - and get it to stop sensibly.  Might be handy if you're using an LCD display or need to save something to EEPROM.

Since you're likely to be running 12v through the switch you'd need to step that down if you wanted to use the same button for your interrupt, or use a double pole switch.

Comments or suggestions welcome (including how to step down the 12v supply so you can use it as pin input for the shut down interrupt).

Udo Klein

Nice idea. However I have two suggestions for improvement:

1) Use a FET instead of the relais to decrease current consumption (easy)
2) Figure out how to use the same switch for switching off and retain the capability for software shutdown (harder)

I did not think to much about (2) but I think it should be possible. Of course you might need to add some more parts and sacrifice one input pin.

I am currently thinking about some similar setup but I actually intend to use a dedicated controller for the power switch only. Reason is to be absolutely sure to be able to switch off no matter how I fould up the main controller.

Udo
Check out my experiments http://blog.blinkenlight.net

CowJam

Sorry to be a n00b, but what's a FET?

Jeremy1998

I think FET is a transistor. As in J-FET, MOSFET, ect. Not sure if I'm correct or not... But there's my 2 cents, wheather they're real or not... ;)

CowJam

Thanks Jeremy.

I like the relay as there's a click to let you know it's on.

And, sad as it is, I read MOSFET as mos eisley.  That's thanks to too much of that star wars racing game on the N64 when I was at uni.

Salvador

A FET is a Field Effect Transistor.

http://en.wikipedia.org/wiki/Field-effect_transistor

liudr

Hey cowjam. I remember a few days ago someone asked about a pololu switch:

http://www.pololu.com/catalog/product/750

The switch certainly does the job if you connect the pin 8 to the off pin.

retrolefty

#7
Jul 21, 2010, 02:43 am Last Edit: Jul 21, 2010, 02:46 am by retrolefty Reason: 1
I designed a similar circuit, using a single coil 5v latching relay, DIP size. It's benefits is that there is no continuous current draw while on or off, just during the switching transactions. It's activated the same as yours by pushing a momentary switch and the first instructions in the setup is to set the output pin high, and thus setting the relay. Then at anytime under software if the output pin is set low, resetting the relay and the whole unit powers down. I found the relays on E-bay for around 10 for $5.

http://img25.imageshack.us/img25/563/08miq7.jpg

Lefty

CowJam

#8
Jul 21, 2010, 08:55 am Last Edit: Jul 21, 2010, 09:05 am by cowjam Reason: 1
A single coil latching relay would be better. I only used the DTDP one is because it's what I had in my box.

Thanks to salvador and liudr for your answers too.  I like the look of the pololu siwtch.

Go Up