2

Apologies if this is a duplicate, but I can't seem to find a suitable solution.

I need to power a Raspberry Pi in a car, and for obvious reasons need to shutdown gracefully, however, I need it to automatically start backup when the car is started (and power reconnected).

The car has two power sources, mains (always) and accessory (only when the ignition is on.) Instead of using a battery which was original idea, is it possible to use two power sources, and when switched to mains, it will power off, but when accessory is switched back on, the Pi Powers up.

Alternatively, is it possible to do this off a battery powered by accessory, not sure how they would communicate though.

Kind Regards, Fox

4
  • 1
    Your question is unclear. Where do you plan to get "mains" in a car? There is no (simple) way to shutdown gracefully when power is removed, but there are numerous methods of shutting the Pi down with a command or button.
    – Milliways
    Commented Mar 1, 2019 at 0:54
  • 2
    If you can't predict when the power will fail try setting your RPi up with a read-only rootfs as that's less prone to damage when the power drops. github.com/JasperE84/root-ro
    – Dougie
    Commented Mar 1, 2019 at 2:50
  • Advice: Use a USB stick for the OS to reduce corruption. Maybe add a shutdown button to hit at the end of the journey. The Pi will boot automatically when power is restored at next engine start. Commented Mar 1, 2019 at 21:32
  • Don't take this the wrong way, but this is not a good question. At least one similar question has been classified as Off-Topic, it's not specific, and it doesn't reflect the work you've put into it (you have put some effort into it, right?) Recommendation: Research similar projects & questions (Google car powered raspberry pi or similar), learn about how the RPi shuts down AND powers up, then ask specific questions. Baby steps iow...
    – Seamus
    Commented Mar 3, 2019 at 4:45

2 Answers 2

3

Feed both sources to a single voltage regulator through diodes. Additionally, provide a GPIO signal from accessory source which will tell the RPi whenever accessory power is present, so ther RPi can decide to shut down when it's not. Use a timed relay to cut off mains power after accessory power was missing for a minute or two.

schematic

simulate this circuit – Schematic created using CircuitLab

In many modern cars the cigarette lighter outlet already includes an equivalent of such a timed relay and diodes, so if you connect your RPi power supply to it, you will only need to provide a shutdown signal, i.e. R1/D3.

1

Perhaps you already found it, but I recently came across this pi hat for interfacing with a car computer: http://www.carberry.it/

NOTE: I have not used it myself, so I have no clue about the quality.

According to the specs it is powered by the car battery even when the ignition is off (which I assume you mean with mains). They also claim it allows for a gracefull shutdown when the car is powered down, apparently by checking an IO pin or using a daemon they supply.

1

Your Answer

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

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