I’ve been using Crankshaft for about a year now, with a Raspberry Pi 3 attached to the 7 inch touch screen display just dropped into the center console with the default fascia removed. It eventually led to a cracked display, which has been mostly glued back together. Still fully operational.

Now I wanted to upgrade to Android Auto Wireless and decided to go for OpenAuto. I wanted to keep my built in radio because it has all the requirements such as a proper amplifier, Bluetooth A2DP and HFP, and steering wheel controls. This was found not to be a problem.

This was written after the fact, so I hope I noted down all required steps. If I find out I missed anything, I will update this post.

Ingredients

What I needed (/used) was the following:

You’ll notice that, contrary to OpenAuto requirements, I don’t use an external sound card or Bluetooth adapter. The Raspberry Pi built-in devices will make OpenAuto not complain, and since I’m using my car stereo for the HFP and A2DP Bluetooth protocols, they’re not required or even used on the Pi. I just use Bluetooth to trigger the Android Auto Wireless startup.

Installation

I won’t go into writing images and such, there are plenty of guides out there to help you with getting the image on an SD card.

Raspberry Pi OS changes

Since OpenAuto disabled the built-in sound card and bluetooth by default, we need to re-enable them. This is harderly said than done. We just need to change the following in /boot/config.txt:

dtparam=audio=off

to

dtparam=audio=on

If you cannot find the above line, just add it.

This will enable the built in soundcard. The OpenAuto forum also states to remove the line blacklist snd_bcm2835 from /etc/modprobe.d/raspi-blacklist.conf, although that line didn’t exist in my image. Check it anyway.

The next is to enable the built-in bluetooth module. We do that in the same file (/boot/config.txt). Just comment out the following line:

dtoverlay=pi3-disable-bt

Now reboot.

When that’s done, we need to pair our Phone using Bluetooth. Go to the desktop environment, and in the top right click on the Bluetooth icon and make it discoverable. On your phone search for OpenAuto-Pro and pair it. Verify on both devices you want to pair.

Disable HFP profile

To not have calls routed to our audio-less Pi, we need to remove the HFP profile in BlueZ. For this we need to do a few more steps. This can be avoided by disconnecting bluetooth after Android Auto has started. Bluetooth isn’t required once Android Auto has started, it only triggers its connection and is used to exchange WiFi credentials. I haven’t found a reliable solution for this yet, see TODOs.

First, we need to re-enable the use of sdptool in BlueZ. For this you need to add --compat to the CommandLine entry in /etc/systemd/system/bluetooth.target-wants/bluetooth.service. Now run sudo systemctl daemon-reload and sudo systemctl restart bluetooth and we can use sdptool again.

To disable the profile, we need to know its identifier. Run sudo sdptool browse local to list all services, and find the one which mentions Handsfree. On my device it has ServiceNumber 0x10003. To disable it, I had to run sudo sdptool del 0x10003.

Done!

Now all my calls are nicely routed to my car stereo instead of the Raspberry Pi.

OpenAuto configuration

Now we need to do some configuration in OpenAuto itself. In Settings -> Android Auto -> System enable Wireless Android Auto.

Next in Settings -> Android Auto -> Audio disable both Multimedia audio channel and Speech audio channel.

Next under Settings -> Android Auto -> Bluetooth, select Local.

Finally under Settings -> Wireless set the hotspot to 5GHz and enable it.

Android Auto configuration

Almost there.

Some changes need to be done on your phone itself. Go to the Android Auto settings (in my case Settings -> Apps -> All apps -> Android Auto -> Additional setting in the app.

From there scroll to the bottom and tap Version and permissions info multiple times until developer mode is activated.

Now in the top right dot menu go to Developer settings and enable Add wireless projection to settings. Now go back and enable Wireless Android Auto.

All done.

Connect to OpenAuto via Bluetooth, and everything else such as WiFi should be taken care of by Android Auto.

Automate connection

I used the app Automate to connect to OpenAuto automatically after my phone connected to the car radio. Since neither the Pi nor Android connect automatically, this automation avoids the requirement of opening Bluetooth settings and connecting to the Pi. Such a relief.

IMAGE

An oddity here is that I had to use the PAN profile and then the HFP profile to have it actually connect to the Pi and start Android Auto.

TODOs

What’s a project without TODOs? Yes, a project that’s done…

So still work in progress is the following:

Use the 12V illumination signal from turning the headlights on or off to switch the day/night mode in OpenAuto

For this I need something to convert an unstable (i.e. fluctuates heavily depending on draw from the starter and charge from the alternator) 12V signal to a 3.3V signal on a GPIO pin. An optocoupler should do the trick. Just need to get one.

Do a clean shutdown

My thoughts here are to have a small (400 mAh) LiPo battery, with an Adafruit PowerBoost 500 (or 1000) to keep it powered and have it shut down when the battery is no longer being charged (i.e. power is cut). Then I’d need to have it signal to the Pi to start up again if charging is restarted. In this case there’d never be a device draining power from the car battery, and I won’t mind draining the LiPo battery if the car stays unused for a while.

This will have the added benefit of the Pi staying on when starting the engine, as at that time power is cut to accessory in this car.

Even the PowerBoost 1000C device isn’t able to provide enough power to the Pi and display, so I’d need to also power it directly. Perhaps split the power directly to the Pi, and also to the charger, and then connect the charger to the 5V GPIO pins?

Sync the clock

OpenAuto provides and app to sync the clock over Bluetooth, although that also happens when you first start OpenAuto. So the app isn’t required for it, and €10,99 seems a bit steep for clock sync. Perhaps Bluetooth tethering works, so the Raspberry Pi can just use NTP. Although if I can use the illumination signal to trigger day/night mode, I don’t really need time sync.

Disconnect bluetooth when running

This will prevent the Pi hijacking any audio channels which the radio takes care of. One option is to have Android disconnect, but neither Tasker nor Automate seem to be able to disconnect a Bluetooth connection.

Another option is to have the Pi disable Bluetooth when Android Auto is running. This would need some sort of watchdog on the Pi.

Oddities

  1. Not sure if its the case, but it seems, contrary to what the OpenAuto devs state, the Raspberry Pi built in bluetooth does support the HFP profile, making external Bluetooth adapters an unnecessary and wasteful requirement.

  2. If Android Auto Wireless doesn’t seem to start, ensure there’s no firewall or VPN or anything blocking the app. I spent some time finding out that while Android Auto was allowed connections in NetGuard, I needed to disable ‘Apply rules and conditions’ for Android Auto for it all to work.