PID formulas

All live values obd-diag knows, with the key for obd-diag live --pids, unit, conversion according to SAE J1979 (service $01) and value range. The table is generated from PIDS in src/obd_diag/protocol/pids.py when the documentation is built.

tests/verification/test_pid_differential.py compares every formula for every possible byte value with python-OBD. Two deviations are intended and justified against J1979:

  • 32 (evap system vapor pressure): 16-bit two’s complement over A and B; python-OBD evaluates A and B separately.

  • 44 (commanded air-fuel equivalence ratio): factor exactly 2/65536 instead of the rounded 0.0000305.

The PIDs 68 (intake air temperature per sensor), 6C (throttle actuator), 6D (fuel rail pressure control), 70 (boost pressure) and 85 (AdBlue) are reported as supported by the Mercedes A 180 d, but there are no responses from the car yet: not yet verified on the car. Their structure follows J1979 according to two independent descriptions that agree (OBDb signal list, DashLogic PID list). Each of these PIDs starts with a status byte A that says which values the vehicle provides; if the bit is missing, the value stays empty. A value only appears anyway if the vehicle reports the PID.

Not included are bit fields without a measured value (01, 03, 12, 13, 1C, 1D, 1E, 41, 51, 65, 88, 92, the control status in 70) and PIDs with a status byte whose structure is not unambiguous in free sources or that the test car does not report (among them 69 EGR, 7A–7C particulate filter), as well as 53/54. They will only be added with the standard (J1979-DA) or real responses.

140 values from 87 PIDs, sorted by PID. A, B, C … are the data bytes after 41 <PID>; the range is the full value range of the encoding, not the physically plausible one.

PID

Key

Value

Unit

Formula

Range

04

engine_load

Calculated engine load

%

100*A/255

0 to 100

05

coolant_temp

Coolant temperature

°C

A - 40

-40 to 215

06

stft_bank1

Short-term fuel trim bank 1

%

100*A/128 - 100

-100 to 99.2188

07

ltft_bank1

Long-term fuel trim bank 1

%

100*A/128 - 100

-100 to 99.2188

08

stft_bank2

Short-term fuel trim bank 2

%

100*A/128 - 100

-100 to 99.2188

09

ltft_bank2

Long-term fuel trim bank 2

%

100*A/128 - 100

-100 to 99.2188

0A

fuel_pressure

Fuel pressure (gauge)

kPa

A * 3

0 to 765

0B

intake_pressure

Intake manifold pressure (absolute)

kPa

A

0 to 255

0C

rpm

Engine speed

rpm

(256A + B) / 4

0 to 16383.8

0D

speed

Speed

km/h

A

0 to 255

0E

timing_advance

Timing advance (before TDC, cylinder 1)

°

A / 2 - 64

-64 to 63.5

0F

intake_temp

Intake air temperature

°C

A - 40

-40 to 215

10

maf

Air flow rate (MAF sensor)

g/s

(256A + B) / 100

0 to 655.35

11

throttle

Throttle position

%

100*A/255

0 to 100

14

o2_s1_voltage

Oxygen sensor 1 voltage

V

A / 200

0 to 1.275

14

o2_s1_trim

Oxygen sensor 1 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

15

o2_s2_voltage

Oxygen sensor 2 voltage

V

A / 200

0 to 1.275

15

o2_s2_trim

Oxygen sensor 2 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

16

o2_s3_voltage

Oxygen sensor 3 voltage

V

A / 200

0 to 1.275

16

o2_s3_trim

Oxygen sensor 3 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

17

o2_s4_voltage

Oxygen sensor 4 voltage

V

A / 200

0 to 1.275

17

o2_s4_trim

Oxygen sensor 4 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

18

o2_s5_voltage

Oxygen sensor 5 voltage

V

A / 200

0 to 1.275

18

o2_s5_trim

Oxygen sensor 5 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

19

o2_s6_voltage

Oxygen sensor 6 voltage

V

A / 200

0 to 1.275

19

o2_s6_trim

Oxygen sensor 6 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

1A

o2_s7_voltage

Oxygen sensor 7 voltage

V

A / 200

0 to 1.275

1A

o2_s7_trim

Oxygen sensor 7 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

1B

