Not joined yet? Register for free and enjoy features such as alerts, private messaging and viewing latest posts and topics.

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

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

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

Post by sk93 » Wed Aug 14, 2013 12:08 pm

Ok - this isn't so much of a direct "HOWTO", but more of a project that I'm just about to start.
There are no photos yet, as I've not actually done most of this - but as I progress through it, I'll add the pics and add more information as and where it's needed.

Basically, what I want to be able to do is plug my iPhone/iPod into a docking cable in my car, and have it work.
These are my requirements:
  • Be able to hear music on the stereo
  • Be able to charge the iDevice
  • Be able to see which track is playing on the Radio LCD
  • Be able to skip forward / back on the current track
  • Be able to skip tracks forward / back
  • Be able to utilize the MFSW for the above
  • NOT loose use of the CD changer
I know MOST of this is already achievable via the Intravee/Denison/DICE units etc.. but with all of them, you end up loosing the CD changer functionality - something I don't want to do.

So how am I planning to achieve this? That's the million dollar question I guess :)


First things first..

step 1: getting to the same state I have now (aux connection), but with charging and using the apple connector

building the dock

I've previously built a fair few aux connectors for the Z4.. it's pretty straightforward, and only costs around a fiver.
But the drawbacks to this are two fold:
  • It doesn't charge the device
  • It means having a dangly aux cable loitering around in the car
So I started looking into taking an iPod connector apart and seeing if I could hack it a bit.
Well, it turns out those cables have the smallest connectors in the world and they are an absolute beast to (de)solder.
A bit of googling and research found me a product called "PodBreakout".
Here's the one I bought from Amazon for £6.59:
http://www.amazon.co.uk/gp/product/B007 ... UTF8&psc=1

This little device makes it so much easier to solder wires to the connector - solving that headache instantly.

Next I needed to figure out how to charge the device using the connector.
I knew that you could charge from both USB and from other docking devices (the apple wall plug is effectively USB, so not including that), but I wasn't sure if the docking devices were just sending +5v ala USB, or if they were able to provide more voltage on different pins.

Eventually, I found this little pinout guide, which clearly shows a couple of "firewire" pins, that run on +12v - handy!
http://pinouts.ru/CellularPhones-A-N/iP ... nout.shtml

A bit of testing and I was then able to get an iDevice to charge using the firewire pins - that's the incar charging sorted!

So now I need to fabricate a dock.
Looking at similar, commercially available units (StarDock for example), I decided to go for the ashtray as the home for the dock.
I did a bit of playing around, as I didn't want to not be able to operate the center console buttons when the device was docked and I was able to reach all but the passenger seat heating control without issue (I could reach it, but had to "go around" the device).

I found a load of these on eBay and other places. Whilst I wasn't bothered about the actual dock, what I wanted was the plastic adapters that come with it:
http://www.ebay.co.uk/itm/iPod-Universa ... 4611b2986d

Taking one of these, and my current ashtray, I intend to fiberglass the PodBreakout into an adapter plate, and then the unit as a whole into the the top of the ashtray, so it fits flush.
I'd then drill a hole in the side of the ashtray to allow me to feed the cables from the PodBreakout.

The idea being that this unit can slot directly into the ashtray hole, and when fitted, will sit flush next to the cigarette lighter and look as "OEM" as possible.


Providing the power

Simple job this.. as the dock is located adjacent to the cigarette lighter, which conveniently provides a +12v and a ground, simply bind into these and feed pins 19,20 (+12) & 29,30 (gnd) on the podBreakout PCB.

Getting the audio

Again pretty easy. Take a wire from pins 2 (gnd) 3 & 4 (audio) to the back of the stereo unit ala aux cable (need the resistor inbetween the two cables to enable the audio - see my DIY for more info)

The final step is to tell the device to play audio via the lineout, which is achieved by attaching a 68KOhm resistor between pins 15 and 21, then connecting pin 11 to pin 15 with a loop wire.

---------------------------------------------------------------------------------------------

Huzzah.. At this stage, you should have a working iDevice dock that will play audio and charge the device.

But that's not where the story ends. I am content with the device using the aux connection for audio, but I now want to be able to change track on the device.
This is where it gets a bit more involved!

Step 2: IBus integration

IBus background information

Ok heads up - this is going to get technical. I'm going to explain how the IBus works and what it can do for us.
If you're just wanting to follow the howto (as it were), you can probably skip this bit. However, it does contain all the information (hopefully) we would need!


