29th Oct, 2014, 09:18 AM
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!
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!