>

HOWTO: DIY IBus iDevice dock - including MFSW + track info

I know its not finished but :bow:

Im guessing the car looks for the cd changer on start up, so presume you cant switch between the two during a journey.
 
Ok - big update on this :)


I've now settled on using a Raspberry pi (called RPI from now on), as the micro Fez just wasn't working well with the iBus.

What I've discovered:

  • You can switch the cd changer on or off the IBus at any time. When you press the mode button, the radio sends a request to see if the cd changer is on the IBus, and if it is, it shows up as an option you can switch too on the radio. Because of this, you can switch between the changer and the RPI on the fly as it were :thumbsup:

  • The RPI will take about 3 seconds to "go live" when turning on the car. This is the fastest I can get it to boot. Not instant, but not really any longer than it takes the cd changer to "check cd"

  • Its very possible to implement phone control - so you can answer calls using the MFSW buttons - need to install a mic and hook it up to the iphone connector, but it's not impossible!

Where I'm at:

  • Got the RPI to listen on the iBUS and monitor all messages perfectly

  • Got the RPI to send messages to the radio - I can display almost any text I want on the radio screen!

  • Got the device working perfectly for playing music STORED ON THE RPI to the radio

  • Got the RPI to listen specifically for the play/pause/skip buttons on the radio and MFSW controls and react accordingly


What I want to get working next:

  • Stream audio from the iDevice to the radio - got it working via airplay, but that's not what I want!
  • Control the iDevice from the RPI depending on the IBUS messages it receives

To be honest, I'm pretty close with this now - it's basically just the controlling of the iDevice that's left to do, and that's all well documented.



On a side note, I've discovered how to open / close the roof via the IBus - and have got the RPI to open close it from the console.
I also believe I've discovered the messages sent to the iBus from the keyfob when locking / unlocking.. so I reckon it won't be long until I've managed to replicate the functionality of the GapTech module - all for a fraction of the cost :thumbsup:



So.. to clarify, I currently have a device in my car that will play music stored on a USB device, through the car stereo system, that is controllable from the radio and MFSW controls.

:driving:
 
Just caught up on this - great work and an interesting project.

I am planning on connecting my integrated Android into the iBus (when I have everything else sorted, that is). I tried to find an iBus to Bluetooth connector, but none seem to be available.... so I am making one instead :D .

I would be interested in any details you have on controlling the roof / lights etc (or anything else for that matter). I already have a gaptech, but it would be cool (albeit largely pointless) if I could open / close the roof via SMS (I could send an SMS from my phone to the integrated phablet and close the roof that way!)

I would like the Android to display information from the radio too... like the OE screen would have. I already have the track information on the radio covered as I am using Bluetooth audio streaming.

Out of curiousity - why are you going with the RPi over the Arduino? I already have an Arduino for motor operation on my project... but was planning to get the iBus talking directly to Android.

All the best,

Dan
 
the reason I went RPI over Arduino was simply the fact that my Arduino still hasn't turned up despite being ordered a month ago from Amazon :/
 
sk93 said:
the reason I went RPI over Arduino was simply the fact that my Arduino still hasn't turned up despite being ordered a month ago from Amazon :/

I've got a spare uno kicking about if you want to have a play with one? PM me your address and I'll chuck it in the post.
 
I've done a massive amount on this now :thumbsup:

Quick list of things that are done, in and working:

  • Raspberry Pi is fitted in a small box just behind the CD Changer, behind the back wall carpet
  • Creative Labs Play USB Soundcard plugged into Pi and wired up to head unit (using CD changer pins, not AUX)
  • The Pi acts as a secure WiFi hotspot which also supports AirPlay
  • The Pi also has a bluetooth dongle that acts as a audio reciever
  • Pi is hooked into microphone positioned between the rev and speedometer
  • The Pi boots up in just over 6 seconds and starts automatically when the car comes out of "sleep mode" (same as the in-car cigarette lighter, cd changer, and other devices)
  • The Pi is connected to the IBus continuously when powered up
  • The Pi listens to all IBus traffic and can log it to the SD card if required
  • The Pi can play music stored on its internal SD card or any connected USB drive, through the car's head unit
  • The Pi responds to user input either on the head unit, the MFSW controls, or voice commands

  • The CD Changers connector is now plugged into the Pi box and a new custom built connector goes from the Pi box back to the CD changer
  • CD Changer IBus connectivity is controlled by the Pi

  • iPhone harness all soldered up, wrapped and fed from Pi box, through the firewall and down to the ashtray
  • iPhone charges from Pi harness
  • The Pi can communicate with the iPhone and play / pause / skip etc.
  • iPhone does NOT go into "accessory" mode, so can still be used whilst connected to the Pi!


So.. a little more information :)