o2_s8_voltage

Oxygen sensor 8 voltage

V

A / 200

0 to 1.275

1B

o2_s8_trim

Oxygen sensor 8 trim

%

100/128 * B - 100; B = FF: sensor not used for fuel trim

-100 to 98.4375

1F

run_time

Run time since engine start

s

256*A + B

0 to 65535

21

distance_with_mil

Distance with MIL on

km

256*A + B

0 to 65535

22

fuel_rail_pressure_relative

Fuel rail pressure (relative to manifold)

kPa

(256A + B) * 0.079

0 to 5177.27

23

fuel_rail_pressure

Fuel rail pressure (gauge)

kPa

(256A + B) * 10

0 to 655350

24

o2_s1_lambda

Wide-band sensor 1

Lambda

2/65536 * (256A + B)

0 to 1.99997

24

o2_s1_wide_voltage

Wide-band sensor 1 voltage

V

8/65536 * (256C + D)

0 to 7.99988

25

o2_s2_lambda

Wide-band sensor 2

Lambda

2/65536 * (256A + B)

0 to 1.99997

25

o2_s2_wide_voltage

Wide-band sensor 2 voltage

V

8/65536 * (256C + D)

0 to 7.99988

26

o2_s3_lambda

Wide-band sensor 3

Lambda

2/65536 * (256A + B)

0 to 1.99997

26

o2_s3_wide_voltage

Wide-band sensor 3 voltage

V

8/65536 * (256C + D)

0 to 7.99988

27

o2_s4_lambda

Wide-band sensor 4

Lambda

2/65536 * (256A + B)

0 to 1.99997

27

o2_s4_wide_voltage

Wide-band sensor 4 voltage

V

8/65536 * (256C + D)

0 to 7.99988

28

o2_s5_lambda

Wide-band sensor 5

Lambda

2/65536 * (256A + B)

0 to 1.99997

28

o2_s5_wide_voltage

Wide-band sensor 5 voltage

V

8/65536 * (256C + D)

0 to 7.99988

29

o2_s6_lambda

Wide-band sensor 6

Lambda

2/65536 * (256A + B)

0 to 1.99997

29

o2_s6_wide_voltage

Wide-band sensor 6 voltage

V

8/65536 * (256C + D)

0 to 7.99988

2A

o2_s7_lambda

Wide-band sensor 7

Lambda

2/65536 * (256A + B)

0 to 1.99997

2A

o2_s7_wide_voltage

Wide-band sensor 7 voltage

V

8/65536 * (256C + D)

0 to 7.99988

2B

o2_s8_lambda

Wide-band sensor 8

Lambda

2/65536 * (256A + B)

0 to 1.99997

2B

o2_s8_wide_voltage

Wide-band sensor 8 voltage

V

8/65536 * (256C + D)

0 to 7.99988

2C

commanded_egr

Commanded EGR

%

100*A/255

0 to 100

2D

egr_error

EGR error

%

100*A/128 - 100

-100 to 99.2188

2E

commanded_evap_purge

Commanded evaporative purge

%

100*A/255

0 to 100

2F

fuel_level

Fuel tank level

%

100*A/255

0 to 100

30

warmups_since_clear

Warm-ups since codes cleared

A

0 to 255

31

distance_since_clear

Distance since codes cleared

km

256*A + B

0 to 65535

32

evap_pressure

Evap system vapor pressure

Pa

(256A + B, signed) / 4

-8192 to 8191.75

33

baro_pressure

Barometric pressure (absolute)

kPa

A

0 to 255

34

o2_s1_lambda_current

Wide-band sensor 1 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

34

o2_s1_current

Wide-band sensor 1 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

35

o2_s2_lambda_current

Wide-band sensor 2 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

35

o2_s2_current

Wide-band sensor 2 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

36

o2_s3_lambda_current

Wide-band sensor 3 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

36

o2_s3_current

Wide-band sensor 3 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

37

o2_s4_lambda_current

Wide-band sensor 4 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

37

o2_s4_current

Wide-band sensor 4 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

38

o2_s5_lambda_current

Wide-band sensor 5 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

38

o2_s5_current

Wide-band sensor 5 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

39

o2_s6_lambda_current

Wide-band sensor 6 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

39

o2_s6_current

Wide-band sensor 6 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

3A

o2_s7_lambda_current

Wide-band sensor 7 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

3A

o2_s7_current

Wide-band sensor 7 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

3B

o2_s8_lambda_current

Wide-band sensor 8 (current)

Lambda

2/65536 * (256A + B)

0 to 1.99997

3B

o2_s8_current

Wide-band sensor 8 pump current

mA

(256C + D)/256 - 128

-128 to 127.996

3C

catalyst_temp_b1s1

Catalyst temperature bank 1, sensor 1

°C

(256A + B) / 10 - 40

-40 to 6513.5

3D

catalyst_temp_b2s1

Catalyst temperature bank 2, sensor 1

°C

(256A + B) / 10 - 40

-40 to 6513.5

3E

catalyst_temp_b1s2

Catalyst temperature bank 1, sensor 2

°C

(256A + B) / 10 - 40

-40 to 6513.5

3F

catalyst_temp_b2s2

Catalyst temperature bank 2, sensor 2

°C

(256A + B) / 10 - 40

-40 to 6513.5

42

control_voltage

Control module voltage

V

(256A + B) / 1000

0 to 65.535

43

absolute_load

Absolute load value

%

(256A + B) * 100 / 255

0 to 25700

44

commanded_lambda

Commanded air-fuel equivalence ratio

Lambda

2/65536 * (256A + B)

0 to 1.99997

45

relative_throttle

Relative throttle position

%

100*A/255

0 to 100

46

ambient_temp

Ambient air temperature

°C

A - 40

-40 to 215

47

throttle_b

Absolute throttle position B

%

100*A/255

0 to 100

49

accelerator_pedal_d

Accelerator pedal position D

%

100*A/255

0 to 100

4A

accelerator_pedal_e

Accelerator pedal position E

%

100*A/255

0 to 100

4C

commanded_throttle

Commanded throttle actuator

%

100*A/255

0 to 100

4D

time_with_mil

Time run with MIL on

min

256*A + B

0 to 65535

4E

time_since_clear

Time since codes cleared

min

256*A + B

0 to 65535

52

ethanol_percent

Ethanol fuel percentage

%

100*A/255

0 to 100

55

stft_secondary_bank1

Short-term secondary O2 trim bank 1

%

100*A/128 - 100

-100 to 99.2188

55

stft_secondary_bank3

Short-term secondary O2 trim bank 3

%

100*B/128 - 100

-100 to 99.2188

56

ltft_secondary_bank1

Long-term secondary O2 trim bank 1

%

100*A/128 - 100

-100 to 99.2188

56

ltft_secondary_bank3

Long-term secondary O2 trim bank 3

%

100*B/128 - 100

-100 to 99.2188

57

stft_secondary_bank2

Short-term secondary O2 trim bank 2

%

100*A/128 - 100

-100 to 99.2188

57

stft_secondary_bank4

Short-term secondary O2 trim bank 4

%

100*B/128 - 100

-100 to 99.2188

58

ltft_secondary_bank2

Long-term secondary O2 trim bank 2

%

100*A/128 - 100

-100 to 99.2188

58

ltft_secondary_bank4

Long-term secondary O2 trim bank 4

%

100*B/128 - 100

-100 to 99.2188

5A

relative_accelerator_pedal

Relative accelerator pedal position

%

100*A/255

0 to 100

5B

hybrid_battery_level

Hybrid battery state of charge

%

100*A/255

0 to 100

5C

oil_temp

Engine oil temperature

°C

A - 40

-40 to 215

5D

injection_timing

Fuel injection timing

°

(256A + B) / 128 - 210

-210 to 301.992

5E

fuel_rate

Engine fuel rate

L/h

(256A + B) / 20

0 to 3276.75

61

demand_torque

Driver’s demand engine torque

%

A - 125

-125 to 130

62

actual_torque

Actual engine torque

%

A - 125

-125 to 130

63

reference_torque

Engine reference torque

Nm

256*A + B

0 to 65535

64

torque_idle

Engine torque idle

%

A - 125

-125 to 130

64

torque_point1

Engine torque point 1

%

B - 125

-125 to 130

64

torque_point2

Engine torque point 2

%

