Openauto - Android Auto Head Unit Emulator For Raspberry Pi 3

Made by f1xpl

About the project

Optimized for Raspberry PI 3 hardware. Supports video hardware acceleration. Projection up to 1080p@60. Supports Google Voice Assistant.

Project info

Difficulty:

Categories:

Automotive

Platforms:

Raspberry Pi

Estimated time:

3 months

Published:

21st February 2018

Items used in this project


Hardware components

2.1A Power Supply x 1
Microphone x 1
USB Sound card with Microphone Input x 1
2733 w/ Raspberry Pi 3 x 1
7'' Display with touchscreen x 1

Software app and online services

OpenSSL library
Google protobuf library
libusb
Boost C++ Libraries
CMake
Ubuntu Linux
Qt Creator
Qt libraries

Story


About OpenAuto

OpenAuto is an emulator for the Android Auto head unit. Main goals of OpenAuto are portability, efficiency and re-usability.

OpenAuto can be deployed for the most popular platforms like Windows, Linux and thanks to the implementation of video hardware acceleration also on the Raspberry PI 3 computer.


Ways of usage

Main purpose of usage is to test Android Auto applications in conditions similar to real head unit.

Due the fact that OpenAuto can be deployed also on the Raspberry PI 3, it gives a possibility to create your own head unit based on the Raspberry PI 3 hardware. Nevertheless, you should always care about safety and keep in mind that OpenAuto is just an emulator. It was not certified by any authority and was not tested in driving environment.


How does it work?

At the beginning of the development I aimed that OpenAuto should act as a regular Android Auto head unit. The only effort for the end user should be build the source code, configure system's environment and plug in the device. Another goal was to provide user-friendly settings for quick and simple customization of Android Auto projection.

Under the hood OpenAuto uses several C++ libraries like Boost.Asio, Qt and libusb. Boost.Asio provides scalability. Scalability was very important in order to run OpenAuto on the embedded platforms. Qt library is used to create GUI and manage playback of audio and video streams. USB communication with the Android headset is done using libusb library.


"Getting into troubles"

In the middle of the development process, project underwent huge refactoring regarding error handling. Because OpenAuto communicates with the headset in asynchronous manner, previous error handling mechanism was not enough to cleanup or restore projection after error. New solution is based on the promises philosophy similar to this from node.js. Implementation of the solution based on promises took almost two weeks.


"The embedded nightmare"

When the project was up and running on the PC it was time to deploy it on the Raspberry PI. The biggest problem that I faced was very slow video playback that made OpenAuto unusable on the Raspberry PI. The root cause was lack of VideoCore4 hardware acceleration support in Qt libraries. Solution for this problem was dig into OpenMAX documentation and implementation of H.264 video player with hardware acceleration support. With the new video player OpenAuto is able to handle projection up to 1080p@60.


Final result



Code


Credits


Leave your feedback...