Skip to content
forked from iwanders/OBD9141

A class to read an ISO 9141-2 port found in OBD-II ports.

License

Notifications You must be signed in to change notification settings

matt2005/OBD9141

 
 

Repository files navigation

OBD9141

This is a library to read data from the the ISO 9141-2 (K-line) pin of an OBD-II port found in cars.

There are numerous projects which read data from the diagnostic port and display or record this. However, I found that most of these projects either use an ELM327 chip or the communication code is interwoven with the rest of the program. This makes it hard to extract the communication parts for use in another project.

The goal of the library is to provide a simple class which handles the communication with the port. Additionally a second class has been created which can simulate responses for testing purposes.

Usage

The code has been developed using Teensy 3, the K-line transceiver IC's used were during the development were the MC33290, SN65HVDA100 and SN65HVDA195. All three transceiver IC's worked without problems when the typical application circuit from the datasheet was used. The OBD9141 class itself has been tested on one Kia car build in 2004.

For the Teensy 3.x or LC versions it is recommended to use one of the HardwareSerial ports. For use with Arduino the AltSoftSerial library is used by default. The example reader_softserial was tested with an Arduino UNO.

A minimal example of how to use the SN65HVDA195 chip mentioned is given by the following schematic: Schematic of circuit using SN65HVDA195

The EN pin can either be connected to a pin on the microcontroller or just pulled high in order to always enable the chip.

In the logic folder are some recordings made with a Saleae logic analyzer, these show the state of the K-line pin using either a Bluetooth OBD-II reader or this library, these might be useful when developing your own hardware. All timing parameters can be tweaked from the header file, by tuning these parameters, performance of up to 20 requests per second has been achieved (on the same car, 6 readings per second was the maximum with the Bluetooth dongle).

Three examples are given in the example folder. The reader and simulator examples are to be used with a hardware serial port. The reader_softserial example shows how to use it with the AltSoftSerial library. For more information on how to use the library, refer to to the header files.

License

MIT License, see LICENSE.md.

Copyright (c) 2015 Ivor Wanders

About

A class to read an ISO 9141-2 port found in OBD-II ports.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 87.6%
  • KiCad Layout 12.4%