Petter Holt Juliussen • Mail | GitHub | Letterboxd

for later reference.

OpenAuto

2019-04-04 (2021-09-01)

OpenAuto is an AndroidAuto(tm) headunit emulator based on aasdk library and Qt libraries.

Requirements

Building


OpenDash

Installation

Using Raspbery Pi OS Lite for Raspberry Pi 4 Model B:

$ sudo apt install --no-install-recommends \
    xserver-xorg-video-all xserver-xorg-input-all \
    xserver-xorg-core xinit x11-xserver-utils \
    xserver-xorg-video-fbturbo \
    git
$ git clone https://github.com/openDsh/dash
$ cd dash/
$ ./install.sh
$ sudo apt install gstreamer1.0-plugins-good gstreamer1.0-omx

/home/pi/.xinitrc

#!/usr/bin/env sh
xset -dpms
xset s off
xset s noblank

while [ true ]; do
  sh /home/pi/run.sh
done

/home/pi/run.sh

#!/usr/bin/env sh
/home/pi/dash/bin/dash >> /home/pi/dash/bin/dash.log 2>&1
sleep 1

/home/pi/.bashrc

if [ "$(tty)" = "/dev/tty1" ]; then
  startx
fi

References

Splash screen

$ sudo apt-get update
$ sudo apt install fbi

/etc/systemd/system/splashscreen.service

[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target

[Service]
ExecStart=/usr/bin/fbi -d /dev/fb0 --noverbose -a /home/pi/splash.png
StandardInput=tty      
StandardOutput=tty     

[Install]
WantedBy=sysinit.target
$ sudo systemctl enable splashscreen
$ sudo reboot

References

Shutdown script

/boot/config.txt

dtoverlay=gpio-shutdown

/etc/systemd/system/shutdown.service

[Unit]
Description=GPIO shutdown button
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/python3 /home/pi/shutdown_button.py

[Install]
WantedBy=multi-user.target
$ sudo systemctl enable shutdown
$ sudo reboot

Wiring

wiring

References


Crankshaft

Crankshaft is a turnkey solution for the Raspberry Pi that transforms it to an Android Auto head unit for your car. Android will display your apps on the gorgeous 7-inch screen and gives you a car-optimized interface. Crankshaft helps you to drive distraction-free! It is designed to be an easy, fun and affordable project you can finish in a weekend morning.

Based on Raspbian.

Installation and upgrade

The latest release can be flashed to the SD-card using Etcher. To upgrade, copy (or unpack) the zip-file to the root of an USB stick (formatted FAT32/ext3/ext4, min 2GB) and reboot Crankshaft. To skip version check and force update, place a file named FORCE_FLASH on same USB stick.

GPIO

Pins are interpreted using BCM_GPIO pin numbers (-g flag) and set to use internal pull-up resistors.

# crankshaft_system_env.sh (defaults)
sudo /usr/bin/gpio -g mode $DEV_PIN up      # 4             --> 17
sudo /usr/bin/gpio -g mode $INVERT_PIN up   # 15            
sudo /usr/bin/gpio -g mode $X11_PIN up      # 13
sudo /usr/bin/gpio -g mode $REARCAM_PIN up  # 0 (disabled)  --> 27
sudo /usr/bin/gpio -g mode $IGNITION_PIN up # 0 (disabled)

Some GPIO pins (REARCAM_GPIO, IGNITION_GPIO) are monitored using a custom service called gpiotrigger, defined in /etc/systemd/system/gpiotrigger.service, continuously running the script /opt/crankshaft/service_gpiotrigger.sh which, in the case of the rear camera, creates the file /tmp/rearcam_enabledwhile the configured pin is LOW.

sudo service gpiotrigger start|stop|restart|status
journalctl -u gpiotrigger.service -f

RTC

crankshaft rtc ds3231

sudo dpkg-reconfigure tzdata # Europe/Oslo
sudo date -s "Aug 20 2018 22:36" # CEST
sudo hwclck -w
sudo hwclock -r # 2018-08-20 22:36:48.549503+0200

Customization

Graphical boot and shutdown [crankshaft]

Crankshaft uses Plymouth (provided with Raspbian) to provide a flicker-free graphical boot process. It relies on kernel mode setting (KMS) to set the native resolution of the display as early as possible, then provides an eye-candy splash screen leading all the way up to the login manager.

# Plymouth config file
/etc/plymouth/plymouthd.conf

# Splash and shutdown screen location
/usr/share/plymouth/themes/crankshaft/splash.png
/usr/share/plymouth/themes/crankshaft/shutdown.png

UI [openauto]

openauto/src/autoapp/UI/mainwindow.ui

Kodi

Installation

sudo apt-get update
sudo apt-get install kodi
sudo reboot

Building

The Crankshaft build system is (since crankshaft-ng) based on pi-gen, a tool used to create the raspberrypi.org Raspbian images. pi-gen runs on Debian based operating systems. Currently it is only supported on either Debian Stretch or Ubuntu Xenial and is known to have issues building on earlier releases of these systems.

Dependencies for pi-gen

apt-get install quilt parted realpath qemu-user-static debootstrap zerofree pxz zip \
dosfstools bsdtar libcap2-bin grep rsync xz-utils file git