Integrating an Android Infotainment Head Unit with a Mercedes’ CAN Bus
RND_ASH integrated his Android head unit into the CAN bus of his Mercedes in order to control all of the car's systems and read their data.
The stock stereo head unit in most older cars was a discrete device that didn’t interact with anything else in the car. That made it very easy to swap out the stereo without affecting the rest of the car. But newer cars often have infotainment systems that are heavily integrated with the rest the car’s electronics. For example, your car’s infotainment screen may contain the controls for the climate control system. Your steering wheel may also have buttons for controlling your music. That means that installing an aftermarket stereo could affect many other features. To get around that, RND_ASH integrated his Android head unit into the CAN bus of his older Mercedes.
All modern vehicles have a controller area network (CAN) bus that makes it possible for all of the car’s various electronic systems to communicate with each other. Generally, everything from the engine control unit to the power window controls are connected to the CAN bus. In an older car, your turn signals were probably connected directly to the stalk switch through a relay. Today, the switch in the stock can just be part of the CAN bus, which then sends a message to turn on the indicator light. If you can connect to that CAN bus and are able to understand the messaging protocol, you can read the data being sent between systems and also inject your own commands.
In this case, RND_ASH is both reading and sending data on the CAN bus. His Android head unit wouldn’t have normally been capable of doing that, which is why he connected an Arduino Uno with a pair of CAN bus shields. After doing a lot of programming, he was able to successfully read messages from the CAN bus. He then developed a custom interface for the Android head unit to display that data. It can, for instance, show the current engine temperature, RPM, fuel consumption, climate control settings, and even window positions.
Controlling the cars systems through the Android head unit required injecting messages into the CAN bus. First, RND_ASH had to do a lot of reverse engineering to decipher the way messages are encoded. He was then able to send his own messages through that Arduino and CAN bus shield. This gave him complete control of every system connected to the car’s CAN bus. For example, he created a “light show” by turning on and off the exterior lights in a pattern. The final step was to integrate the steering wheel media controls and the status screen in the center of the dash. That screen wasn’t even functioning before, but now, after all of this hacking, he can show whatever he wants on the display. The specifics will vary wildly based on the specific car model, but RND_ASH’s work is a great example of what you can do with your CAN bus.