Soap2191
Posts: 4
Joined: Sun Nov 26, 2023 6:25 am

Power for Pi in a car

Sun Nov 26, 2023 6:29 am

Hi there. I am working on a OBD system for my car and I need to power the Raspberry pi some how in the vehicle. I was thinking I could just plug it into a 12V USB port but Ive seen a few forum posts about energy problems so Im wondering how should I go about this. I can't solder or do anything like that so any suggestions would work. If you guys know if I can just plug in the pi into the port anyway please let me know. Im using the Pi and a small 7inch display that's it.

ame
Posts: 8754
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Power for Pi in a car

Sun Nov 26, 2023 6:48 am

Yes, you can. Your biggest problem is likely to be due to the power being cut when the ignition is turned off.

You have two options. One is to make the Pi OS read-only, so that cutting the power has no negative effects (although you might have to deal with other issues). The other is to power the Pi from a permanent 12V supply unaffected by the ignition state, but this also has issues. For example, you'll have to disconnect the Pi from the battery somehow at some point to avoid draining the battery.

I suggest you use a permanent connection to the battery with a 5V converter to get your OBD stuff working then figure out how to make it play nice with the vehicle being turned on and off.
Oh no, not again.

Soap2191
Posts: 4
Joined: Sun Nov 26, 2023 6:25 am

Re: Power for Pi in a car

Sun Nov 26, 2023 7:00 am

ame wrote:
Sun Nov 26, 2023 6:48 am
Yes, you can. Your biggest problem is likely to be due to the power being cut when the ignition is turned off.

You have two options. One is to make the Pi OS read-only, so that cutting the power has no negative effects (although you might have to deal with other issues). The other is to power the Pi from a permanent 12V supply unaffected by the ignition state, but this also has issues. For example, you'll have to disconnect the Pi from the battery somehow at some point to avoid draining the battery.

I suggest you use a permanent connection to the battery with a 5V converter to get your OBD stuff working then figure out how to make it play nice with the vehicle being turned on and off.
What If I were to just shut down the pi manually after every drive? Would that suffice to solve any issues that could happen with sudden power cutoffs?

ame
Posts: 8754
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Power for Pi in a car

Sun Nov 26, 2023 7:05 am

Soap2191 wrote:
Sun Nov 26, 2023 7:00 am
ame wrote:
Sun Nov 26, 2023 6:48 am
Yes, you can. Your biggest problem is likely to be due to the power being cut when the ignition is turned off.

You have two options. One is to make the Pi OS read-only, so that cutting the power has no negative effects (although you might have to deal with other issues). The other is to power the Pi from a permanent 12V supply unaffected by the ignition state, but this also has issues. For example, you'll have to disconnect the Pi from the battery somehow at some point to avoid draining the battery.

I suggest you use a permanent connection to the battery with a 5V converter to get your OBD stuff working then figure out how to make it play nice with the vehicle being turned on and off.
What If I were to just shut down the pi manually after every drive? Would that suffice to solve any issues that could happen with sudden power cutoffs?
Yes, of course. You might suffer a bit when the Pi starts up because the voltage can drop when the starter motor engages. But, the following steps might work:

Start car (12V supply dips)
Plug in Pi to constant 12V supply through 5V regulator
Do stuff
Turn off ignition (12V supply remains)
Issue shutdown command
Unplug Pi from supply

This will get tiresome eventually, but in the meantime you could probably get some useful data.
Oh no, not again.

Soap2191
Posts: 4
Joined: Sun Nov 26, 2023 6:25 am

Re: Power for Pi in a car

Sun Nov 26, 2023 7:16 am

ame wrote:
Sun Nov 26, 2023 7:05 am
Soap2191 wrote:
Sun Nov 26, 2023 7:00 am
ame wrote:
Sun Nov 26, 2023 6:48 am
Yes, you can. Your biggest problem is likely to be due to the power being cut when the ignition is turned off.

You have two options. One is to make the Pi OS read-only, so that cutting the power has no negative effects (although you might have to deal with other issues). The other is to power the Pi from a permanent 12V supply unaffected by the ignition state, but this also has issues. For example, you'll have to disconnect the Pi from the battery somehow at some point to avoid draining the battery.

I suggest you use a permanent connection to the battery with a 5V converter to get your OBD stuff working then figure out how to make it play nice with the vehicle being turned on and off.
What If I were to just shut down the pi manually after every drive? Would that suffice to solve any issues that could happen with sudden power cutoffs?
Yes, of course. You might suffer a bit when the Pi starts up because the voltage can drop when the starter motor engages. But, the following steps might work:

Start car (12V supply dips)
Plug in Pi to constant 12V supply through 5V regulator
Do stuff
Turn off ignition (12V supply remains)
Issue shutdown command
Unplug Pi from supply

This will get tiresome eventually, but in the meantime you could probably get some useful data.
Thanks that helps a lot. sorry taking your time. one last question though, i was going to plug this woth a basic usbc to usb a plug in but you mentioned a 5volt regulator. what is that? i dont know much. about electricity stuff atm,

User avatar
rpdom
Posts: 23354
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Power for Pi in a car

Sun Nov 26, 2023 7:26 am

Soap2191 wrote:
Sun Nov 26, 2023 7:16 am
i was going to plug this woth a basic usbc to usb a plug in but you mentioned a 5volt regulator. what is that?
It converts the 12V from your car into 5V for the Pi.

But if your car has a USB power socket that you are going to use, that should supply 5V anyway, so an extra regulator isn't needed.
Unreadable squiggle

W. H. Heydt
Posts: 16492
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Power for Pi in a car

Sun Nov 26, 2023 7:31 am

Soap2191 wrote:
Sun Nov 26, 2023 7:16 am
Thanks that helps a lot. sorry taking your time. one last question though, i was going to plug this woth a basic usbc to usb a plug in but you mentioned a 5volt regulator. what is that? i dont know much. about electricity stuff atm,
Pis run off a 5 volt supply. The specified tolerance is plus or minus 5%, so 4.75v to 5.25v. (That is not a full description, but it is the one you should stick with unless or until you become much more familiar with electrical and electronic systems.) Your cars electrical system is--nominally--12v. Actual battery voltage may be as high as 14.4v. A USB power adapter that plugs into what is now referred to as a power port (used to be called the cigarette lighter) converts the car's 12v to 5v. So much for voltage.

The other big issue is current, measured in Amperes. A Pi400 can require up to 3A. The typical car phone charger may or may not be able to provide that much current. You have to check the specifications on the device you use. Also, the general problem with any device that is called a "charger" is that it may not be able to maintain the nominal output voltage under load, especially when the current load approaches the rated limit. If the Pi isn't getting a high enough voltage, you will get a low voltage warning and eventually the the Pi will stop operating.

All of this is why you will very often see, when someone has a problem that looks like a power issue, the first recommendation will be to use the official RPT power supply unit (PSU) for that model of Pi.

So...my final suggestion is that you find a beginning book on electrical circuits and learn the fundamentals.

kip_the_elder
Posts: 723
Joined: Mon May 03, 2021 3:49 pm
Location: Third Rock from the Sun

Re: Power for Pi in a car

Sun Nov 26, 2023 10:42 am

I use Pi400s on a yacht as our main computers. They are used not only for the usual desktop tasks and development work, but also for boatie specific things like chart plotting and AIS.

The "background voltage" varies enormously...from its maximum when running the engine. It will be around 12 v when sailing and gradually goes down to around 10.5 volts when the batteries are completely drained(if I let it!!). That's about 50% of their capacity and lead acid batteries shouldn't be repeatedly discharged below that level as it affect their life. I would expect that the voltage change on your car system is unlikely to be as extreme as you don't run the amount of electrical and electronic devices that we do on a yacht, but you will still need to allow for some inconsistency.

I have experimented with the sort of 12v cigar lighter USB adapters. I found that they weren't able to provide enough current for the PIs. In fact...totally useless.

I have tried two different approaches that both seem to work. One is to use a SEPIC converter and wire it up yourself and the other which I've been using more recently...is to use a dedicated 12v USB socket that is rated at 3A. Both are cheap as chips and can be found on various online sites. I found with some of these devices that the claimed current can be a little optimistic. ;)

Without someway of preventing the pi from flattening the battery, you eventually won't be able to start the engine....though it would probably take a long time. It's not really an issue for us on the boat as we have two battery banks and always switch over to the house battery when the engine isn't running. The fridge and freeze will run the batteries down long before the Pis anyway, so I haven't put in any extra protection...On a car, the situation will be different.

One way that might achieve this would be to fit a smaller ancillary battery (say a motorcycle battery) connected via a motor-home style charging relay....That way, when the engine is switched off, the Pi should continue to run of the second battery without draining the first one. I've done this on motorhomes.

You also mention a small 7 in screen...how are you going to power that? It's quite likely that you will need to power that separately. I use 12v screens on the boat that are attached to the 12V fuse board.

All the electrical devices on our boat are connected via the fuse-board too as I'm not keen on the smell of burning fibreglass and neither are my insurance company. :shock:

I also think carefully about the wire that I am using, it needs to be up to the job of delivering the current that I need without getting too hot. The voltage drop will be more significant with lower voltage transmission than with higher voltages...That's why the leccy companies transmit power at thousands of volts and why big trucks use 24v instead of 12v.

Anyway..this is not a tutorial...I'm not a professional auto electrician! It's just my own experience

You really should, as others have said, learn some basic electrical theory before attempting something like this to avoid damaging the vehicle, the pi...or worse; injuring yourself.

Fair winds
Always be kind to beginner geeks. They will be the ones programming your ventilator. :)

W. H. Heydt
Posts: 16492
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Power for Pi in a car

Mon Nov 27, 2023 3:49 am

kip_the_elder wrote:
Sun Nov 26, 2023 10:42 am
You also mention a small 7 in screen...how are you going to power that? It's quite likely that you will need to power that separately. I use 12v screens on the boat that are attached to the 12V fuse board.
The RPF 7" touch screen runs from a 5v supply.

kip_the_elder
Posts: 723
Joined: Mon May 03, 2021 3:49 pm
Location: Third Rock from the Sun

Re: Power for Pi in a car

Thu Nov 30, 2023 3:43 pm

W. H. Heydt wrote:
Mon Nov 27, 2023 3:49 am
kip_the_elder wrote:
Sun Nov 26, 2023 10:42 am
You also mention a small 7 in screen...how are you going to power that? It's quite likely that you will need to power that separately. I use 12v screens on the boat that are attached to the 12V fuse board.
The RPF 7" touch screen runs from a 5v supply.
Yes, that's true...I've not used the RPI touch screen myself; but the OP didn't say what screen he planned to use.

I have a 7 inch screen (non Touch) which I use for another project. (It's used for navigation in conjunction with a Pi3). It can connect to a USB for 5v power; but I found that the Pi USB ports wouldn't power it, so I had to use a separate supply. It is in fact now connected to the ship's system via a SEPIC DC/DC board.
Always be kind to beginner geeks. They will be the ones programming your ventilator. :)

Return to “Raspberry Pi 400”