Pages: [1]   Go Down
Author Topic: Soft Power Switch  (Read 2402 times)
0 Members and 1 Guest are viewing this topic.
Wigan, UK
Offline Offline
God Member
*****
Karma: 18
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

0
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3420
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Wigan, UK
Offline Offline
God Member
*****
Karma: 18
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Somewhere in Arizona
Offline Offline
God Member
*****
Karma: 0
Posts: 725
Arduino must be a drug, because I'm addicted!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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... smiley-wink
Logged

Wigan, UK
Offline Offline
God Member
*****
Karma: 18
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Elizabeth NJ
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino is better than. s.e.x.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A FET is a Field Effect Transistor.

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

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6944
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: July 20, 2010, 07:46:27 pm by retrolefty » Logged

Wigan, UK
Offline Offline
God Member
*****
Karma: 18
Posts: 814
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 21, 2010, 02:05:25 am by cowjam » Logged

Pages: [1]   Go Up
Jump to: