Alexander’s car diagnostic software (OBD KW1281)

-Arduino Version-

Update 2015:   I developed an Arduino OBD reader for the older OBD KW1281 protocol:

  1. An OBD USB adapter (USB KKL adapter  ‘AutoDia K409 Profi USB‘) was hacked, so I could connect the car OBD to the Arduino (TX/RX via software serial).
  2. An Arduino LCD display (‘YwRobot LCMI602 IIC V1’) was attached to the Arduino.
  3. Arduino code was written for the KW1281 protocol to read car sensor data (RPM, oil/coolant temperature, throttle, air, etc.) and show them on the display.

obd_adapter_arduinoobd_kw1281_arduinoobd_arduino_car obd_arduino_display1 obd_arduino_display2

Download Arduino Code for the KW1281 OBD protocol: arduino_kw1281


-PC Version-

My Audi A4/B5 (1997) and many other old cars use the older OBD KW 1281 protocol – I tried to find any suitable OBD software for my car to speak to my motor and dashboard control units (ECU), however:

  • wbh-diag 0.89 : seem to work (unstable connection)
  • monoscan 2.30: seem to work, but does not have ‘set basic settings’ feature
  • VAG-COM 3.11/4.09: seem to work (you have to power off/on ignition while connecting as it sends some data before waking up and that confuses my engine ECU)
  • CarPort 1.3.2: seem to work (you have to power off/on ignition while connecting as it sends some data before waking up and that confuses my engine ECU)

So, using the KW1281 protocol, the correct initialization timing (baud 5) is critical, and some software does not wait before waking up the ECU. Finally, I decided to develop something on my own. Note: my software only supports the older KW1281 protocol!

Features of my KW1281 diagnostic software:

  • Read sensors (measurements)
  • Set basic settings – useful, if you want to start motor ECU throttle adaption
  • Read errors
  • Clear errors
  • Read ROM (does not work for all ECUs)
  • Showing sensor values in graph

What you need:

  • a PC runing Windows (XP/Vista/Win7)
  • an USB KKL adapter (it provides a virtual COM port, for example ‘AutoDia K409 Profi USB‘ – it uses the FTDI chipset to emulate a serial line)

Screenshot:
kw1281screenshot

Download:
obd_kw1281  (executable)
obd_kw1281  (freepascal_lazarus code)

Please send me your feedback! Thanks 🙂 If you send your feedback, please always send me the complete debug output.

My car’s OBD data:

- Audi A4 B5 1.8, 1997, ADR
- Engine ECU:
     Part Number : 8D0907558B      Component : 1,8L R4/5V  MOTR HS D02
- Dash board ECU
     Part Number : 8D0919860G      Component : B5-KOMBIINSTR.UN4   D01
     Descriptor 5 : IMMO-IDENTNR: AUZ8Z0V5170015

