Crankshaft (OpenAuto)
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.
- Homepage
- opencardev/crankshaft - GitHub
- r/crankshaft - Reddit
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_enabled
while 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
Build stages
- Stage0:
- Stage1:
- Stage2:
- Stage3:
OpenAuto
OpenAuto is an AndroidAuto(tm) headunit emulator based on aasdk library and Qt libraries. The main goal is to run this application on the RaspberryPI 3 board computer smoothly.
- opencardev/openauto, forked from f1xpl/openauto - wiki
Requirements
- Qt libraries
- CMake
- RtAudio
- Broadcom ilclient from RaspberryPI 3 firmware
- OpenMAX IL API
- Boost libraries (> 1.58)
- libusb
- Protocol Buffers 3 [building/installation]
- OpenSSL
- Google test framework
- aasdk [opencardev/aasdk, forked from f1xpl/aasdk]
Building
- https://github.com/opencardev/prebuilts/tree/master/buildsystem
- https://github.com/petterhj/cpp-openauto-mods
Update Crankshaft
scp openauto/bin/autoapp pi@192.168.1.17:/home/pi
aasdk/lib/libaasdk.so >>> /usr/local/lib/libaasdk.so
aasdk/lib/libaasdk_proto.so >>> /usr/local/lib/libaasdk_proto.so
openauto/bin/autoapp >>> /usr/local/bin/autoapp
openauto/bin/btservice >>> /usr/local/bin/btservice
sudo mv /usr/local/bin/autoapp /usr/local/bin/autoapp_bak
sudo chmod --reference=/usr/local/bin/autoapp_bak /usr/local/bin/autoapp
sudo chown --reference=/usr/local/bin/autoapp_bak /usr/local/bin/autoapp