Installation Details
PiBUS - Raspberry Pi in an IBus BMW
IBus is a low speed data network for Info-tainment implemented in BMW (and other) vehicles between the mid 1990s up to about 2010. Raspberry Pi is a small 'experimeters' computer with over 20 input/output connections available.
The iBus.hex and PiBus programs join the two together AND intelligently switch power, audio and video signals as required on a Mk3 or Mk4 Video Module.
+----------------------------------------------------------------------------------------------------------
The iBus program running on the interface circuit board switches power and video sources in response to certain iBus messages. It allows normal multi function display, or (when CDC mode is selected) XBMC output or (when reverse gear is selected) the image from a reverse facing camera to appear on the multi function display on the dashboard. The video sources may also be selected maually with the 'Phone' button (great for towing with a camera on a trailer).
If all you want is to add a reversing camera input then you don't need a Raspberry Pi computer, the interface board (with ibus.hex) will do that nicely.
+----------------------------------------------------------------------------------------------------------
XBMC running on a Raspberry Pi plays audio and video from any attached device - SD card, USB Flash Drive, USB hard disk, TV stick, etc.
The PiBus program running on the Raspberry Pi basically reads and writes the ibus to generate keyboard press codes from radio button presses. It makes XBMC think you are using a real keyboard and your BMW think there's a CD-Changer installed and operating.
+----------------------------------------------------------------------------------------------------------
To add a reversing camera your car must have an iBus with a BMW Mark3 or Mark4 video module connected to a multi function display (video screen), to run XBMC you must also have a CD Changer (not necessarily working - you just need its connections).
You will need to build a simple interface circuit (PiBus) to connect the Raspberry Pi to the BMW IBus.
_This circuit draws power from and communicates over the 3 wire IBus system.
_It directs video (W13, W14) and video switching control (B17) to the BMW's video module.
Note - If all you want is to add reversing camera input then this is all the hardware you need (plus a camera!).
_It switches power on to the Raspberry Pi when the vehicle is unlocked.
+==========================================================================================================
You will need a Raspberry Pi micro computer to run XBMC.
_Model B has twice the memory and extra USB sockets over Model A for only a few dollars more - recommended.
You will need to connect a Raspberry Pi to the interface circuit and to the CD audio cable.
_It sends fake status messages to the BMW's Instrument Cluster to pretend to be a CD Changer.
_It collects button presses and knob turns from the BMW radio head unit to pass to the XBMC program.
_It outputs video and stereo sound when the Infotainment system is in CDC mode (splice into CDC audio cables).
You will need an SD card to hold the software, the faster the better. 1GB min to 16GB max.
You will need a card reader on your PC (Windows or linux) to set up an SD card.
Optionally you will need a small TV camera - NTSC system (not PAL).
Optionally you will need an ATtiny programmer/burner (if you don't buy the preprogrammed kit).
The 2 circuit boards can be connected to any part of the IBus (different in each type of vehicle) but the audio has to go to the CD plug (pins 1-2 & 4-5) at either the CDC or the Amplifier end of the twisted cable run. The video has to go to the video module at White plug pin 13 (with video ground to pin 14). To switch the video a (pull down) connection also has to be made to Blue plug pin 17. If you don't have a White Plug (no Nav) almost any 2 pin plug (2.5mm spacing) can be used to connect to pins 13 & 14 and a little hot melt glue will keep it in place.
The optional camera (NTSC) also connects to the interface circuit (and is switched on or off by it).
For installation to the Raspberry Pi SD card -
+==========================================================================================================
Download and extract files from pibus-xxxxxxxx.zip (Translators/emulators between BMW IBus and Raspberry Pi)
Note - If you buy the preprogrammed kit you don't need to download this.
Note - If all you want is to add a reversing camera input then this is all the software you need.
+----------------------------------------------------------------------------------------------------------
Download and extract OpenELEC.img for Raspberry Pi (custom version of XBMC for Raspberry Pi)
Download skin.pm3-hd-bmw.zip DO NOT extract (Custom skin to match the display's resolution)
+==========================================================================================================
Download and extract win32diskimager
Download and install Paragon ExtFS for Windows (Allows Windows PC to read/write Ext formatted file systems)
Download and install Putty for Windows (Allows Windows PC to connect directly to the Raspberry Pi)
Note - you have to register to get a key for ExtFS, but they don't email bomb you.
Note - These 3 are NOT required for linux PCs.
+==========================================================================================================
Burn the ibus.hex file into the interface card (will be already done if you purchased a kit)
+----------------------------------------------------------------------------------------------------------
Run win32diskimager to install openelec onto your Raspberry Pi SD card (gets put into msdos formatted /System/)
(linux users can create, name and format the partitions, then use dd if=./openelec.img of=/dev/sdx but first find x!)
+----------------------------------------------------------------------------------------------------------
Put the SD card into the Raspberry Pi and connect the interface/Raspberry Pi to 12V (or the iBus) for 5 minutes.
On first run XBMC will create the directory system and configuration files it requires on /storage.
Disconnect the interface/Raspberry Pi and put the SD card back in the PC.
+----------------------------------------------------------------------------------------------------------
Run Paragon ExtFS for Windows (not required for linux) to add files to the Ext part of the SD card -
Copy the pibus-xxxxxxxx file onto the ext formatted part of the SD card (named /storage)
Copy pm3-hd.zip onto /storage (Note - do not unzip inner package)
Load some of your media content into /storage/xxx on the SD Card.
Note - while running /system is read-only and locked away, put all your config and media files on /storage
Note - ext file systems use a forward slash between directory names, not Windows style backslash.
Note - Windows file managers show disk names starting with upper case (even if they are lower case!), be sure to always type /storage with all lower case.
+----------------------------------------------------------------------------------------------------------
Connect your Raspberry Pi and PC to a network switch, then use putty from Windows to login (use ssh for linux).
User - root password - openelec address - xxx.xxx.xxx.xxx
edit (or create if not exits) with 'nano storage/.config/autostart.sh' then add this to the top of it -
#!/bin/sh
/storage/pibus &
The first line (above) creates a program space (called a SHell), the second points to and runs the pibus program in that shell and finally the '&' makes the program space move into the background so that other programs (like XBMC) can run too.
Make the pibus programes auto run with these commands -
chmod +x /storage/.config/autostart.sh
chmod +x /storage/pibus
Be quick, the Pi will shut down after 5 minutes without IBus activity!
+----------------------------------------------------------------------------------------------------------
Connect the interface/Raspberry Pi to the iBus, amplifier and video module for testing.
After 20-30s (depends on speed of SD card) you will be able to select CDC.
The size of the writting on the screen is too small with the standard skin so you should use the 'Settings | System | Addon' menu in XBMC to load in the pm3-hd-bmw.zip. Use 'Settings | System | Video Output | Video Calibration' to adjust the skin to the correct screen size.
Try out your new media centre!
+----------------------------------------------------------------------------------------------------------
Note - not all media will play on the free version of openelec, you need to buy some codec keys!
You will need you Raspberry Pi's unique hardware ID in order to buy codec keys to match your Pi, so go to -
Settings | System | System Info | Hardware | serial - write down the 16 digit serial number.
Go to the
http://www.raspberrypi.com/license-keys/ (purchase vc-1 & mpeg2 at least!)
Put the SD card in your PC. The /system partition is msdos formatted, so just edit /system/config.txt to add license keys for the codecs bought from
www.raspberrypi.com
remove the # at the start of each codec ID and replace the '0x00000000' with the correct key.
+----------------------------------------------------------------------------------------------------------
Once the system is working properly redirect auto log writting by linking it to the null device (otherwise your SD card will fill up with the log and leave no operating space for any programs to run!) -
Connect your Raspberry Pi and PC to a network switch, then use putty to login (use ssh for linux).
User - root password - openelec address - xxx.xxx.xxx.xxx
cd /storage/
rm ibus.txt
ln -s /dev/null ibus.txt
reboot
+----------------------------------------------------------------------------------------------------------
To use putty (or ssh) you will need to know the network address of the Raspberry Pi. Connect to your ADSL or cable modem and view the LAN connections or use a network mapping program like Nmap to find it.
I used nmap 192.168.1.0/24 | quick scan before and after connecting the Raspberry Pi to see which address it got.
Other networks to try are 192.168.0.0/24 or 10.0.0.0/8
+----------------------------------------------------------------------------------------------------------
Run a USB extension cable from the Raspberry Pi to your glove box or centre console. XBMC will scan any device plugged in looking for pictures, music and videos, etc directories to add to its content. You may need a powered hub if you are using a hard disk for your media.
+----------------------------------------------------------------------------------------------------------
Plug a TV stick into the Raspberry Pi and run antennas to the rear windows. XBMC will pick up the live TV content.
+----------------------------------------------------------------------------------------------------------
Alternate startup method -
Delete the entry in /storage/.config/autostart.sh and use putty to run crontab 'crontab -e' and add this line -
@reboot /storage/pibus &
+----------------------------------------------------------------------------------------------------------
Want to show XBMC on additional screens? White plug pin 2 is extra video out (ground on pin 11)
+----------------------------------------------------------------------------------------------------------
My next post will show where I put my PiBus in my L322 Range Rover.