3

Am posting here as this question seems to be considered off-topic on both the electronics and the Raspberry sister sites.

Would like to install a carputer (Raspberry Pi), and am wondering about the minimal equipment needed to power it from the car. Have battery plus, battery minus/chassis ground, and ignition sense available.

I understand a step-down converter (12V->5V) is not enough, since the power line may have up to 100V or so when the car starts (not sure about exact figure).

If I want a stable 5V supply as long as the car engine is running, and 0V when it is not running, what is the simplest/cheapest solution?

Edit: I want to power it from those three wires mentioned above, and hidden away, so no cable to the cigarette lighter.

  • is this replacing the radio? – finleyarcher Mar 7 '18 at 15:26
  • @finleyarcher: Yes, but I want to be able to switch back and forth. – Tomas By Mar 7 '18 at 15:37
  • so you were planning on getting an adapter for the connections to the radio im guessing? for most cars, if you use the 12V and GND, it will have power when the car is on in accessory or in run, but not while the car is starting. – finleyarcher Mar 7 '18 at 15:44
  • ardumotive.com/raspberry-car-pc.html raspberrypi.org/blog/the-carputer Here are two relevant links, I think what you aren't considering is system shutdown. A raspberry pi is a little computer, repeated hard shutdowns increases the likelyhood of your corrupting the install and having to go through replacement headaches. Consider a tablet with a custom rom as that has a battery and you only need a simple charging circuit, like you were considering. – finleyarcher Mar 7 '18 at 15:46
  • You will still be gutting a tablet dc charger to power the tablet. My point was with something with a battery, you don't have to consider the case of device shutdown. With a raspberry pi, you need to do a soft shutdown. The ardumotive project covers some of that – finleyarcher Mar 7 '18 at 19:18
7

Most everything external of the ECU is going to be 12vdc (+/-2v). (NOTE: As @juhist points out, more and more cars are supporting 5vdc output to charge handheld devices through USB ports. 5vdc may already be available, but without knowing the specific car, there's be no way for us to help you with this.) The voltage doesn't spike unless there's unusual conditions like when a car is jumped incorrectly or other such nonsense. There are no 5vdc supplies available to the user. The only 5v source is located within the ECU and the step down on that is handled internally to the ECU.

The easiest way to do what you want is to use a phone car charger with an add-on power outlet socket. This is something you could fit behind the dash in most any car. Hard wire the socket into a keyed power source, then hard wire the outlet end of the charger directly into the Raspberry Pi device. All of the wiring you could hide with out issue. A car charger should provide you with enough power conditioning to give the needed 5vdc source you are looking for without the worry of spikes. They are made to handle the variation in voltage which is put out by the car system while outputting a consistent voltage source. Putting it on a keyed circuit will shut it down when the car is shut off.

Spikes in voltage do occur within the system. It can be caused by huge drops in load, such as when an A/C compressor cuts out. Electronics within the automobile have protection from these spikes. According to @vini_i, GM protects their vehicle electronics to handle 200v @ 1mS 30 seconds apart (thanks for the add, vini_i!). I'd also assume any reliable car charger made would have such built in protections as well. The car battery acts as a buffer for a lot of the spikes, but cannot handle some of these severe spikes. If they didn't do that, we'd be seeing fried phones all the time. Also, there's an internal regulator in the alternator (on most cars) which keeps the voltage at a manageable level to provide for the needs of the car while still allowing the battery to maintain its charge. There's only one place in the car I'm aware of which produces anything over the normal voltage and that's the coil. You wouldn't ever want to use that for a power source for your electronics, that's for sure! Output on them is in the 40k vdc range (if not higher). Yah, it wouldn't kill a person, but it would sure wake you up if you get zapped by it :o)

  • How about a $1 converter from China? I think the ignition is fused at 7.5A, which is more than enough. – Tomas By Mar 6 '18 at 15:40
  • 3
    There are in fact 100v spikes in the charging system. The key is that they are very short, less than 1ms in length. Because they are short they are low energy and can be dissipated with, for example, a TVS diode. The other catch is that they are really fast. At that speed, the battery has very high resistance. This phenomenon causes the pulse to propagate through the system relatively unchecked. The biggest culprit of such spikes is the AC clutch turning off but any load dump can cause a spike. Cell phone chargers typically are protected from such events. – vini_i Mar 6 '18 at 17:40
  • 1
    @vini_i - The battery is going to alleviate most of what happens there. If one was really worried about it, you could introduce a capacitor into the system which would provide even more protection. Like I said, if this was truly an issue, you'd be frying bits/pieces of your electronics on your car on a daily basis. With a properly running charging system, there's nothing really to worry about. – Pᴀᴜʟsᴛᴇʀ2 Mar 6 '18 at 18:22
  • @TomasBy - I was quite serious when I said to use a car charger you have laying around. If you are like me, you probably have a couple of old ones which have the old thick mini-USB connector which you cannot use anymore (does anyone use them ... well, maybe if are still using a flip phone.) Just clip the end off of it and figure out which wires do what (positive/negative), then hard wire to your Pi. – Pᴀᴜʟsᴛᴇʀ2 Mar 6 '18 at 18:24
  • 1
    @Pᴀᴜʟsᴛᴇʀ2: I know you're thinking everything would fry with those surges, but they really do happen. The expectation for non-trivial equipment is for it to temporarily disconnect itself and "ride out the surge" if it's unable to handle the transient. There's an entire design of input-filter circuitry to handle automotive transients. – Bryan Boettcher Mar 6 '18 at 21:30
3

Electronic modules that take car 12V and make 5V are sold at every convenience store, gas station and grocery store in the developed world. Right next to the phone charging cables. They're not even buried back next to the transmission fluid, they're usually right next to the cashier where you can't miss them. They are possibly the most popular electronic product on earth.

All you need to do is provision the things that go on either side of the module: a car "cigarette lighter" type 12V receptacle, and put a "USB plug" on your Raspberry board. The USB plugs are sold right next to the modules at the same endcap display rack. For the cigarette lighter receptacle, you'll have to scour the earth for any auto parts store, Radio Shack or Walmart/Kmart might also stock it.

The reason to bother with a cigarette lighter receptacle is so if the unit fails, you can swap it in 10 seconds in the parking lot of the convenience store where you buy its replacement.


Your ignition has several positions: Off/Lock, Accessory, Run and Start. Accessory is an intermediate position on your ignition switch made for sitting in your car listening to the radio, without engine features, fuel pumps and cooling fans running down your battery. Most people don't even realize the "Accessory" position is even there.

Your car's fuse block may have spare terminals specifically to tap for things like this. Some of the circuits will be always-hot, some "Hot in Run" (but not start), some "Hot in Run/Start", some "Hot in Accessory/Run". You'll have to decide which circuit is practical for you to tap, and which suits your purpose. "Hot in Run" will lose power for a few seconds while you crank the engine.

  • ... and Amazon.com :o) – Pᴀᴜʟsᴛᴇʀ2 Mar 6 '18 at 20:23
  • Hmm, I don't see them here, and I wanted a technical explanation. But I guess cannibalising a car cigarette lighter adapter seems to be the simplest/cheapest. Also, what I need is a USB-micro USB cable (which I have). – Tomas By Mar 6 '18 at 20:38
  • @TomasBy That list only includes larger products. Rather than cannibalize the unit, I would simply provision a cigarette lighter receptacle, that way the unit can be swapped in 10 seconds if it fails. Micro-USB is one of the cables they sell everywhere, so that's done. You'd want to wire the cigarette lighter receptacle into a "Hot in Run" circuit which is on when the car is turned on... the fuse block may have spare terminals specifically for attaching such things. If you want to do it a harder way, could you clarify your question to explain why? – Harper Mar 6 '18 at 21:12
  • Why: I want everything to fit in a double DIN compartment. I have 12V, GND, Ignition available in the car stereo connector. I think IGN is when the engine is running (or maybe it's "Accessory"). Need to check that at some point. – Tomas By Mar 6 '18 at 21:41
2

Bay of fleas and a DC to DC buck converter plugged into the cigarette lighter controlled by ignition.

Most cigarette lighters go off when the starter is engaged...

  • 1
    Literally a cigarette adapter with a USB lead to the Raspbery Pi would be all you really need. If you wanted something more long term, you could even come off the cig lighter wires behind the console and wire it that way. – mickburkejnr Mar 6 '18 at 15:11
1

Coincidentally working on my carpc right now, although it is a mini-ATX box.

I used one of these: http://www.mini-box.com/DCDC-USB-200 - which may be overkill for your application, but provides some advantages:

  • protection from voltage spikes U
  • some configuration power provision after ignition is switched off
  • ON/OFF control based on ignition for clean shutdowns (although I'm not sure how you'd hook this up to a Raspberry Pi

If you wanted to not use cigarette lighters, you should be able to wire something like this into your car radio's wiring harness.

  • The price is overkill. There are similar Pi-specific products for around half as much. Hook up: it says USB for advanced configuration? – Tomas By Mar 6 '18 at 18:19
  • I agree the price is a bit steep, but it's a configurable 150W DC-DC, not a 5-10W phone charger. For what it's made for, the price isn't too bad, and it's very nice; I have one. – R.. Mar 6 '18 at 21:28
  • it's quite large for OP's desired size. – Harper Mar 6 '18 at 22:25
0

For your Raspberry Pi, the device is so cheap that I would advise a 12V to 5V adapter. Just be sure to select one that provides enough current, as not all 5V USB adapters provide enough current for a Raspberry Pi. This is especially the case if you're using some of the better RasPi models such as Raspberry Pi 3 Model B.

However, if somebody is considering installing a more expensive computer, such as one worth several hundred dollars, or using a laptop computer in a car, I would choose a 12V to 120V or 230V inverter. Then I would connect the power supply of the computer to the inverter. Most higher-end computers have a 120V or 230V power supply (well, it should usually work on both voltages).

The reason? As @vini_i correctly noted, there are 100V spikes in the charging system. If the spike is so large that it fries something, it is your $30 inverter frying and not the $300 car computer or even worse, $1000 laptop. And usually these inverters would be designed to not be damaged by a voltage spike, but occasionally the voltage spikes may be so large that something will be damaged.

I wouldn't put my trust to a $5 cell phone charger to withstand a 100V spike. It may pass the spike to the output. But then again, Raspberry Pi is so cheap that I don't mind a RasPi frying. And I certainly don't see it as cost effective to buy $30 inverter for a $25 RasPi. Also, the inverter is relatively bulky when compared to a RasPi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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