C - 125

-125 to 130

64

torque_point3

Engine torque point 3

%

D - 125

-125 to 130

64

torque_point4

Engine torque point 4

%

E - 125

-125 to 130

66

maf_a

Mass air flow sensor A

g/s

(256B + C) / 32; only if bit 0 of A is set

0 to 2047.97

66

maf_b

Mass air flow sensor B

g/s

(256D + E) / 32; only if bit 1 of A is set

0 to 2047.97

67

coolant_temp_1

Coolant temperature sensor 1

°C

B - 40; only if bit 0 of A is set

-40 to 215

67

coolant_temp_2

Coolant temperature sensor 2

°C

C - 40; only if bit 1 of A is set

-40 to 215

68

intake_temp_b1s1

Intake air temperature bank 1, sensor 1

°C

B - 40; only if bit 0 of A is set

-40 to 215

68

intake_temp_b1s2

Intake air temperature bank 1, sensor 2

°C

C - 40; only if bit 1 of A is set

-40 to 215

68

intake_temp_b1s3

Intake air temperature bank 1, sensor 3

°C

D - 40; only if bit 2 of A is set

-40 to 215

68

intake_temp_b2s1

Intake air temperature bank 2, sensor 1

°C

E - 40; only if bit 3 of A is set

-40 to 215

68

intake_temp_b2s2

Intake air temperature bank 2, sensor 2

°C

F - 40; only if bit 4 of A is set

-40 to 215

68

intake_temp_b2s3

Intake air temperature bank 2, sensor 3

°C

G - 40; only if bit 5 of A is set

-40 to 215

6C

commanded_throttle_a

Commanded throttle actuator A

%

100*B/255; only if bit 0 of A is set

0 to 100

6C

relative_throttle_a

Relative throttle position A

%

100*C/255; only if bit 1 of A is set

0 to 100

6C

commanded_throttle_b

Commanded throttle actuator B

%

100*D/255; only if bit 2 of A is set

0 to 100

6C

relative_throttle_b

Relative throttle position B

%

100*E/255; only if bit 3 of A is set

0 to 100

6D

commanded_fuel_rail_pressure_a

Commanded fuel rail pressure A

kPa

(256B + C) * 10; only if bit 0 of A is set

0 to 655350

6D

fuel_rail_pressure_a

Fuel rail pressure A

kPa

(256D + E) * 10; only if bit 1 of A is set

0 to 655350

6D

fuel_rail_temp_a

Fuel rail temperature A

°C

F - 40; only if bit 2 of A is set

-40 to 215

6D

commanded_fuel_rail_pressure_b

Commanded fuel rail pressure B

kPa

(256G + H) * 10; only if bit 3 of A is set

0 to 655350

6D

fuel_rail_pressure_b

Fuel rail pressure B

kPa

(256I + J) * 10; only if bit 4 of A is set

0 to 655350

6D

fuel_rail_temp_b

Fuel rail temperature B

°C

K - 40; only if bit 5 of A is set

-40 to 215

70

commanded_boost_a

Commanded boost pressure A

kPa

(256B + C) / 32; only if bit 0 of A is set

0 to 2047.97

70

boost_a

Boost pressure A

kPa

(256D + E) / 32; only if bit 1 of A is set

0 to 2047.97

70

commanded_boost_b

Commanded boost pressure B

kPa

(256F + G) / 32; only if bit 3 of A is set

0 to 2047.97

70

boost_b

Boost pressure B

kPa

(256H + I) / 32; only if bit 4 of A is set

0 to 2047.97

85

reagent_consumption

Reagent consumption (average)

L/h

(256B + C) / 200; only if bit 0 of A is set

0 to 327.675

85

reagent_demand

Reagent demand (average)

L/h

(256D + E) / 200; only if bit 1 of A is set

0 to 327.675

85

reagent_level

Reagent tank level

%

100*F/255; only if bit 2 of A is set

0 to 100

85

nox_warning_time

Run time with NOx warning

s

(2^24 G + 2^16 H + 2^8 I + J); only if bit 3 of A is set

0 to 4.29497e+09

A6

odometer

Odometer

km

(2^24 A + 2^16 B + 2^8 C + D) / 10

0 to 4.29497e+08