Connecting a BMW to the Internet — Part One

Trent Seed
Design and Tech.Co
Published in
7 min readNov 3, 2018

I’ve decided to kick off my personal blogging by going through a recent project; connecting my BMW to the internet. By the time you finish this blog series, we will have walked through the project motivation, architecture, and will have examined the code necessary to interact with an E46 BMW wirelessly from your mobile device and smart watch. The full source code can be found on GitHub.

Motivation

I am among the many individuals who commute from the peninsula to San Francisco practically every day, and endure an hour to an hour-and-a-half each direction. I needed to find a way to optimize all of this time being spent (up to ~10 hours / week). An additional motivator for this project was the fact that the original navigation unit in the vehicle had an increasing number of dead pixels.

While viewing the navigation unit screen, I made an observation that it was just about the size of a Nexus 7 tablet, perhaps the perfect size. After taking measurements and looking for compatible double DIN (ISO 7736) bezels, I was determined to make the swap. By installing an Android tablet, and integrating it with the vehicle steering wheel controls, I would be able to listen to Audible, Google Play Music, Pandora, and even launch Netflix with an integrated, hands-free interaction. I was ready to get started!

Architecture

In order to change the music from the steering wheel, there needs to be communication from the vehicle to the tablet. The vehicle bus, in this case IBUS, is not wirelessly accessible. Therefore, we need to introduce a gateway to make this possible. This is where a Raspberry Pi comes into play, which will be responsible for wireless, bi-directional communication via Bluetooth.

To integrate the components, we will tap in to the BMW Navi Harness cable (which is disconnected from the OEM headunit). There are 12 pins on the blue adapter and we are interested in 3 of them. We need access to 12V power (red wire), ground (black wire), and the IBUS (yellow wire).

The IBUS USB Adapter can be purchased online, or can be built from scratch if you’re up for the task. The adapter connects directly to the three wires mentioned above, and provides a USB connection which we will connect to the Raspberry Pi.

We have also introduced a USB 12V to 5V power adapter to ensure the Raspberry Pi and tablet are powered from the vehicle with an appropriate voltage. The Raspberry Pi will be responsible for listening to activity on the IBUS and exposing it via Bluetooth, as well as receiving commands via Bluetooth and writing to the IBUS. I’ve wired an Ethernet cable from the Raspberry Pi to the vehicle glove box, so that once everything is installed we still have a way to access the Raspberry Pi and make any necessary modifications.

The 7″ tablet will need 5V power and a standard 3.5mm connection for audio output. If the OEM headunit / radio is removed, how will the tablet’s audio connect to the vehicle speakers? Fortunately, I learned after removing the headunit that E46 BMW’s keep the primary radio unit in the trunk of the vehicle, and the headunit at the front of the vehicle is merely a controller. When the headunit is removed, there is still a 3.5mm audio connection available in the wire harness.

To add to the experience, I installed a portable media server that emits Wi-Fi, in this case a Netgear PR2000, so that local content of music and movies can be streamed to the tablet. This device also requires 5V power which we are leveraging from the USB Power adapter. The tablet itself only has 16GB of storage, so the media server makes it possible to store and access significantly more content.

Now that we’ve covered the necessary components and how they interact from a high-level, let’s dive into a brief background on IBUS.

Background on IBUS

A bus is a shared communication link that enables nodes to broadcast and consume data. Rather than wire each device directly to each other in the vehicle, each device simply needs to be connected to the shared communication link. In automotive applications, there are two popular bus architectures: CAN bus and LIN bus.

BMW IBUS, based on ISO 9141 and K-Bus, is essentially a second K-Bus in the vehicle for interfacing between the radio, navigation, windows, seat controls, or any other connected system. Mission critical components such as airbags, ASP, AGS are not connected to the IBUS.

IBUS employs a single physical wire that runs throughout the vehicle which is used to send and receive data. The physical layer of the bus is an open collector, pulled high (+12V) by the bus, and pulled low by the communicating device. Transmitting bits of data is achieved by briefly shorting the bus with ground.

An IBUS packet is comprised of a Source ID, Length, Destination ID, Data, and XOR Checksum. The length represents the number of bytes to read through the destination ID, data of variable length, and checksum. The XOR checksum is provided to verify the integrity of a packet; the receiver will calculate a checksum based on the source, length, destination, and data to confirm a match with the expected checksum.

Please refer to I-BUS Inside written by Franck Touanen, which is a great resource that I referenced heavily during this project.

Now that we’ve covered a brief background on IBUS, we are ready to proceed with the installation process!

Installing the Components

This blog series is for informational purposes only, and any modifications to your vehicle are at your own risk and are not recommended. With that being said, this section details the steps I went through to install the necessary components:

  1. Remove interior panels
  2. Remove the OEM headunit
  3. Install the USB 12V to 5V Power Adapter
  4. Install the IBUS USB Adapter
  5. Install the Raspberry Pi
  6. Install the 7″ Tablet
  7. Reinstall interior panels

To replace the OEM headunit, we begin by removing two panels in the vehicle. Once the two panels are carefully removed, the OEM navigation unit can be removed by sliding it out, and disconnecting the two adapter cables (one white, one blue).

There are many helpful videos on YouTube that detail how to remove the interior panels and OEM headunit (here’s one of them).

Once the OEM navigation unit is out, we have the area necessary to install our Raspberry Pi, media server, and additional components. I began by identifying the three wires (power, ground, IBUS) on the blue adapter which was disconnected from the headunit, and installed wire taps. In general, wiretaps are not the way to go for long term installations, it would be better to have a strong, soldered connection. Fortunately, it’s been about five years since I installed the wire taps and they’re still working well.

With the three essential wires tapped, we can proceed to install the USB power adapter by connecting with the power and ground. From there, we can install the IBUS adapter by connecting with the power, ground, and IBUS wires. The USB power adapter is all we need to power the Raspberry Pi and tablet components, since they take a standard 5V micro USB connection.

One everything is connected, I recommend to organize the components and wires a bit, including leaving some details on the devices themselves such as IPv4 address. Knowing the static IP allows us to plug the ethernet cable from the glove box into a laptop, and connect over SSH to the Raspberry Pi.

The final step is to install the tablet, and reinstall the panels. I found a double DIN bezel online that I connected to the front of the tablet.

Once the tablet has been attached to the bezel, you may replace the panels. I used electrical tape to connect the tablet. Having this in my vehicle for the last 4–5 years, I can say electrical tape has been by far the most reliable. I used duct tape and it could not withstand hot summer days. The components installation is now complete!

In part two of the blog, we’ll explore the code powering the Raspberry Pi and mobile application.

Follow Here.

--

--

Trent Seed
Design and Tech.Co

I’m a startup Co-Founder and Chief Architect of Oomnitza. Areas of interest include Internet of Things, Chatbot Architecture, and Domain-Specific Languages.