36 thoughts on “Alexander’s car diagnostic software (OBD KW1281)”

  1. Spitzenmäßig 🙂 Danke viemals für diese App.
    Würde mich gerne mir dir darüber unterhalten – wenn du mal Zeit hast!

  2. Hi Alexander

    With a OBDII cable all works OK except AirBag Error: airbag not allowed

    With no OBDII cable connected software tries twice to connect to controllers before ERROR except AirBag which immediately gives Error: airbag not allowed.

    Software installed on Windows 7 Home. I only want to connect to Airbag at the moment for error detection.

    Am I doing something incorrect?

    Regards

    Scott

  3. Hello!
    Good work friend!
    I’m working on something. I threw a few questions:
    Which programming language you used?
    As you manage the 10,400 serial port work?
    ‘You can explain how to 5baudios initialization is done?
    ‘You can send me the source code?
    Thanks!
    A greeting!

    1. Hi Alexander,
      Many thanks for arduino code. Finally I can communicate with my old Passat B5 1999 81kW TDI! I’m using mc33290 and arduino UNO.
      Because the communication was falling in certain time I had to add 5ms delay before obd.write(data); and also 1s delay is needed before calling connect(); (probably different ECU), but now the connection is stable.
      Also addresses in registry are different, but it is easy modification.

      Thanks!
      Vojta

        1. Hi John,
          very early version:
          https://dl.dropboxusercontent.com/u/24710673/passat/passat_kw1281_latest.zip

          I had some issues with my LCD, so modified code a lot. My modification is VERY ugly now. In my ECU addresses are:
          6-0 vehicle speed, 12-2 Supply voltage, 12-3 coolant temp, 15-2 fuel consumption
          Right now it read data only from Engine and display on LCD 16×2 actual fuel consumption per 100km, temperature and battery voltage.
          I’m going to add fuel per trip and fuel from reset.

          Regards
          Vojta

  4. Hello! Thanks for your code for arduino! Connection with ECU work great, but I can`t connect with dash and anothers modules..

  5. Thanks for the code and the info!

    I’m trying to use the project to use the “read blocks” part but with a ELM327 bluetooth adapter and a STM32 board running arduino code (STM32duino).
    I’m able to read the engine module with other library (OBD) but this one was failing. I found that, as I wasn’t using the RX/TX lines directly, I wasn’t able to do the “slow init”.
    As a workaround I tried to use the AT command “AT IIA xx” to do this but the BT adapter is a clone 🙂 and it doesn’t support this command.
    I’m going to gut the adapter and access the lines directly (on level converter) as you are doing…

    Thanks again!

  6. Thanks for the code base 🙂

    I adapted it to work with my 2011 Lupo GTI. I added big digits for vehicle speed for better viewing. (src: http://www.avrfreaks.net/forum/alphanumeric-lcd-hd44780-big-font-big-digits-generator-excel-sheet)
    I also added permanent vMax storage, like known from garmin navigation systems.

    I uploaded my code at github: https://github.com/mkirbst/lupo-gti-tripcomputer-kw1281 if somebody want to reuse it, i hope this is ok (watch README.md for credits).
    I also uploaded a short video where the big letters can seen in action: https://www.youtube.com/watch?v=IpqHjx0bSsI

  7. Hello,

    thank you all for sharing your code and the development on this nice project.
    I have transformed an 2L engine of a Golf 3 (AGG) to a VW bus (T3) and get a lot of sensor data on a little display with this code. The ECU system is the Simos 4.
    Everything works fine with the code, so far. In the bus I use a OLED Display with GPS and other sensors to show the speed, the gear and the temperatures.
    Now I want to integrate some ECU Data (lambda and fuel consumption) and a check engine light for the case of an error. That for it is necessary to read out the errorlist and integrate this part to Alexanders arduino code. It is just an extension to read the errors.

    Does somebody has done it right now and want to share the code with me?

  8. Hi All,

    The source code fails to compile in the latest Arduino 1.8.1IDE, but its very simple to make it work again.

    Change these lines:

    #include “NewSoftwareSerial.h” -> #include “SoftwareSerial.h”

    NewSoftwareSerial obd(pinKLineRX, pinKLineTX, false); // RX, TX, inverse logic// -> SoftwareSerial obd(pinKLineRX, pinKLineTX, false); // RX, TX, inverse logic

    that should be it and it will compile again 🙂

    Cheers,

    James.

    1. Hi James,
      I was wondering, when using the SoftwareSerial.h library do you manage to successfully communicate with the ECU after the 5 baud init? By this I mean do you successfully receive the values 0x55 0x01 0x8A?
      Because I have tried the SoftwareSerial.h library and I cannot get a correct response from the ECU, instead I get 0x00 0x00 0x00 for the ADR_Dashboard and 0x00 0x00 0x55 for the ADR_Engine…
      I believe the problem might be because the new SoftwareSerial.h library calculates the timings for the 10400 baud as opposed to the hardcoded timings in the NewSoftwareSerial.h library. And I think the calculated timings and the hard coded timings are different…

  9. Hi James,

    I was wondering, when using the SoftwareSerial.h library do you manage to successfully communicate with the ECU after the 5 baud init? By this I mean do you successfully receive the values 0x55 0x01 0x8A?

    Because I have tried the SoftwareSerial.h library and I cannot get a correct response from the ECU, instead I get 0x00 0x00 0x00 for the ADR_Dashboard and 0x00 0x00 0x55 for the ADR_Engine…

    I believe the problem might be because the new SoftwareSerial.h library calculates the timings for the 10400 baud as opposed to the hardcoded timings in the NewSoftwareSerial.h library. And I think the calculated timings and the hard coded timings are different…

  10. Klasse, das werd ich mir mal vorknüpfen. Ich hab übrigens VCDS-Lite von Vag-Com, welches wunderbar funktioniert mit einem billig ebay kabel auf meinem Audi S3 8L, Bj 2000.

    Ich will mir ein extra display bauen für Turbodruk, öltemperatur undso also ich brauche nur die Daten wieder zu geben. Tips und tricks sind willkommen. 🙂

  11. Hallo,
    das Projekt ist sehr interessant, ich würde es gern nachbauen und erweitern. Bis jetzt habe ich einen Arduino und das Nextion NX3224T024 Display im Betrieb. Ursprünglich wollte ich die benötigten Sensoren nachrüsten, aber bis auf den Öldrucksensor ist alles in den MWB’s vorhanden. Kann ich die Schnittstelle zum Fahrzeug mit einem L9637D angehen oder muss ich den ELM327 verwenden? Leider habe ich keine Schaltpläne diesbezüglich gefunden. Schaltplan Erstellung und Entwurf ist kein Problem, ich kann diese auch gern später hier veröffentlichen.
    Im Detail geht es um ein Beetle 1.8T, Bj. 2000, bei dem Öldruck, Temperatur, Ladedruck, Spannung,… angezeigt werden sollen.
    Ferner versuche ich gerade den Code etwas auszuschlanken, da ich für die Diagnose ein VCDS Pro zur Verfügung habe und die Serielle Schnittstelle am Arduino mit dem Display belegt ist.

    Über einen kleinen Gedankenaustausch würde ich misch sehr freuen.

    MfG Denis Köllner
    (meine Website ist schon sehr lange nicht mehr überarbeitet worden, da fehlt noch so einiges) 🙂

  12. hi Alexander,
    great job! Can you explain how you hacked the OBD adapter (what are the principles)?
    Mine has a CH340 chip (not the FTDI) and i don’t see how to do with this one.
    regards.

  13. Hey guys. I’m trying to make this work but I have a problem with it. When I’m powering my Arduino from my notebook I can connect and communicate with the Engine Controller Unit. But if I’m powering it from a Car USB Adapter it’s not even connecting. I can’t hear any relay noise after the arduino sent the 5 baud init. What could be wrong with that powering method?

  14. When I tried this, I simply get the letter K at LCD 0,0 and e at LCD0,4

    I also get a number counting up 1 per second at 4,7

    I’m using a I2C 20×4

    When plugged into my VW I do see both the TX and RX pins flashing on the UNO board, but no other data is shown. Can anyone offer advice?

  15. Hello Alexander.

    Great jop! I have installed successfully the software on my pc (winXP) but it does not appear what kind of the sensor it reads, I see only “Type 1” or “Type2” and the value that reads. Also sometimes it reads “code error” and disconnects automaticaly.

    Do you have any ideas to fix that little issues?

    Thanx a lot

    Antony

  16. Hi Leute,

    habe mir den Sketch heruntergeladen und leider funktioniert es nicht. Habe dann mit einem Oszi auf die K-Leitung gespitzt einen Vergleich zwischen der Arduino und Windows-Version gemacht. Das Ergebnis: Mit der Windows funktioniert es, mit der Arduino-Version ist die 5 Baud Init falsch herum!
    Hier die Bilder der Messung:
    https://imgur.com/a/wsOCx
    Hat jemand eine Idee woran das liegen könnte? Danke.

  17. Hi Alexander,
    Brilliant piece of software, thank you!
    I’ve got a 1997 Audi A4 B5 as well (V6 ABC engine). I’m trying to do a throttle body alignment so I can get the car running nicely again, and I’ve found it almost impossible!
    I’ve got the blue 409.1 cable, as well as a couple of others including the ross-tech one, and can’t get anything to work properly. Using your program is the closest I’ve come to getting it working.

    Below is my debug output. I think the group is correct, based on this:
    http://wiki.ross-tech.com/wiki/index.php/Throttle_Body_Alignment_%28TBA%29

    If you are able to help at all, I’ll gladly make a donation via paypal for your time. It’s very important to me to get my car working again.

    Thank you,
    Simon

    readlabelfiles
    readlabelfile 8D0907558B.lbl
    group0,0: Basic, Function
    labelfiles 1
    connecting (com=2 blk=100 bit=-1 byte=8000)
    trying baud 9600
    sendinit 1
    send5baud 1
    sending bits 0 1 0 0 0 0 0 0 0 1
    receiving
    received, blockcounter=0:
    0000 : 55 01 8A : U..

    readconnectblocks
    receiving
    received, blockcounter=1:
    0000 : 0F 01 F6 34 41 30 39 30 : …4A090
    0008 : 37 34 37 33 50 20 20 03 : 7473P .

    sending 03 02 09 03
    receiving
    received, blockcounter=3:
    0000 : 0F 03 F6 32 2C 36 6C 20 : …2,6l
    0008 : 56 36 20 4D 50 46 49 03 : V6 MPFI.

    sending 03 04 09 03
    receiving
    received, blockcounter=5:
    0000 : 0E 05 F6 20 20 20 20 48 : … H
    0008 : 53 20 20 44 30 32 03 : S D02.

    sending 03 06 09 03
    receiving
    received, blockcounter=7:
    0000 : 07 07 F6 00 90 08 68 03 : ……h.

    sending 03 08 09 03
    receiving
    received, blockcounter=9:
    0000 : 03 09 09 03 : ….

    blockwait 100 ms
    sendbasicSetting group 98
    sending 04 0A 28 62 03
    blockwait 100 ms
    readsensors group 98
    sending 04 0A 29 62 03
    ERROR: send (no ack)
    closing
    closed

  18. Hi Alexander,
    Just found your website. Great work!
    I wrote my 1st kw1281 piece of code for a Psion 3mx over a decade ago and used a “wired rs232 interface” to my Audi. I then rewrote the code to run on a Palm device using the same interface. The last rewrite was in 2014 which used a homemade Bluetooth OBD connector running kw1281 on an Arduino and the UI functions running on an Android device.
    I am able to connect to ALL my ECUs on my 97 A4 B5 Audi, including the Airbag. Not being able to connect to an ECU is not a security reason, it is most likely the baud rate has not been set correctly after the 5-baud init to the ECU, or a timing issue.
    My Audi ECUs:
    01 9600 baud
    02 9600 baud
    03 10400 baud
    08 4800 baud
    15 10400 baud
    17 9600 baud
    35 10400 baud

  19. Hi alexander, I try to connect to my Audi A4 B5 AEB engine, the ecu has the same that the ADR engine but the code doesnt work.
    In the serial monitor he told me :
    —KWPReceive sz=3 blockCounter=0
    IN: sz=3 data=0 0 0
    ERROR: invalid magic

    Do you know something about?

  20. Hi Alexander,
    vielen Dank, dass du deine Projekte hier teilst.
    Ich habe heute versucht mithilfe deiner Windows-Software eine Verbindung zu meinem Digifant-Steuergerät aufzubauen. Leider bisher ohne Erfolg. Das Kabel würde ich als Fehlerquelle ausschließen, da es mit VCDS-Lite funktioniert. Der Output deiner Software sieht so aus:

    readlabelfiles
    readlabelfile 8D0907558B.lbl
    group0,0: Basic, Function
    labelfiles 1
    connecting (com=3 blk=100 bit=-1 byte=8000)
    trying baud 9600
    sendinit 1
    send5baud 1
    sending bits 0 1 0 0 0 0 0 0 0 1
    receiving
    ERROR: receive (no echo)
    0000 : 80 80 80 : …

    trying baud 10400
    sendinit 1
    send5baud 1
    sending bits 0 1 0 0 0 0 0 0 0 1
    receiving
    ERROR: receive (no echo)
    0000 : 00 00 00 : …

    ERROR: no connect
    closing
    closed

    Wenn du mir eine Idee liefert könntest, würde ich mich darüber sehr freuen.
    LG Jens

  21. Hi Alexander,

    Is there any chance that you have one of these arduino OBD readers for sale? I have a 1994 VW Golf 3 1.9 TDi (1Z) fitted in my T3 campervan, and I’m just so busy getting the van ready for a long roadtrip that it would be so much more convenient if I could buy one of these genius inventions of yours

    I hope to hear from you..

    Best from Thomas

Leave a Reply

Your email address will not be published. Required fields are marked *

IMPORTANT! To be able to proceed, please enter the magic word 'ngeaad' so we know hat you are a human)

Enter the magic word:
Please leave these two fields as-is: