My Volt does not have built-in navigation nor reverse camera. So why not build a display unit to do that?
Requirements:
- Displays video from reverse camera (composite video input)
- Displays offline maps and/or navigation through a smart device (HDMI, VGA, or composite video input from a smartphone, Raspberry Pi, etc.)
- Automatically switches to reverse camera when shifter is in R position
- Has brightness control (important for night time)
- Integrates well into the car interior
Steps, in no particular order:
- Find a suitable LCD and a driver for it
- Find a reverse camera
- Set up a smartphone to display maps
- Build an automatic input switch and connect it to the shifter
- Figure out power needs and best way to wire and place everything in the car
- Design and print an enclosure/holder for the LCD to fit in the compartment above the center console
- Design and print a holder for the smartphone
My trusty and crusty old Samsung Galaxy S5 has all that functionality, even video output to HDMI via MHL.
What I want the device to do is:
Boot as soon as I start the car (i.e. device is connected to power).
Launch a navigation app after booting.
Shut down if the car is off for some time (i.e. device is not connected to power but has some battery left)
For the map/navigation application, I chose Organic Maps, as it is lightweight, has a great interface, and works offline. I have used it for many years now. Other options I considered:
OsmAnd - more customizable, the OG of OpenStreetMap navigation
Osmin - similar to Organic Maps, and works great on Linux (Raspberry Pi, PinePhone etc.)
Boot on plug
The recommended method is to enable this function through fastboot. This does not work on Samsung devices, though, but I will leave it here for reference. Boot to fastboot mode (aka download mode) on the device. Install fastboot on main machine and run:
fastboot oem off-mode-charge 0
Since my device is a Samsung, I rooted it with Magisk, and then downloaded and installed Magisk Autoboot module. Although their documentation states it works for Android 7, I could not get it to work with custom Lineage 14 (Android 7 equivalent) for some reason. On a clean Lineage 15, it works, and S5 takes about a minute to boot after connecting power.
Launch app after boot
I installed Termux and Termux:Boot via F-Droid, and ran Termux:Boot once to initialize it.
Note: There are multiple ways to shut down an Android device, and many of those commands work fine in user's Termux session, but are very slow and buggy when they are run through crontab.
Putting it all together: (with an extra spoken message using another API)
This sets a wakelock (to prevent Android from killing the long-running crond process), and then launches crond. Every minute, cron runs the script, which checks the battery percentage and status, and shuts down the device if the specified conditions are met. Although shutdown command requires root, root privileges...