As above, the Pi now sits in a little black box from Maplins. I've mounted the Pi and a 12 volt, 6 port mini USB hub inside. Plugged into the hub we have the IBus interface device, a WiFi dongle, a Bluetooth dongle, the Creative Labs USB soundcard, a small USB extension cable and the Pi itself (for power)

On the side of the box, I've mounted a couple of connectors.These are as follows:

connector 1 (computer-style ATX power connector):
  • +12v Power
  • Ground
  • IBus

connector 2 (Female CD changer socket - RS Electronics!)
connects to the Carver cd changer power plug
  • +12v Power (not connected)
  • Ground (not connected)
  • IBus IN
  • IBus OUT

connector 3 (Male iPhone connector)
used so I can easily disconnect and remove the Pi if needs be

connector 4 (USB female connector)
used so I can connect external drives to the Pi

connector 5 (dual 3.5mm jack sockets)
  • First socket is for audio out
  • Second socket is for audio in (from the mic)

I decided to go for connectors rather than hardwiring, as I was having to take the Pi back inside the house and do a lot of development with it, so it was much easier to just unplug connectors, than have to have a dodgy "chocolate block" terminal connector I would be forever doing and undoing.
Plus, it looks a lot neater


So - how does it all work?

Well, as soon as I unlock the car (or put the key in the ignition if it's been sat unlocked for a while), the USB hub is provided with power and thus provides power to the connected devices - which includes the Pi.
the Pi itself then starts up and after about six seconds, it's up and running. If the headunit is turned on - it briefly displays the message "Ding Pi is done!" on the head unit display.

Once the Pi is up, it begins listening to all IBus traffic (and if in debug mode, logs it all to a text file).

The CD changer is still working and the headunit can play music from it just as before (note: the Pi doesn't even need to be powered on for the changer to function).

Because the headunit is nice, when someone presses the "MODE" button, it sends a quick message to the CD changer to ask if it's available.
Because the CD changer is still connected, the Pi doesn't respond and instead allows the CD changer to do so.
When the headunit is switched to CD Changer mode, it actually sends another message to the changer telling it to prepare to play.

It's at this point the Pi starts to pay more attention to the IBUS. Specifically, it's listening for the user to press and hold the R/T MFSW control button or the "6" button on the headunit for at least one second. (I chose the R/T button, as I don't have OEM bluetooth. I chose the "6" button as it had to be a button the headunit would announce over the IBus. I chose one second as nobody accidentally presses either button for a whole second ;))

When the user does press either of these buttons, the PI then sends a message to the CD Changer telling it to pause playing (exactly what the head unit does when you switch away from the CD changer).
After that, it then turns on the mini relay, cutting the CD changers connection to the IBus.
With the CD changer out of the way, it then checks to see if the iPhone is connected and if it is, tells it to start playing.
The audio coming back from the iPhone is then piped out to the soundblaster card, which then pipes it out via the 3.5mm jack in the side of the case.
This jack is connected to the cd changer pins on the back of the headunit - pins that are not used by the DSP system.
Once playing has commenced, it then reads the playing track information from the iPhone and displays it (scrolling text if needed) on the headunit.

If no iPhone is connected, it checks to see if an external drive has been connected, and plays music from that.
If no drive is connected, it checks for music on the SD card, and if found, plays music from that.
Finally, if no music is found anywhere, it displays "The Pi is a Lie" on the head unit display for two seconds, before reconnecting the CD changer's IBus connector and then telling it to start playing again.

This is all in, working and a whole lot of awesome :thumbsup:


But that's not all.. Whilst making all the above work, I kept finding new things I could add.
The first of which was BlueTooth.
sometimes, I can't be arsed to connect the phone to the dock - sometimes I want to listen to music on the girlfriend's Nokia.
To achieve that, I simply added a cheap bluetooth connector to the USB hub and configured the Pi to make it work as an "audio receiver".
I then coded the pi to check and play audio from any connected bluetooth device as a priority over the iPhone cradle, usb or sd cards.
If a device is connected whilst the Pi is already playing audio, a simple press of the "next track" button on the headunit or wheel forces
the Pi to recheck for a bluetooth device and prioritise it!
Simply toasty.

Next I added a wifi connector to the hub. this is mainly used so I can SSH onto the Pi whilst it's in the car and debug / work on it in a "live" environment (with all the devices up and running and the IBus connected).
However, a colleague pointed me to a blog where someone had used the exact same wifi connector on a Pi and got it to work as an "airplay" speaker!
A quick copy+paste of their code with a bit of editing to get it to work with my code, and now I have AirPlay support!

So, the final list of music-playing capabilities of the "PiSk" (yeah, that's what I'm calling it!), in the order in which the Pi priorities them, is as follows:

  • 1: Bluetooth
  • 2: AirPlay
  • 3: iPhone dock
  • 4: External USB drive
  • 5: Internal SD card


But wait -that's not all!

The Pi also has voice recognition abilities! Yep - you can control the PiSK with just your voice.
To get it to work, you have to say "pi, <command>" and the available commands are "play", "pause","next", "last","on" & "off" (so far).
This all works currently, by using Google's Voice API.
That's all well and good, but the downside is that it needs an internet connection to work (something that escaped my mind when I coded it.. :headbang: ).

Not to fear tho, as we already have a Wifi connector, we can actually tether the PiSK to our phone and use it's data connection!
currently, I believe this to ONLY be available on jailbroken iPhones (other phones probably have it - I know the Nokia lumia's have it.. just not iPhones :/)

Still, this can be got around by getting a cheap 3g dongle and using that for the data connection.
Or, you can just simply not use it :P




So what's next?

Answering phone calls is the next challenge. I expect to get this to work via bluetooth, but I've not cracked it yet...
Once I've got that, I'd look into reading text messages and the like - maybe even be able to reply using the voice recognition.. who knows.


Anyways - this is quite a long post already.
But I've achieved it. :thumbsup: :evil: 8)

It took a fook load of messing about to make it all work, I also blew the dock connector on my iPhone by getting the pins wrong once (£$6 to fix, so not as bad as I had initially feared!)
But I'm well pleased with the whole thing.

My next task is to make the code more "elegant". there are times where it gets confused about things. I think there's a bug in my code that tracks the status of the headunit.
I also want to try and speed everything up. It's already fast enough to use, but I'd be much happier knowing I got it going as fast and fluidly as possible.

finally, I need to replace the box that cases the whole thing, as when gluing in the sockets, I managed to melt it and it looks horrid (not that you'll see it under the carpet.. but I expect quite a few people may be interested in seeing it at meets and the like, so I'd like to make it look "pro" :rofl:

Happy days!

If I get the chance, I'll take it out of the car and take some quick snaps.
I'll also try and get another vid of the whole thing up and running.
 
You. Are. A. Magician. :)
The PiSk solutions sounds amazing. Cant wait to hear and see more!
 
Brilliant, just brilliant! Huge well done on achieving that! I'd love to be able to be able to code like that but sadly at the min do not he the time (or potentially patience!) to learn!

VIDEO IS NEEDED!!!!! :thumbsup:
 
Top work as I said before. This could be something stuart Truman would be interested in if there are no limits to the music catalogue.
 
Does the audio have to be sent over 3.5mm jack or could you send this another way?

The only reason I ask is because the sound quality of the jack is no where near as good as a CD and I believe this has something to do with it being an analogue signal through the aux instead of a digital one that the CD changer uses?
 
sk93 said:
Quick youtube of where I'm at at the mo ;)

[youtube]j07jL3aGzU4[/youtube]

Any more updates on this?

Absolutely fascinated by it so far!

How much more difficult would you imagine this would be to implement with the nav screen?
 
Wow just seen this thread... Thats amazing :bow:

I had a carputer years ago in my old golf, wasnt flawless but i loved tinkering with it.

I have a pi, which i hooked up to my tv for airplay and xbmc, bit you have taken it to another level.

You dont happen to be a software developer by any chance?!

Makes my intravee seem rather pathetic now :lol:


Sent from my iPhone 5s using Tapatalk
 
@SK93, Wow, I've just seen this thread & read it right through, I cant pretend that I understood it all but I got the gist.

I've recently purchased a Dension as I don't have the know-how to do anything like what you have achieved but it was nice to read about the iBus & to appreciate how these aftermarket devices create their own traffic onto the bus to make things work in ways unimaginable.

Top work & keep it up.

Tony

(PS, did you ever replicate the functionality of the gaptech module that you mentioned earlier?)
 
In regards to the GapTech, I'm close.

I can get the roof to open and close now, but it's not perfect as it "steps" and I haven't found the right message to indicate its closed or opened yet.
I'm pretty much waiting for the warmer weather now tho ;)
 
How's all this coming sk93? I've been playing around with different ideas on how to add cameras to my car with an usb input controled over the ibus and desided to do a search for raspberry pi on the forum when I found this thread.

Sounds like you've done some amazing work here. :thumbsup:
 
Any more info on this?? I like the idea of using the RiPi.

I have just finished my simple AUX ipod interface (so I can keep my cd changer), I'm using the arduino nano.

I can Play, pause, stop, next track, prev track, next play-list, prev play-list, next album, prev album, shuffle and repeat, all from the controls and MFSW, I'm using mode 2 on the ipod/iphone so I can still use the wheel/buttons etc.
 
This is quite a project. Do you have any video/how-to write-up of the project? Like parts and connections? I'm trying to do a similar project for my Z4-2004 (MK4 Business with Navigation - USA) but no idea about iBus programming. Your post is very inspiring. Would love to learn and do this in my car.
 
Back
Top Bottom