OBD II UART Hookup Guide
The OBD commands are made up of hexadecimal codes written in ASCII characters. Generally, these commands contain 2 or more pairs of hexadecimal numbers, however there are a few commands that only require one hex pair.
The first hex pair in the OBD command represents the OBD mode which should be used. Any following hex pairs after that represent the Parameter ID (PID) to be read from the specified mode. There are 10 OBD modes, but keep in mind that not all vehicles will use all 10 modes. You will want to check your particular vehicle's protocols to see what OBD modes and parameter IDs are supported.
|Mode Number||Mode Description|
|02||Freeze Frame Data|
|03||Diagnostic Trouble Codes|
|04||Clear Trouble Code|
|05||Test Results/Oxygen Sensors|
|06||Test Results/Non-Continuous Testing|
|07||Show Pending Trouble Codes|
|08||Special Control Mode|
|09||Request Vehicle Information|
|0A||Request Permanent Trouble Codes|
You can read up more on the OBD PIDs functionality on Wikipedia. Some vehicle manufacturers also use their own proprietary parameters, so keep in mind that these may not be a comprehensive list for your car. Again, the ELM327 AT Commands datasheet is another good resource to check out.
Possibly the most important PID is 00. This works on any vehicle that supports OBD and gives a list of other PIDs which the car supports. In your terminal window (you do still have that open, right?!), type "0100" and hit "enter". This command translates to "In mode 01, what PIDs are supported?"
There is a general structure that all OBD responses have in common. The first response byte (in this case 0x41) lists the mode that was requested in the command. Thus the board sends 0x40 + 0x01. The second byte is the parameter that was requested, so in our case, 0x00. Any following bytes are the responses to the command. In this case, the bytes 0xBF, 0x9F, 0xA8 and 0x93 are the PIDs that are supported by the vehicle.
One other commonly supported parameter is the 'Read Engine RPM'. Issue command "010C' and press enter. Keep in mind that the board will respond with a value listed in hex.
The response structure is the same as before. 0x41 to state the board is in mode 01, followed by 0x0C to show that the board is looking at the RPM parameter. The returned value of 0x0E 0x96 can then be converted into a decimal value of 3734. This is actually 4 times the actual RPM, as this value is listed in quarters of RPM. Once the value is divided by 4, we have an idiling RPM of 933.
Check out the datasheet for the ELM327 for more PIDs to try out. Now let's look at hooking the OBD-II board up to an Arduino.