Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: March 19, 2013, 09:01:04 am » |
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
Edison Member
Karma: 11
Posts: 1365
... in The Woods In Vermont
|
 |
« Reply #1 on: March 19, 2013, 09:38:10 am » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #2 on: March 19, 2013, 10:55:49 am » |
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
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #3 on: March 19, 2013, 11:20:11 am » |
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
Full Member
Karma: 5
Posts: 249
New on the Arduino platform...
|
 |
« Reply #4 on: March 19, 2013, 04:04:41 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #5 on: March 19, 2013, 04:08:40 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 5
Posts: 249
New on the Arduino platform...
|
 |
« Reply #6 on: March 19, 2013, 04:10:38 pm » |
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
Faraday Member
Karma: 131
Posts: 4681
|
 |
« Reply #7 on: March 19, 2013, 04:20:38 pm » |
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
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #8 on: March 20, 2013, 12:01:04 pm » |
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
Sr. Member
Karma: 9
Posts: 426
I have no clue about Arduino, is it Italian coffee?
|
 |
« Reply #9 on: March 20, 2013, 05:11:50 pm » |
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
Sr. Member
Karma: 9
Posts: 426
I have no clue about Arduino, is it Italian coffee?
|
 |
« Reply #10 on: March 20, 2013, 05:15:11 pm » |
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
Faraday Member
Karma: 131
Posts: 4681
|
 |
« Reply #11 on: March 20, 2013, 05:48:03 pm » |
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
|
|
|
|
|