Skip to content
All projects

05Portfolio

led-auto — a Bluetooth gateway for a Golf IV

A gateway on a Raspberry Pi Zero 2 W in my Golf IV: it switches on the entry light when a door opens and controls the LED strip, and it talks to the phone over an encrypted channel. It works in the car with the Android Auto panel. I checked its logic automatically in every possible state.

By the numbers

Rules checked in every state
18
Automated tests
154
Planted bugs caught by tests
10/10
01

Problem

The LED strip controller in the car accepts a single Bluetooth connection, so a phone and a second controller would end up fighting over it. Nothing tells the lights that a door is opening — the factory lock exposes just two bare signals: latch position and door state. On top of that, the strip controller has no encryption and never reports its state.

02

Approach

I wrote a C++ program for the Pi Zero 2 W that reads four signals from the door locks and is the only thing that controls the LED strip, so nothing fights over the connection. A voltage divider brings down the car’s supply voltage, and brief interference is filtered out. The phone running WireAmbi connects to the gateway over the encrypted WireLink channel, byte-for-byte compatible with the app’s version. Pairing means comparing six colours on the strip and on the phone, then confirming by opening the driver’s door. I kept the gateway’s logic separate from the hardware, which let me check it automatically in every possible situation: 12.6 million states and 18 rules. Among them: only one device controls the strip, the gateway spares the car battery, and the entry light always comes on. Remote access goes through an encrypted relay and deliberately cannot unlock the car.

03

Outcome

In the car the gateway does what it should, and I checked it on a test bench with real lock inputs first: opening a door switches on the entry light, closing it brings back the colour set on the phone, and locking the car after getting out turns everything off. It is prepared for sudden power loss and came back clean after three hard resets. It uses about 11 MB of memory, and delays in its loop stay at 1 ms or less. In the car it works together with the Android Auto panel. The code for the windows, central lock and mirrors is written, but I have not wired those functions up in the car yet.

Write