7

I am doing research on creating a car computer with raspberry pi (so I have all the basics down before I start this project) and I am looking on a way to switch the whole device automatically whenever the car is switched off. I have found Android ROMs that do this exact thing but I want to build it from scratch with Raspberry pi. As my car battery is not huge, the device cannot and must not run when the car is switched off unless I explicitly turn it on.

What I want is functionality similar to how the car radio turns off at the exact moment the car is turned off so it does not drain my car battery.

I do not know if this should be done in code or with specific hardware. I am just looking for guidelines on how to proceed.

I am also looking for ways on how to connect to the car battery and use that as my power source.

2
  • This question might fit better on Electrical Engineering because it isn't Pi-specific. Commented Nov 1, 2014 at 14:37
  • @RPiAwesomeness Given the tags that already exist in this forum I suppose since it fits them it fits the site more or less. Maybe it would be suitable in both Commented Nov 2, 2014 at 12:46

4 Answers 4

6

I have not measured it myself, but this person claims the pi draws about 110 mA after shutdown, i.e., when the OS has halted and just the red PWR led glows.

Figures regarding the number of amp-hours in a car battery seem to vary quite widely; if we assume 50, then that's 50 / .11 ~= 454.5 hours such a battery should last with an inoperative pi attached. Of course, if you want to use the battery to start your car, you probably don't to go even half that far (also, draining a lead acid battery excessively shortens its lifespan).

The important part here is that the OS be shutdown. Otherwise, even when idle the pi draws at least 300 mA.

There are people who sell power off switches for the pi; these use a GPIO pin to signal the system to shutdown, wait for confirmation, then cut the power. Note this also requires a bit of software. If you search online you'll find such switches (they are built specifically for the pi) for ~$15-20.

I do not know if this should be done in code

There has to be some kind of hardware involved to accomplish this. If you wire the pi so the power is linked to the ignition state (on or off), you still need to signal the pi first so it can cleanly shutdown (if you don't do this, you will eventually run into problems). If you leave the power on, you need hardware to do the same thing, plus cut the power (as per the switches above).

I am also looking for ways on how to connect to the car battery and use that as my power source

You need a 12v - 5v DC converter, I guess. These are cheap and widely available.

2

Does the cigarette lighter switch off when you turn off the ignition? Perhaps a semi-intelligent/programmable UPS solution helps to softly shut down the Pi on power loss. Search for UPiS (made in Greece) or PiUPS.

1
  • I am revisiting this project after some time, where can I find any details in UPiS. Since I am from Cyprus I would rather support the greek product :) Commented Nov 24, 2015 at 13:52
1

@John I'd recommend you look at a UPS, two Pis oriented ones come to mind:

  • The PiModules UPis - I've just taken delivery of a second-user Basic model but I think the Advanced module (which has an external 7-18V supply input - e.g. feed from Car ancillary or ignition circuits) would better suit your needs. This offers full monitoring of all power sources and uses a 3.7V Lithium Polymer single cell (so no charge balancing across multiple cells needed) with capacities up to 3 or 4.5 Ah IIRC. Also has a RTC so it can work out what the time is even after the Pi is power-cycled/reset. The Advanced also has a few other extras, like a single Normally Open Relay and a protected one wire serial bus that might prove useful. It is marked "Made in Greece"!
  • The CW2 PiUPS - I know less about this but it too seems to use a single LiPo cell. The CW2 parent website seems to be German in origin- and the about website itself carries a paragraph at the bottom:

      Why is the english on this site so crappy and why does the guy in the video speak with an accent?

      Well, - we tried our best to hide our Sauerkraut accent - but you guessed correctly. Achtung! This product is engineered, built, quality checked and packaged in Germany. Despite that you will find no Bratwurst in your package - nothing but fine semi conductors and great support in the english language - don't hesitate to contact us in the case of any questions under: [email protected]

0

If you can live basicly with zero standby current and have a few hundred milliseconds to wake up here is a link that will give you several suggestions. https://www.google.com/search?q=zero+power+switch+using+relay&tbm=isch&ved=2ahUKEwjNurf5kt3_AhXykIkEHaQCCPwQ2-cCegQIABAA&oq=zero+power+switch+using+relay&gs_lcp=CgNpbWcQA1DtDViYG2CCJmgAcAB4AIABUogB7QeSAQIxM5gBAKABAaoBC2d3cy13aXotaW1nwAEB&sclient=img&ei=A4iXZI2tOPKhptQPpIWg4A8&bih=987&biw=1190#imgrc=RRoQf_uvcWXerM The simplest is to use a relay that is turned on when the micro turns it on. You then short the relay contacts and it will turn on, when the micro comes up it will hold until it is finished. There are a lot of variations of this basic idea.

You can replace the relay with a MOSFET if you want but it will take some minor circuit changes.

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.