Loading...
Pages: [1]   Go Down
Author Topic: Digital power switch  (Read 247 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on a project that I would like to add a power on/off button. Rather than use a slide switch, I was hoping to implement a "soft" power button, something similar to the power switch found on many modern cellphones.

Eg.

(Power is off) Press-n-hold = power resumes
(Power is on) Press-n-hold = prompt for power off -> confirmation -> shutdown/sleep

I'm pretty sure I can figure out the passive components to pull off the press-n-hold functionality, but I don't know the best approach to powering down the micro while still being able to bring it back. I'm considering just using interrupts, but I thought it'd be worth asking the experts before I get in too deep.

Thanks for your input
Logged

Topsham, Vermont USA
Online Online
Edison Member
*
Karma: 11
Posts: 1365
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Cellphones etc. are not totally off; they are in sleep mode waiting for an interrupt, I believe.  You can do the same thing...

http://playground.arduino.cc/Learning/arduinoSleepCode
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

terry,

I'm pretty sure you're right. Even in the shutdown state, the micro isn't completely powered off. I'm just trying to decide if I should use the native power saving modes, or implement an external power cut-off. Or more accurately, which one would provide a better user experience. Sliding a switch seems primitive, but a soft power switch might be less reliable. Or am I being too cautious?
Logged

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

Well if your ever looking for a hardware solution here is a circuit I use sometimes. It uses a single coil 5vdc latching relay to control the power to any circuit. Upon manual pressing of the switch the micro starts and sets the relay which 'seal' the power contact on. Then anytime the code wants to shut off the power it just sends a LOW to the output pin causing it to reset and remove power from the circuit. Consumes no steady state current, just pulses of power during switching states.

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

Denmark
Offline Offline
Full Member
***
Karma: 5
Posts: 249
New on the Arduino platform...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's how to do it. No need for big and bulky relays.



// Per.
Logged

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

Here's how to do it. No need for big and bulky relays.



// Per.

Nice circuit, but I suspect my latching relay takes up less board surface and cost less.  smiley-wink

http://www.ebay.com/itm/Lot-10-AL-5WN-K-Takamisawa-5-Volt-Latching-DPDT-Relay-/200540015451?pt=LH_DefaultDomain_0&hash=item2eb11dcb5b

Lefty
Logged

Denmark
Offline Offline
Full Member
***
Karma: 5
Posts: 249
New on the Arduino platform...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's how to do it. No need for big and bulky relays.



// Per.

Nice circuit, but I suspect my latching relay takes up less board surface and cost less.  smiley-wink

http://www.ebay.com/itm/Lot-10-AL-5WN-K-Takamisawa-5-Volt-Latching-DPDT-Relay-/200540015451?pt=LH_DefaultDomain_0&hash=item2eb11dcb5b

Lefty

Maybe. It's cheaper in discrete parts anyway, and it can be made smaller with SMD parts.

But yeah, more than one way to do it.

// Per.
Logged

United Kingdom
Offline Offline
Faraday Member
**
Karma: 131
Posts: 4681
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on a project that I would like to add a power on/off button. Rather than use a slide switch, I was hoping to implement a "soft" power button, something similar to the power switch found on many modern cellphones.

Eg.

(Power is off) Press-n-hold = power resumes
(Power is on) Press-n-hold = prompt for power off -> confirmation -> shutdown/sleep

That's exactly what I do in one of my designs. Put the mcu into power down sleep mode to turn it off. This stops the clock and the mcu consumes only a microamp or so, provided you don't have the watchdog or brownout detector enabled. The on/off button connects one of the interrupt pins to ground, and the interrupt wakes up the mcu.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys!

I Think I might give the latching option a try. Board space is at a premium here, so I'll be attempting to use SMD components. If all else fails, interrupts are tried and true, so I can always fall back to that.

If I get results, I'll post them back here.

Thanks again
Logged

NYC, US
Offline Offline
Sr. Member
****
Karma: 9
Posts: 426
I have no clue about Arduino, is it Italian coffee?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Board space is at a premium here, so I'll be attempting to use SMD components. If all else fails, interrupts are tried and true, so I can always fall back to that.

LTC2950-1/LTC2950-2 Pushbutton On/Off Controller (SMD)
LTC2950
Logged

NYC, US
Offline Offline
Sr. Member
****
Karma: 9
Posts: 426
I have no clue about Arduino, is it Italian coffee?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Thank you,  2 lots ordered. after ordered, find out it support Reverse polarity pulse unlatches. It is going to be a lot fun.
Logged

United Kingdom
Offline Offline
Faraday Member
**
Karma: 131
Posts: 4681
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The whole point of microcontrollers is that in a single device you can do in software things that would take many components to do in hardware. So making hardware to implement this function - which can easily be done in software - is IMO a pointless waste, unless your primary aim is to educate yourself in hardware design (and not to educate yourself in software design).
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com

Pages: [1]   Go Up
Print
 
Jump to: