Iso 9141 obd code




















It supports the K-line OBD2 serial communication between a verhicle and a microcontroller. Both ISO's are almost similar. This solution differs from the rest that is low cost for less than 10 euro!! It is low cost in the way that you don't need an arduino, raspberry pi or smart phone. Just a microcontroller and LCD display so you can use your smartphone for other purposes. Probably it will work for a Peugeot and Toyota Aygo of as well since they are technically identical. From what I read on the internet there are many flavours on K-line around so there is a possibility it will not suit your car.

Maybe some changes are needed to make it work. The source code is provided so you can investigate and change when needed. Maybe you can help extending this list of cars to help others! Both ISO's and knows a 5 baud initialization sequence. The microcontroller must start this init by transmitting byte 0x33 to the verhicle at 5 bits per second.

The total transmit time for transmitting byte 0x33 takes about 2 seconds. After this initialization it is expected to continue communicating at 10k4 baud. After this, the verhicle will respond with key bytes 0x08 and 0x08 or 0x96 and 0x The sync byte with key bytes of the verhicle must be acknowledged by the microcontroller by inverting the second key byte.

This will end the initialization part of ISO The response of ISO is slightly different. The verhicle ECU will also respond with synchronization byte 0x Only the key bytes are different. In case of a VW Touran of the key bytes are 0xef and 0x8f. Also here the second key byte must be acknowledged by the microcontroller by inverting it.

After the initialization process it is possible to submit a request to the verhicle ECU. A request is a sequence of bytes where adressing, a mode, a PID and a checksum is present. The following are example requests:.

The first three bytes are for addressing. The fourth is the mode field. The fifth byte is the data field with the PID and the last byte is the checksum. In this example mode 1 is used. This mode will show "current data" as how it is at this moment. This mode is perfect for displaying actual information. The data field contains the PID. In this case 0x0d which is the verhicle speed. The checksum is the sum of the bytes with mod See this link for a list of PIDs:.

The response is almost similar. The data field reflects actual data which will probably change every request. The following are example responses with 0x00 as data which is verhicle speed 0. The verhicle will supply the circuit with 12 volt via pins 5 and 16 of the ODB2 connector. The voltage regulator will create 5 volt out of this for the microcontroller and LCD. K-line signals of pin 7 will be converted to appropriate levels via an interface of resistors and a transistor.

On port RC7 you can connect a buzzer optional. When the engine coolant temperature PID 0x05 exceeds the 93 degrees this port will be enabled. A routine for displaying and clearing stored diagnostic trouble codes is included. This can be initiated by pressing the switch for 2 seconds. This routine is untested and will most probably not work. Feel free to try if you have a car with trouble codes.

However, I found that most of these projects either use an ELM 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. All three transceiver IC's worked without problems when the typical application circuit from the datasheet was used.

The OBD class itself has been tested on one Kia car build in For the Teensy 3. For use with Arduino the AltSoftSerial library is used by default. The KWP functionality of this library was verified to work on a Teensy 3. 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. For more information on how to use the library, refer to to the header files. Several parameters related to timing are given by the specification, some others are beyond our influence. To understand how a request works, lets consider the case the 0x0D PID is requested, this represents the vehicle's speed. Requesting the value of a PID consists of two phases, the first is the request phase the second the response.

In the first phase, the bytes necessary for the request are written on the Tx line, according to the specification there should be a 5 millisecond delay between each symbol. It is possible that the ECU still discerns the bytes correctly when this delay is lowered.

The transceiver IC puts the waveform seen on the Tx line on the K-line. However, a echo of this waveform is also provided as output of the transceiver IC and is seen on the Rx of the serial port.

Because this is not part of the response we have to deal with this echo. This is done by using the readBytes method to read the same number of bytes as were sent during the request. Content submitted by Users is not endorsed by CarGurus, does not express the opinions of CarGurus, and should not be considered reviewed, screened, or approved by CarGurus. Please refer to CarGurus Terms of Use. Content will be removed if CarGurus becomes aware that it violates our policies.

Dealer Signup. Prequalify for Financing How does it work? Loan Calculator. General Questions. Shown on my Code Scanner. Report Follow.

Mark helpful. Your Answer:. Upload Photo Photo optional. Related Questions. Start a new Dodge RAM question. Own this car?



0コメント

  • 1000 / 1000