Build your own Android auto headup display

July 12, 2017

Purpose

Few years ago, Google unveils Android Auto. Only available for car manufacturers, this software is design to be integrated in car entertainment displays. Now it’s available in many cars (VAG, PSA, Ford, Mazda....) but only limited to new cars.

I have an old Peugeot 406 (+320 000 km) which runs perfectly. Without a GPS it is not possible for me to leave my house, so I needed something great with a good integration.

In this article, I’ll show you how I built my own Android auto head-up display. It took me 1 year to do all stuff, but only 1 month for Android auto integration. You will see differents parts such as :

Here is my experience ;-)

Evolution of the mounting

Casset reader

The original radio in the car is a 20 years old device, no CD (don’t talk about SD card or MP3….) only a FM/AM receiver and a casset reader. With this simple device, you can plug your phone and enjoy your music or make phone calls.

I had this solution for months, but we can make it better.

First tablet

For €79 I bought an Archos 70 xeon tablet. This device has a built in GPS, FM radio, 3G modem and micro SD slot. Maybe the perfect device that suits for a car integration. With a set of screwdrivers I disassemble all central head unit. The original radio K7 reader was removed, and also the LCD display. I kept heater command panel, I moved it to the bottom.

This tablet was fixed with 2 pieces of scratch which make it removable.

Audio amplifier

By removing the original radio, I also removed the built in audio amplifier. It’s easy to find another amplifier on Amazon. I chose a 300w amplifier for audio quality. Maybe a good choice.

Don’t forget to buy 2 ISO plug adapters with wires (see below) and let’s start soldering :)

Many wires to plug :

4 speakers (2 wires each), one ground, a permanent 12v and command wire (12v when you power on the car). Plug a jack - RCA cable and test it.

Wiring

Audio is done, let’s see how to power on the tablet :

a simple 12v USB converter does the job perfectly. Be careful to buy (at least) a 2A, most of them delivers 0.5A that is to low for a tablet (and also for a smartphone). Previously you found a 12v wire (after contact), just plug the converter to it.

GPS

Many apps does the job with openstreetmap in. Downloading all France and europe maps need a big SD card.

Problems

Second tablet mount

Now the Archos is replaced with a Lenovo tab A7. This tablet runs for 1 year.

Audio volume

A double potentiometer directly soldered on the jack rca cable. Remember that the best solutions are the simpler.

Volume and power buttons are now not needed, a better integration is possible.

https://www.amazon.fr/Potentiom%C3%A8tre-st%C3%A9r%C3%A9o-double-arbre-fendu/dp/B008XTB3Z6

Wiring explained here :

https://www.sonelec-musique.com/electronique_realisations_ajout_pot_volume.html

Play/Pause music

When charging, play music. Pause it when discharging. IFTT ? I think so ! Only a low level IFTT. Possible with Tasker. This app is not so easy to use, but so powerful that make possible everything you want.

https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=fr

Here is my configuration : wake up, show a picture (Peugeot Logo !) and play music.

GPS

Google Maps can go offline. Download the map before leaving home (with a wifi connection) is only perfect. Searching interest points, gas stations or everything you want is possible like online version.

Audio player

What is the best audio player ? In the car, the best is the app you can drive with a finger without leaving the road from your eyes. Poweramp is the best I tried. Big buttons and finger gestures are perfect.

https://play.google.com/store/apps/details?id=com.maxmpz.audioplayer&hl=fr

Phone calls

I tried many hacks or integrations with my phone. The main limitation is : Android kernel allows only headphone, speaker or bluetooth headset for a phone call. Maybe it is not the same stack used for audio players. The unique solution for integration I needed (use a tablet as a bluetooth Gatt device) implies a complete rebuild of Android.

During my searches on Amazon, I found the perfect device : https://www.amazon.fr/gp/product/B00JK0G8KC/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1 For €35 it allows to connect two devices : my android tablet and my smartphone. Audio quality is good, wiring very simple. It took only 10 minutes for integration.

In PowerAmp, there is an option for bluetooth ADP devices : play or pause music if the ADP is available or not. This makes Tasker deprecated.

Android Auto integration

So now, I thought that I had the perfect entertainment for my car. I used it for one year, does the job perfectly (GPS and music player). Make it better ? Google offers me this opportunity.

How it is designed

