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.