I have an android based headunit (radio, dvd, GPS, TV) in my car and powering off the car will cause occasional issues. I’ve had data corruption issues once in the year I’ve used it.
Some people who have them installed, have setup a system where the unit is powered for a short time after the key is off, to enable clean shutdown, then the power is removed after that.
Just like a UPS would handle a power failure and server shutdown, but with the car battery supplying the actual power.
People who use the Pi in an automotive environment must have a similar solution.
I’d search some automotive related forums to see what other Pi users have used.
The UPS Pico would seemingly support that function, but I don’t know if the playback state would be saved when a os shutdown command was issued.
@sam_nazarko Do you have to send a stop command or will a normal shutdown do that ?
Wouldn’t it be better if you’d use one of the GPIO inputs for sensing terminal 15 (ignition) status and write piece of code to pause/stop playback when ignition goes off?
PI would have to be hardwired to terminal 30 (constant +12V) and left like that. Amount of energy it consumes is nowhere near the amount needed to discharge yor battery even in couple of weeks .
I’m no expert in linux so can’t help with code but I can certainly help with automotive electrics/electronics.
This is the way of all electronic units are being awaken and put to sleep when you turn on/off you car.
I have a Pi 2b Set up in van, with iPassPort keyboard (here)
Run it off a usb mini power converter similar to this. Usb power plug is almost rooted.
Powered from 12V accessories.
I have a 2TB toshiba 2.5 in portable drive plugged in that on the odd occasions shows the rainbow box in top right corner on boot up.
Also a TP-Link usb wifi (TL-WN725N 150Mbps Wireless N Nano USB Adapter) to allow van to connect to home wireless for updates etc.
Standard Video out (not HDMI) connected to RCA inputs in car (correct cable requried, check here)
Did play with UPS Pico for a while, very technical, got it working, albeit, couldnt get the voltage drop sorted due to External USB HDD (Check here for details)
UPS Pico eventually had a fit, and am waiting for the new version from Europe.
All that said, most times we remember to stop the movie (X Key), and sometimes I bother to shutdown.
Lots of times I have shutdown with movie paused, or even playing.
Had this running since about July 2015 (at time of writing this, over 1.5 years.)
Only had one file corruption, but was easy to diagnose and replace.
I have had this working now since this post. The problem comes is that strange things happen when you violently stop the device by cutting power. The first instance was, boot failure. I had to rebuild the whole system and library.
The second instance is that the library files get “unmapped” from OSMC. Basically, you boot in and go to Movies and press play, and nothing happens. But then if you navigate to Videos > Files > SANDISK32 > and click on a title, they play correctly. The issue here is that since the dropdown screen is in the back for the kids, navigating menus is very difficult.
So I am looking at perhaps rebuilding this, or finding a way to make it more streamlined. This is running on an old Pi 1, and boot up is quite slow.
Do you think I would have better performance on a newer Pi 3? Was considering putting in a TFT display and running that up to the cockpit so that the car passenger could control playback with touchscreen… maybe.
I think I am going to try different approach, possibly. Plug a chromecast into an HDMI to AV converter and power both via USB. Then connect an old phone to network sent out by chromecast and use android mirroring for playback of local media stored in 60g sd card.
Would help with corruption issues, be a smaller form factor, and less configuration.