All over the web you can see demos of Android Auto (or Car Play) on headup display on new cars. It seems well designed and so easy to use while integrated software are often painful to use. No one tells us how Android Auto is implemented and integrated.

With some researches, here is what I found :

Android auto is just a remote screen. Nothing is generated by the car display. A H264 video stream is generated by the Android App on the smartphone.

Tap on screen are events thrown over usb protocol. Look at the source code bellow, it’s explained.

Well, retreive a H264 video stream from an USB source is something easy to do. A little piece of software on embedded Linux with hardware decoder is standard since many years.

Android 2.0 runs itself

Another solution developed by Google is a standalone mode. Each phone with Android Auto can be a head up display. You just need a handsfree kit for your car.

That’s a great idea… Not what I want.

Why ?

To run perfectly it needs an internet connection. Of course, my android smartphone can be a great gateway. Remember that I wanted a smooth solution as it is in modern cars.

Headup display

Debug

When Google released Android Auto, there was 3 parts :

https://developer.android.com/training/auto/testing/index.html

It’s name is DHU : Desktop Head Unit

In a terminal, with the last version of Android SDK :

➜  platform-tools ./adb forward tcp:5277 tcp:5277

* daemon not running. starting it now at tcp:5037 * * daemon started successfully *
android-sdks cd extras/google/auto/
    ➜  auto ./desktop-head-unit 

Remember to start Android Mobile App with developer mode on (See “Install DHU” in the documentation)

Here it is :)

It runs only in debug mode on Android Auto, but it gives a great overview of what is it possible to do with.

Let’s search for another solution...

Linux (Ubuntu version)

Most of my researches were on github only. I found this project :

https://github.com/gartnera/headunit

It turned on my attention with this :

https://github.com/gartnera/headunit/tree/master/ubuntu

This is an Ubuntu version of HDU. Not the debugging tool given by Google but a non official implementation for Mazda cars (I think…)

First operation is installing Protobuf compiler :

apt-get install protobuf-compiler

Then, some dependencies :

apt-get install libudev-dev libssl-dev libprotobuf-dev libusb-dev libusb-1.0-0-dev libunwind-dev glib-2.0 libglib2.0-dev libgstreamer1.0-dev libgstreamer1.0-alsa libgstreamer-plugins-base1.0-dev

Now try a make :

➜  ubuntu git:(master) make
    [...]
    /home/mathieu/Dev/headunit/hu/hu_usb.h:3:20: fatal error: libusb.h: Aucun fichier ou dossier de ce type
    #include <libusb.h>
                    ^
    compilation terminated.
    Makefile:46: recipe for target '/home/mathieu/Dev/headunit/hu/hu_aap.x64.o' failed
    make: *** [/home/mathieu/Dev/headunit/hu/hu_aap.x64.o] Error 1
    ➜  ubuntu git:(master) 
    

It fails on Debian because libusb is not well referenced.

I replaced

#include <libusb.h>
with
#include <libusb-1.0/libusb.h>

Now it works, just as the same with the debugging tool.

With this software, if you want (or you can…) have a Linux tablet into your car this is perfect.

Let see for an Android version.

Android compiled version

From the link above, while browsing trough the forks an angel came :-)

https://github.com/anod/headunit

If you are curious : browse the code

If you are upset with your original casset reader : build the APK.

Wiring again

Most of tablets does not have a dedicated port for charge. Several years ago, a USB port could only deliver 500mA which was insufficient for a such device. Now it’s the same for smartphones !

Now it is possible to deliver 1.5A with a short between D+ and D-. https://www.maximintegrated.com/en/app-notes/index.mvp/id/4803

That explains why there is no charge port on tablets. USB has enough power. But this is a terrible evolution for my wiring : I need a USB OTG (On The Go) adapter. This adapter is very simple, but it does not work with my phone plugged to the tablet. The USB port can not deliver enough power to charge the phone.

First try, use a powered USB Hub. Now it’s ok, phone is charging.

Is it possible to charge a tablet while using the USB port as OTG ?

Maybe yes it’s possible with a 100k resistor.

Note : this is not a standard, works for Samsung devices and most of others. https://forums.lenovo.com/t5/Windows-based-Tablets/Yoga-2-1051F-MicroUSB-charge-data-simultaneously/td-p/1834245/page/3

It works ! Charging both devices :-)

Pair both devices (phone and tablet) to your ADP device, plug the phone with a USB cable and voilà !