0

I'd loke to build a UPS for in-car use. I am powering my pi with a 12v to 5v DC-DC converter. I'd like to use a phone battery pack as the ones sold at dollar stores with a relay/transistor that sends a GPIO signal so the pi can power off when the car is off. Is it possible?

Thanks

2 Answers 2

2

It's definitely possible, but if you want to do it well, you will want to take into account factors which are not immediately obvious.

  1. Power glitches. Depending on where exactly you take the 12V in your car, that voltage may disappear for a second or two under certain conditions (like engine start). You may want to keep the RPi running off battery for some time and wait for the power to come back before you decide to shut down.

  2. Power-off current draw. Your RPi will keep drawing a substantial current after it shuts down, eventually emptying your UPS battery. Some batteries (like 18650 cells) may not survive if you run them completely dry, and most will have short lifespan if you don't prevent full discharge every time the car stops. You will want to make sure your circuit disconnects the battery after shut-down. Alternatively, you can use ultracaps which don't mind full discharge.

0

That's definitely possible - the easiest way would be to make a script that monitors the value on one of the GPIO pins. There are plenty of people that have done this, e.g. here

Once you've got that far, all you'd need is a voltage divider attached to the input side of the battery pack. Something like this would be ok:

Schematic

The voltage divider will provide 3.3/0v to the GPIO pin when the DC/DC converter is on/off.

Assuming that the ground in continuous all he way through to the Pi, that's all you should need.

3
  • Thanks! I just don't quite understand one thing.Where is the output to the pi (from where do I split the wires to supply the pi)? I assume that I would simply add a USB plug by connecting it on pin 1 to 4 directly, but could you please clarify? Also, Dmitry pointed out the fact that the pi still draws substantial current after powering off. Is there any way to prevent this? Finally, I read that the pi can be powered on afterward by connecting pin 5 to GND. Can it be added to that I can boot it when the car starts? Oct 7, 2016 at 14:38
  • I'm not sure what kind of USB power pack you have, but I assumed you could have just plugged the Pi directly into it, then 'charged' the power pack from the DC/DC converter? As far as 'substantial' I'm not sure, I have worded on a battery powered pi project in the past that only required single-digit milliamps when off, so would probably be ok.
    – calcinai
    Oct 7, 2016 at 15:27
  • You obviously go down the road of making your own power supply that handled actually cutting the power once off, then applying power again on startup, but this is a bit more of a challenge (depending on what you're in to). I could post another answer with a schematic for that if you're interested?
    – calcinai
    Oct 7, 2016 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.