Posts: 17
Joined: Tue Feb 12, 2013 8:55 pm

RPi poweroff issues

Tue Apr 16, 2013 4:56 pm

I have a raspberry PI in the car and the power goes off when the ignition goes off which means it doesn't shutdown nicely. I'm not sure if this has caused a problem because there have been alot of other intermittency issues, but I imagine it would be better to shutdown nicely.

I was wondering about the possibility of having a UPS for the pi that lasts just long enough for it to shutdown.

ie a rechargable battery, that charges when the power is on and when the power is off, it provides enough for the Pi to go through its shutdown procedure. I imagine a small box with a micro usb input, microusb output to go in the pi and a wire to go to a gpio pin and is 3.3V or 0V depending on whether there is external power or not. a background process could poll the pin every 30 seconds or so and shutdown the pi when the external power goes off. it would only need power for a minute or so.

any ideas or has this been done to death elsewhere? i couldnt find anything


User avatar
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: RPi poweroff issues

Tue Apr 16, 2013 5:31 pm

There have been lots of people discussing RPis in cars and various power supply solutions. However, your idea of a rechargeable battery lasting a few minutes (long enough for the RPi to shutdown) is not a great idea for the battery. Most rechargeable batteries can be damaged by prolonged periods of complete discharge, Li-ion will be damage immediately!
What you might consider is that the car battery can supply a shutdown RPi for a long time, not sure what its current drain is when in this state but its not much at all. To restart the RPi just short out the pins on P6 (between the main 5V0 regulator and the HDMI socket).

Posts: 26
Joined: Sat May 19, 2012 9:44 pm

Re: RPi poweroff issues

Wed Apr 17, 2013 2:11 pm

Have you considered a super capacitor set?

For example if you need 1 ampere at 5V and use two 2.7v 10F caps serially, it gives you 1 seconds before the voltage drops below 4.8volt.
With a higher capacity, it will get you longer times (e.g. 100F will give you 10 seconds).
Mind you that these capacitors are more expensive, and use a current limiting resistor between them and you circuit.

Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: RPi poweroff issues

Wed Apr 17, 2013 4:47 pm

Hi at all!
You can also use something like shown in the appended picture. It uses 2 GPIO-lines, one for detecting main-power, the second keeps power on via a NiMH-accu for ~10 seconds after RasPi is down.
The accu will be loaded, when you have main-power. (I use a 9V-2A-power-supply.)
Of course you can play aroud with the values, especially R1 when your input-voltage is higher. You can also try to use a switiching regulator instead, to waste less power.

One INIT-script sets GPIO0 to LOW as early as possible during boot up.
GPIO8 is watched via a binary (it consumes 1-2 seconds CPU-time per hour) and initiates shutdown, if power lost.

Greetings, FM_81
9V-RPi.JPG (29.88 KiB) Viewed 1768 times
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

Return to “Automation, sensing and robotics”