Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Switch Rpi on and off
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Switch Rpi on and off
29th Oct, 2014, 09:18 AM
Post: #1
vinz3nt Offline
Registered
Posts: 1
Joined: Oct 2014
Reputation: 0
Switch Rpi on and off
Hello,

I built a portable xbian system with a Raspberry Pi and 2 screens for in the car. The system is powered by the 12V cigarette lighter socket with a step-down converter to 5V.
In the first version the Rpi was shut down very brutely because the 12V is killed when the car is turned off.
In the second version I put in a small (2200 mAh) powerbank, input is connected to power from the car via the converter, the output powers the Rpi and a USB hub. In that way when the car is powered down, only the screens will turn off, the Rpi can run a few hours on battery power. I can then perform a sudo shutdown -h now.

Now for the question; how can I make a button which switches the Rpi off gracefully? I read somewhere you can connect a button to a gpio pin and GND and when button is pressed a script will perform this command. I can't find it anywhere. And is there a way to switch it back on??

Any help is welcome!
Find all posts by this user
Quote this message in a reply
29th Oct, 2014, 01:25 PM (This post was last modified: 29th Oct, 2014 01:25 PM by f1vefour.)
Post: #2
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: Switch Rpi on and off
No way to switch back on through GPIO since the device is off.

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
29th Oct, 2014, 03:46 PM
Post: #3
Smultie Offline
Moderator
******
Posts: 322
Joined: Feb 2013
Reputation: 16
RE: Switch Rpi on and off
https://www.pi-supply.com/product/pi-ups-uninterrupted-power-supply-raspberry-pi/

That will work!
Find all posts by this user
Quote this message in a reply
29th Oct, 2014, 04:54 PM
Post: #4
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: Switch Rpi on and off
Very cool but that price is rediculous, cost as much as the Pi.

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
29th Oct, 2014, 05:30 PM
Post: #5
Smultie Offline
Moderator
******
Posts: 322
Joined: Feb 2013
Reputation: 16
RE: Switch Rpi on and off
(29th Oct, 2014 04:54 PM)f1vefour Wrote:  Very cool but that price is rediculous, cost as much as the Pi.


Hey, don't shoot the messenger Smile
Find all posts by this user
Quote this message in a reply
29th Oct, 2014, 09:39 PM
Post: #6
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: Switch Rpi on and off
Smile It is a good find and I would love to have one myself.

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
30th Oct, 2014, 08:18 PM
Post: #7
Skywatch Offline
Registered
Posts: 1,018
Joined: Mar 2013
Reputation: 28
RE: Switch Rpi on and off
(29th Oct, 2014 09:18 AM)vinz3nt Wrote:  .... can I make a button which switches the Rpi off gracefully? I read somewhere you can connect a button to a gpio pin and GND and when button is pressed a script will perform this command. I can't find it anywhere. And is there a way to switch it back on??

Any help is welcome!

Yes this would be one way to do it. Another would be to detect when the cars 12V supply stops and use that to initiate a power off script while the pi is still on battery pack power. This way you won't forget to do it!

A simple voltage detector can be bought for less than £1 off ebay and can be connected to the gpio to sense this. There are other ways you could do this too.

The pi would boot up again when the power is restored, or you could use an arduino pro mini and a relay to enable this. They are cheap and easy to program.

skywatch
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 10th May, 2025, 01:21 AM Powered By MyBB, © 2002-2025 MyBB Group.