The IBus in our cars is effectively a single long cable that connects to many things (MFSW, cd changer, radio, headlights, fog lamps, etc - basically the "secondary" electronic devices in the car).
It carries a 12v digitial signal that allows those "many things" to communicate with each other.
It is effectively identical to the KBus (the thing that connects all the ECU's and "primary" electronic devices in the car).

Data is transmitted along it in binary form, grouped together in packets. The binary values are as follows: +12v = "0", 0v = "1".
Therefore, if you are getting a +12v feed on the line, there is either no data being transmitted, or you are receiving a binary zero.

The data is transmitted at 9600bps. Each individual block of data is 8 bits long, followed by a single parity bit and then a stop bit.
This probably wont mean much to you non-geeks, so here's an example:

Lets pretend we haven't received ANY data so far (just getting a constant +12v) and then we receive this: 1010000111
Taking this apart, we have the data bits "10100001", the parity bit "1", and finally the stop bit "1".

So what can we do with this information?
Well, as I say above, the devices in your car are already talking to each other using the IBus.. so lets take a look at what they're sending!

If I press "previous track" on my MFSW, the following binary data is sent along the IBus:

10100000100000110010110100011111100000100000100110110100011010010000100010100011100000001

converting that to hex using the rules above, we have the following:

50 06 68 F0 04 68 48 10 C4

doing a bit of investigation, I've discovered that the first hex digit is the identification number for the device sending the data.
The second digit is the length of the data being sent. The third digit is the identification number for the device that should receive the data
And the remaining digits are the data being sent between the two devices.

After a bit more testing with various units, I've discovered the following "identifications"

18 = CD Changer
50 = MFSW
68 = Radio
6A = Carver amp
00 = Broadcast (only used as a destination, and can be picked up by more than one device)

So what does this mean? Well, we now know what to look for on the bus for next and previous tracks as well as skipping forward and backward.
The data being sent by the MFSW for these is as follows:

F0 04 68 48 10 C4 = previous track
F0 04 68 48 00 D4 = next track
F0 04 68 48 50 84 = skip back
F0 04 68 48 40 94= skip forward

(conveniently, this same data is sent by the headunit when using the track buttons on it!)


iDevice background information

Again, you can probably skip this bit.. it's just information on how to control the iDevice remotely :)

So now that we know what to listen out for on the IBus, we now need to work out how we can get the iDevice to do what the IBus wants it to do.
Luckily, this information is pretty well spread on the internet, so after a bif of googling, I found the following info:

Communication to iDevices is done via a serial data connection, using pins #12 (transmit) & #13 (recieve) on the iDevice connector
Again, the data is transmitted using the standard "RS232 8N1".
What this means is that there are 8 data bits, with no parity, and one stop bit. So, every byte looks like: "101010101"
Simples :)

Now, onto the data we need to send to the iDevice in order to get it to do what we want!

Firstly, we need to switch the device into "AIR" mode (not airplane mode! just the mode they go into when you plug them into a dock etc).
To do that, we need to send the following data:
FF 55 03 00 01 04 F8

(just FYI, the codes are made up as follows, the first two bytes have to always be "FF" then "55". The next byte indicates the number of data bits included in the command. Then you have the data bytes. Followed by a checksum byte, which is calculated by adding up the values of all the data bytes, then taking them away from 0x100)

So, now we have the iDevice in "AIR" mode, we can then send the commands we want:

"FF 55 03 00 29 01 D6" = play/pause
"FF 55 03 00 29 02 D5" = stop
"FF 55 03 00 29 03 D4" = next track
"FF 55 03 00 29 04 D3" = previous track
"FF 55 03 00 29 05 D2" = fast forward
"FF 55 03 00 29 06 D1" = fast rewind

:thumbsup:

Awesome.. that's the basic background information in place. Once we get this bit to work, we'll return to this and look at how to get data (trackname etc) from the iDevice and display that on the radio.

---------------------------------------------------------------------------------------------

So. how are we going to achieve this?

Step 3 - Building the interface

So now we know what to listen for and what to send, we need to build something that will actually do this.
My initial plan was to use a Rasberry Pi for this, as they're very cheap, have loads of ports and run linux.
However, I then remembered the Arduino board. It's about half the price of the RPi, has tonnes of IO ports, runs of 12v (bonus!) and is pretty easy to code, so I've decided to go down that route.

I will come back to this bit and fill in how to connect it all up precisely, but for now I will give some general gumf on it.

