Skip to content
09.11.2018

OBD (On-Board Diagnostics): OBD Modes, PIDs and Reading Data with ELM327

OBD (On-Board Diagnostics) is the system that lets a vehicle detect and report its own faults. This article covers what OBD-II standardises, how to read data from a terminal with an ELM327-based adapter, and how the same job is done with SAE J1939 on trucks and heavy machinery.

OBD-II 16-pin connector, ELM327 terminal commands, fault code P0301 and a J1939 truck symbol

First published: 09.11.2018. Last updated: 14.11.2026.

OBD in brief

  • 1970s and 1980s: The first diagnostic systems arrived with the on-board computers that managed fuel injection. Each manufacturer had its own connector and protocol (for example General Motors’ ALDL, the Assembly Line Diagnostic Link); most systems only lit a warning lamp.
  • 1991: Basic diagnostic capability became mandatory for new vehicles in California. This period was later called OBD-I; connector and protocol were still not standardised.
  • 1996: OBD-II became mandatory for new cars sold in the USA: standard connector, standard protocols and standard fault codes.
  • 2001 and 2003/2004: The European equivalent, EOBD, became mandatory in the EU first for petrol and then for diesel passenger cars.
  • 2010: HD-OBD requirements came into effect for heavy-duty engines in the USA.

What does OBD-II standardise?

  • Connector: the 16-pin diagnostic connector. Pin 16 supplies battery power, so a scan tool needs no separate supply. On vehicles using CAN, CAN-H is on pin 6 and CAN-L on pin 14.
  • Protocols: electrical signalling and message format. Most newer vehicles use CAN.
  • Services (modes): ten services are defined for live data, stored fault codes, clearing codes and so on. Not every vehicle supports all of them.
  • Fault codes (DTC): one letter and four digits, for example P0301. The letter shows the system: P powertrain (engine and transmission), B body, C chassis, U network.

OBD modes (services)

OBD-II defines ten modes. Not every vehicle supports all of them; you can ask the vehicle which ones it supports.

Mode What it does
01 Live data (engine speed, vehicle speed, coolant temperature, etc.)
02 Freeze frame data stored when a fault occurred
03 Stored diagnostic trouble codes
04 Clear trouble codes and diagnostic information
05 Oxygen sensor test results (non-CAN vehicles)
06 On-board monitoring test results
07 Pending trouble codes
08 Control of on-board systems
09 Vehicle information (VIN, software IDs)
0A Permanent trouble codes

Manufacturers may add their own parameters and codes on top of the standard ones.

Reading data from a terminal with ELM327

Many adapters plug into the OBD port over USB, serial or Bluetooth; most use the ELM327 chip. We ran our tests with an ELM327-based adapter. Open a terminal program such as Docklight or Tera Term and select the serial port the adapter is on.

  1. Start the connection: type ATZ and press Enter. This resets the adapter, which then sends its version string. If you see garbled characters, check the serial settings (baud rate etc.) of the terminal.

ELM327 response to the ATZ command

  1. Read the battery voltage: type ATRV and press Enter. The adapter returns the system voltage it measures.

System voltage read with the ELM327 ATRV command

OBD commands are hexadecimal number pairs written in ASCII. The first pair is the service (mode); the following pairs give the parameter ID (PID) to read.

OBD services (modes)

  1. Ask for the supported PIDs: type 0100 and press Enter. This asks which PIDs the vehicle supports in service 01.

Response to 0100: list of supported PIDs

All OBD responses share the same structure. The first byte is the requested service plus 0x40: 41 for service 01. The second byte is the requested PID, here 00. The remaining bytes are the answer; in this example BF 9F A8 93 flags, bit by bit, the PIDs the vehicle supports.

  1. Read the engine speed: engine speed is PID 0C in service 01 and returns 2 bytes. Type 010C and press Enter. The response starts with 41 0C; the next two bytes are the engine speed.

Engine speed read with the 010C command

In our project the value read was 0E 96, which is 3734 in decimal. This is four times the actual speed; dividing by 4 gives an engine speed of about 933 rpm.

Stored fault codes are read with service 03 (the 03 command). The response starts with 43, followed by the codes. Service 04 clears codes; since it also erases the stored fault information, do not use it before the fault has been fixed.

Trucks and heavy machinery: SAE J1939

On trucks, buses and heavy machinery, the engine and other controllers usually communicate with SAE J1939. J1939 runs on CAN; the most common bit rate is 250 kbit/s. Data is grouped in PGNs (parameter group numbers) and individual values are identified by SPNs (suspect parameter numbers). Active faults are broadcast in the DM1 message as an SPN with an FMI code that gives the failure type.

Older Caterpillar machines use the J1587/J1708-based CAT Datalink, which predates J1939. We describe the tool we built to monitor this line over a serial port in Serial Port Terminal for CAT Datalink.

Related pages on our site

Need diagnostic data from your machine? We build displays and control systems that read data over J1939, CANopen or manufacturer-specific protocols. Get in touch →

Frequently Asked Questions

What are the OBD-II modes?

OBD-II defines ten modes (services): 01 live data, 02 freeze frame, 03 stored trouble codes, 04 clear codes, 05 oxygen sensor tests, 06 on-board monitoring results, 07 pending codes, 08 control of on-board systems, 09 vehicle information and 0A permanent codes.

How do you read an OBD-II fault code?

A code is one letter and four digits, for example P0301. The letter shows the system: P powertrain, B body, C chassis, U network. If the first digit is 0 the code is generic; 1 means manufacturer-specific.

Which commands do you send first to an ELM327 adapter?

Reset the adapter with ATZ and read the battery voltage with ATRV. Then ask for the supported PIDs with 0100 and read live values with commands such as 010C.

How is the engine speed calculated?

Convert the two-byte value in the 010C response to decimal and divide by 4. For example 0E 96 = 3734, 3734 / 4 ≈ 933 rpm.

Is OBD used on heavy machinery?

On trucks and heavy machinery the engine and controllers usually communicate with SAE J1939. Data is read from the CAN line as PGNs and SPNs, and active faults arrive in the DM1 message.

Sources

  • SAE J1979 / ISO 15031: OBD diagnostic services and PID definitions
  • SAE J1939: vehicle network and diagnostics for heavy-duty vehicles
  • On-board diagnostics, Wikipedia (source of the history summary)

Get the most out of your machines

Do you have a project or a question? Our engineers are ready to help.