Tuesday, March 18, 2014

I/Kbus interface options for Arduino

There is quite a bit of information and readimade cables for interfacing a PC with the BMW Ibus PC for diagnostic purposes.  What if one wanted to connect an Arduino to the bus?  The PC serial port runs at 7 volts and the Arduino runs at 5 volts.  So right there we have a problem.  It also worth noting that the ibus voltage can be near 12V, at idle, which would most definitely fry the Arduino. 

During my testing and experimentation I’ve used several different options for connecting an Arduino to the ibus.  Thought I would share what I have learned in hopes of saving someone else some time and trouble.  This blog entry provide 3 interface options for an Arduino or other serial device to the BMW Ibus or Kbus.  This should  also work for interfacing with the TX1 (Diagnostic bus) and TX2 bus (ISO OBDII protocol) as they all use the same protocol.  9600 baud 8E1  If using an Arduino define with this statement:  xxx.begin(9600, SERIAL_8E1);

The three different options I’ve attached have some advantages and disadvantages.  We will go through them in the same order I discovered and used them.

ibus simple:


This circuit is similar to how an ELM clone connects to the OBDII ISO line.   It has the benefit of beings a fairly simple circuit to build and only requires some readily available and inexpensive resistors and transistors.  Great.  Then why do anything else?  There isn’t much separation between the 12V Kbus and the Arduino.  If a component fails or is bridged it is likely that 12V will get to the Arduino pins.  But this circuit does work and I have used it for quite a while.  I really only moved to the next version to provide isolation to reduce some audio noise in one of my projects.

ibus Optocoupler:




This is similar to the ibus simple but adds optocouplers in place of 2 of the transistors.  This isolates the bus from the Arduino ensuring there are no over voltage accidents.  Only downside to this circuit, if there is one, is that it requires using an optocoupler which not everyone might have handy.  But optocouplers are inexpensive and a great addition to your electronics supplies.  I used this circuit with great success for a long period of time.  I only moved to the next circuit as I had been looking for a way to put my circuit to sleep  and wake it with bus activity with fewer components.  (I had built a latching circuit but it was very complicated and took a long time to solder up)

ibus linbus:

This is by far my favorite method for connecting to the i/kbus.  But depending on what type of circuit is being made one of the other circuits might make more sense.  This circuit uses a linbus transceiver to translate the bus pulses into a serial data stream for the Arduino.  While the linbus data stream is not the same, the voltage structure is.  Therefore the transceiver can translate the bus pulses into a serial stream safe for the Arduino.  Transceiver chips are also used in some BMW OEM equipment. although different ones are used but they do not appear to be produced anymore.

The chip I selected, MCP2025, is also sold with a built in voltage regulator and has a sleep mode.  This allows the Arduino to put the transceiver into sleep mode reducing power drain with the car is off and kbus activity wakes the transceiver up.  It has some other cool features that you can read about in its spec sheet.  Pretty slick and all for about $1.50 each. 

Friday, January 31, 2014

BMW cruise buttons





 Inside the BMW cruise buttons.  The chip on the left is an Ibus transceiver with built in voltage regulator.

1 Jan 2018 update:
Well we got a oscilloscope for Christmas.  The perfect thing to try out on the cruise buttons.  But first let's talk about the LH buttons, the stereo and phone buttons.  As mentioned above there is an ibus transceiver and a micro controller on the RH button circuit board.  But I don't believe the RH buttons use ibus.  To be sure opened up a set of LH buttons.  And yes.  No big chips.  See below



So all the converting to digital is done by the RH buttons.  As I had expected.  Back to decoding the cruise data stream.  Hooked up the cruise buttons as shown in the MFL button wiring diagram from the WDS.  this time I had a MFL wiring harness (LH and RH buttons complete).  When hooking it up I found it odd that Red (pin4) was the Cruise signal.  Not the usual color.  Lots of testing and not much success.  Pulled the circuit board out and my son traced the signal circuit.  It didn't make much sense as it seemed it'd never see or make pulses.  Then the thought ""Maybe the signal and 12V in are switched".  Well anything is worth a try and well it worked.  Then we pulled up the wiring diagram for the Volute spring.  Guess what it shows.  The red (pin4) was power and the Gray (pin2) was the cruise signal.  UGH.... All this time we weren't getting it because the one MFL diagram was wrong.  Seriously.  But now we have a nice wave form that differs based on each button pressed.  Here are some examples;
 

It appears to be a PWM signal.  The last pulse is the toggle bit.  Which simply cycles back and forth every so often unrelated to if the button is pressed or not.The rest vary 1 or 2 of the pulses when a button is pressed (not counting the toggle bit).  Armed with this and a little Arduino magic we are able to get the arduino to tell us which button we are pressing.  Whoo hoo.  Finally mystery solved.

It's a start.

During 2012-2013 while temporarily living in Sweden, my son and I started learning about micro controllers and electronics.  This kept us busy on those dark Scandinavian nights. Since then we have learned and collected a lot of information and written many programs which may be helpful to other DIY's.   The difficult is putting it into a coherent useful format.

In this we will post some of our "electronics" projects and information. E46 Tuning, Ibus Kbus, ipod and Arduino. To start here are some links to a google drive where we will house some of the diagrams, spreadsheets and programs.  Click on the links to be taken to the google drive with the relevant information: