Menu

andipanda.dev

CaRadio: How Carlinkit Works with Raspberry Pi

In the previous article, I described how I searched for a way to run Apple CarPlay on a Raspberry Pi, experimented with pycarplay and carplay-receiver, and returned to the project almost two years later thanks to FastCarPlay.

But I barely explained why a Carlinkit USB dongle is needed in the first place and what role it plays in my head unit.

At first glance, everything looks fairly simple: connect the adapter to the Raspberry Pi, pair an iPhone, and CarPlay appears on the screen.

In practice, quite a lot happens between the phone and the image appearing on the display.

I'll try to explain how the system works without going into source code or the details of the protocol.

Why Is Carlinkit Needed?

When I first became interested in running CarPlay on a Raspberry Pi, I thought finding the right software would be enough.

After all, the Raspberry Pi has USB, Bluetooth, and Wi-Fi, and it's perfectly capable of playing video and audio.

But CarPlay isn't ordinary phone screen mirroring.

Establishing a connection and keeping it working requires a specific way of communicating with the iPhone. That's where the Carlinkit USB dongle comes in.

In my setup, the adapter acts as an intermediary between the phone and the Raspberry Pi.

It handles part of the communication required for CarPlay, while the application running on the Raspberry Pi exchanges data with it over USB.

This means I didn't have to implement the entire iPhone connection process myself.

However, Carlinkit alone doesn't turn a Raspberry Pi into a car head unit.

That requires software capable of communicating with the adapter and processing the data it receives.

How the System Is Organized

CaRadio involves several main components.

The first is the iPhone. Navigation, music apps, and other CarPlay features run on it.

The second is the Carlinkit USB dongle. It communicates with the phone and transfers data to the computer it's connected to.

The third is the Raspberry Pi. This is where my head unit software and the CaRadio application run.

Finally, there's the display, amplifier, and other parts of the car's system that make it possible to see the image, hear the audio, and control the application.

In simplified form, the setup looks like this:

iPhone ↔ Carlinkit ↔ USB ↔ Raspberry Pi → display and audio

Control also works in the opposite direction. When I touch the head unit's screen, the corresponding command has to make its way back to the iPhone.

That's why working with CarPlay involves much more than simply playing video.

Connecting the Phone

In my setup, I use wireless CarPlay.

It's convenient for everyday driving: I get into the car, turn on the head unit, and after a short while the phone connects without a cable.

However, a wireless connection doesn't mean that the Raspberry Pi communicates directly with the iPhone.

The USB dongle is still part of the system.

From the Raspberry Pi's perspective, communication takes place with the connected USB device, while the adapter handles the connection to the phone.

This makes things considerably simpler for CaRadio.

The application doesn't have to manage every stage of the iPhone's wireless connection itself. It communicates through the adapter's interface and processes the data needed to display and control CarPlay.

Where Does the Video Come From?

One of the first questions people might ask about a system like this is how the CarPlay image actually appears on the Raspberry Pi's display.

The CarPlay interface itself is generated on the iPhone.

The phone sends video data over the established connection, and the adapter delivers it to the application running on the Raspberry Pi.

The software then has to process the video stream and display the image.

This was exactly the part that caused problems during my early experiments.

Early projects used a browser or separate media players, such as mpv, to display the image.

Later, I tried modifying the video output to use VLC.

It didn't work particularly well: the image lagged noticeably, making the system inconvenient to use in a car.

When I returned to development and started working with FastCarPlay, I could tackle these tasks directly in C++.

In the current version of CaRadio, CarPlay video is integrated into my own application, which uses SDL3 for its interface.

This allows me to use a single head unit interface instead of a collection of separate programs.

What About Audio?

Video is relatively straightforward: the phone generates the image, and the Raspberry Pi displays it.

But audio is just as important in a car head unit.

Music, spoken navigation instructions, and other audio data also need to pass through the system and reach the car's speakers.

That's why CaRadio's software has to handle audio data as well as video.

In my setup, the Raspberry Pi is the main computing device, while a separate amplifier handles sound output.

This makes CarPlay part of the car's overall audio system.

However, processing video and audio are two different tasks. Even if you've managed to display the video stream, that doesn't mean the entire multimedia system is ready to use.

Touchscreen Control

Another important part is sending input back to the phone.

When I tap a button in the CarPlay interface, the corresponding action has to take place on the iPhone.

The Raspberry Pi's touchscreen doesn't know anything about CarPlay by itself. It simply reports touch coordinates to the application.

The software has to process those coordinates and send the corresponding event through the USB adapter.

The phone then responds to the action, and the updated image is sent back to the head unit's display.

This creates two-way communication: the phone sends video and audio, while the head unit sends control commands.

Without this, CarPlay would simply be an image that you couldn't interact with.

Why Simply Connecting the Dongle Isn't Enough

When I first bought the Carlinkit adapter, I wanted to see CarPlay running on my Raspberry Pi as quickly as possible.

And thanks to open-source projects, I managed to do exactly that.

But there turned out to be a big difference between getting CarPlay running for the first time and building a fully functional car head unit.

Displaying an image once isn't enough.

The system needs to start reliably, the phone needs to connect, video and audio need to work without noticeable problems, and touchscreen controls need to remain responsive and convenient.

A car head unit also needs to be integrated with the vehicle itself.

In my case, CaRadio has to power on correctly, respond when the ignition is switched off, and shut down the Raspberry Pi safely to avoid damaging the file system.

These tasks go beyond CarPlay itself and require additional application logic and hardware.

That's why CaRadio gradually evolved from an experiment with a USB dongle into a project of its own.

What Does CaRadio Actually Do?

Put simply, the Carlinkit USB dongle helps establish communication with the iPhone, while CaRadio turns the received data into a working in-car multimedia system.

The application communicates with the adapter, handles CarPlay video, audio, and touchscreen input, and integrates these functions with the rest of the head unit's logic.

That doesn't mean I developed the CarPlay protocol from scratch.

The software is based on ideas and work from open-source projects, especially FastCarPlay, which I studied and adapted to my own hardware.

For me, the main achievement wasn't simply getting CarPlay to appear on a Raspberry Pi screen. It was being able to use it every day in my car.

What's Next?

In this article, I've tried to explain the general principles behind the system without going into technical details.

There's much more behind each of these steps: USB data exchange, video stream processing, audio transmission, connection management, and integration with the application's interface.

Perhaps I'll explore some of these parts in more detail in the future.

If anyone wants to build a similar project or learn more about the software behind CaRadio, feel free to contact me by email. Where possible, I'll be happy to share my experience and some of the work I've done.

For now, what matters most to me is that the combination of Raspberry Pi and Carlinkit has proved perfectly suitable for everyday use in a car.