The only cables we need to connect to the Arduino are the iDevice's serial cables and the IBus. We will also be adding a couple of relays off the board so that we can do clever things (such as "cut out" the CD Changer, and control power to the dock), but we will be looking at that a little later on in this post.

Once we have the cables connected, we then need to code the arduino to listen out for the relevant codes on the IBUS, and then issue commands to the iDevice.
Luckily, I've tonnes of experience coding (tis my job after all) and I've messed with Arduino many times in the past (automated home lighting, electronic gates, etc)
Now, I realize writing code like this will be beyond most of the people reading this, so once I've written it myself, I'll make it available here for everyone to use as they wish. I'll also put a bit of tutorial in on how to load it on your own arduino.

Next, we need a power supply for the arduino. It's requires 12v, but we need it to be "switched", so as to not keep the device running whilst the car is off.
Handily, there's one of these hooked into the back of the stereo, so we'll just hook into that :)
Whilst were there, we can also hook into the IBus connector on the back of the stereo :thumbsup:

Again - I'll fill this section out much more once my Arduino actually arrives!

---------------------------------------------------------------------------------------------

So.. where are we at?
Well, at this point, we've got an iDevice sat in a dock, that is able to play it's music via the aux connection on the back of the stereo, and also listens to and responds to the MFSW and radio controls for next/previous track as well as fast forward and rewind!

