In this tutorial, you will learn how to connect to OBD-II and read RPM, speed, engine load, and coolant temperature.
To follow along, you will need an OBD interface, a computer, and access to an OBD-II compliant vehicle. The OBD interface (“tester”) used in this example is an OBDLink S, but since it emulates the ELM327, you can use any interface that supports the ELM327 AT command set.
There is a common misconception that a tester “reads” data that is “broadcast” on the OBD bus. In fact, under normal circumstances, the tester must request the data it wants, from the Electronic Control Module (ECU).
To get started, you need to connect the OBD interface to the diagnostic connector and the host. In this example, we will be using HyperTerminal — a terminal emulation program included with Windows XP and earlier versions of Windows. If you use a newer version of Windows (Vista or 7), you can use TeraTerm, RealTerm, or any other terminal emulation software.
Configure the COM port for 115.2kbps, and connect the interface to your computer and the vehicle’s diagnostic port. If you did the steps in this order, you will see the device identify itself and print the command prompt:
ELM327 v1.3a >
Let’s set the protocol to “AUTO”, which means that you want the interface to automatically detect the protocol when you send the first OBD request. To do this, enter the “AT SP 0” command:
>AT SP 0 OK
To verify the protocol, enter the AT DP command (“Display Protocol”):
>AT DP AUTO
Now it is time to send our first OBD request. Real-time parameters are accessed through Mode 1 (also called “Service $01”), and each parameter has a Parameter ID, or PID for short. RPM’s PID is 0C, so we must tell the interface to send “010C”:
>010C SEARCHING: OK 41 0C 0F A0
The reply contains two bytes that identify it as a response to Mode 1, PID 0C request (41 0C), and two more bytes with the encoded RPM value (1/4 RPM per bit). To get the actual RPM value, convert the hex number to decimal, and divide it by four:
0x0FA0 = 4000 4000 / 4 = 1000 rpm
Speed’s PID is 0D:
>010D 41 0D FF
To get the speed, simply convert the value to decimal:
0xFF = 255 km/h
Engine load is PID 04, and we need to first divide the response by 255, and multiply it by one hundred percent:
>0104 41 04 7F
0x7F = 127 (127 / 255) * 100 = 50%
Coolant temperature (PID 05) is reported in degrees, and is obtained by subtracting 40 from the value:
>0105 41 05 64
0x64 = 100 100 - 40 = 60C