But we're not all the way there yet... we still have to address the problem that the audio is of lower quality when using the aux connection, and that we're not displaying the track names on the radio screen. (which becomes quite important when you can no longer see the track name on the front of the iDevice now that it's in "AIR" mode!)

I've again ran out of time, so I'll update again a bit later with info on how we're going to do that :thumbsup:
Last edited by sk93 on Thu Aug 15, 2013 10:05 am, edited 2 times in total.
:zzzz:

Liam-O
Senior Member
Senior Member
Posts: 1702
Joined: Tue Apr 05, 2011 9:29 pm
Location: Solihull

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Liam-O » Wed Aug 14, 2013 1:59 pm

its going to be interesting to see how you do the tracks on the display. It means you cant use aux and will need to use iBus, and i know you said you dont want to lose the CD changer, but isnt it occupying the only iBus connections?
Liam - O

2005 Z4 2.2SE Grey - Sold

:rtfm: HOW TO: Fitting a Z4M Bumper

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Wed Aug 14, 2013 2:04 pm

Liam-O wrote:its going to be interesting to see how you do the tracks on the display. It means you cant use aux and will need to use iBus, and i know you said you dont want to lose the CD changer, but isnt it occupying the only iBus connections?
You're correct, but the iBus is exactly that.. a bus.. meaning more than one device can occupy it ;)

I'm in the process of writing up the bus interface on the original thread now, so expect to see more shortly :thumbsup:
:zzzz:

User avatar
inkey$
Lifer
Lifer
Posts: 10475
Joined: Sun Mar 21, 2010 9:48 pm
Location: Sevenoaks & Suffolk
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by inkey$ » Wed Aug 14, 2013 3:34 pm

sk93, if you nail this (which Im sure you will) I'd be interested in commissioning you to do mine for iPhone 5 connection :thumbsup:
Current: Project Audi A2 1.4SE
Previously: Z3R 2.8 • E46 330i • Z4R 3.0 • Z4///MC • E90 335i • Z4///MR • Z3///MC 'Breadvan' • Z3R 2.8 • E30 325i R • Z4C • Z4R 3.0

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Wed Aug 14, 2013 3:57 pm

inkey$ wrote:sk93, if you nail this (which Im sure you will) I'd be interested in commissioning you to do mine for iPhone 5 connection :thumbsup:
that wouldn't be difficult.. you can already buy 30 pin (iphone/ipod) to lightning (iphone 5) adapters.. all we'd need to do is keep the original product of this howto in place, and simply fiberglass the adapter into the ashtray instead of the 30 pin cable.
simples :thumbsup:
:zzzz:

User avatar
Woots
Lifer
Lifer
Posts: 3798
Joined: Sat Sep 19, 2009 8:13 am
Location: Milton Keynes

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Woots » Wed Aug 14, 2013 4:10 pm

Interested

I've got no idea about the dice and other thing ppl talk about

Don't they all have a lil facia mounted control thing? If they do I don't like them

I don't have a changer but want something like you talk about....doing here

This being for an iPhone 5 yeah? I've got the phone prep kit so could this utilise that space there?
Lotus Exige 350

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Wed Aug 14, 2013 4:12 pm

Woots wrote:Interested

I've got no idea about the dice and other thing ppl talk about

Don't they all have a lil facia mounted control thing? If they do I don't like them

I don't have a changer but want something like you talk about....doing here

This being for an iPhone 5 yeah? I've got the phone prep kit so could this utilise that space there?
I've not had a gander at one of the phone prep kits - but I'd be very interested in doing so..
it may be possible to utilise or hook into that and use that.. removing the need to make a dock for those who have the prep kit in place :thumbsup:


In other news, I'm going to start this project tonight!
:zzzz:

Liam-O
Senior Member
Senior Member
Posts: 1702
Joined: Tue Apr 05, 2011 9:29 pm
Location: Solihull

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Liam-O » Wed Aug 14, 2013 5:00 pm

I need this also!

Would you be looking to do audio through the bus or still aux? As I'm hoping iBus audio will not have the loss of bass?
Liam - O

2005 Z4 2.2SE Grey - Sold

:rtfm: HOW TO: Fitting a Z4M Bumper

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Wed Aug 14, 2013 5:23 pm

Liam-O wrote:I need this also!

Would you be looking to do audio through the bus or still aux? As I'm hoping iBus audio will not have the loss of bass?
doing a bit of digging.. the cd changer isn't supplying audio via the IBUS.. more so it has a seperate analog feed to the headunit.
I am aware of the bass drop and will be trying to rectify that (either by hacking into the cd changer analog, or something else I've not thought of.

its a good point and I'll keep that in mind when filling out the post :)
:zzzz:

User avatar
Stuart Truman
Lifer
Lifer
Posts: 13039
Joined: Wed Jul 27, 2011 10:59 pm
Location: The Cotswolds

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Stuart Truman » Wed Aug 14, 2013 7:31 pm

Have you already found the wealth of online resource on the iBus?
Add yourself to the Z4 Map HERE! Instructions HERE!
Z4M Roadster, Imola Red, with Stubby and Intravee II. Low Miles per Gallon, High Smiles per Gallon
Previously Alpina Roadster S #69 Alpina Blue

Liam-O
Senior Member
Senior Member
Posts: 1702
Joined: Tue Apr 05, 2011 9:29 pm
Location: Solihull

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Liam-O » Wed Aug 14, 2013 8:52 pm

What will you be using to send the commands/data through iBus?
Liam - O

2005 Z4 2.2SE Grey - Sold

:rtfm: HOW TO: Fitting a Z4M Bumper

User avatar
inkey$
Lifer
Lifer
Posts: 10475
Joined: Sun Mar 21, 2010 9:48 pm
Location: Sevenoaks & Suffolk
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by inkey$ » Wed Aug 14, 2013 10:24 pm

Sounds as though you also have a growing list of customers sk :thumbsup:

This sounds perfect.
Current: Project Audi A2 1.4SE
Previously: Z3R 2.8 • E46 330i • Z4R 3.0 • Z4///MC • E90 335i • Z4///MR • Z3///MC 'Breadvan' • Z3R 2.8 • E30 325i R • Z4C • Z4R 3.0

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Thu Aug 15, 2013 9:00 am

Liam-O wrote:What will you be using to send the commands/data through iBus?
Arduino :)
:zzzz:

User avatar
sk93
Lifer
Lifer
Posts: 3970
Joined: Mon Oct 19, 2009 9:20 pm
Location: Nottingham
Contact:

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by sk93 » Thu Aug 15, 2013 5:31 pm

ok.. slight change of plans for this first version...

The PodBreakout I've purchased is too long to comfortably fit in the ashtray space :cry:
So, now the plan is to place the cable inside the "between the seats" cupboard.

I believe you can actually get lower profile connectors, which I'll look into a bit once I've got all this working, but for now, the cupboard it is :)

(it's already where my aux cable feeds too, so it's not a major issue)
:zzzz:

Liam-O
Senior Member
Senior Member
Posts: 1702
Joined: Tue Apr 05, 2011 9:29 pm
Location: Solihull

Re: HOWTO: DIY IBus iDevice dock - including MFSW + track in

Post by Liam-O » Fri Aug 23, 2013 10:38 pm

Any more updates on this? Following closely!
Liam - O

2005 Z4 2.2SE Grey - Sold

:rtfm: HOW TO: Fitting a Z4M Bumper

Post Reply