Android OBD-II How to clear the distance traveled (PID0131)?

I am working on an application that I need to calculate the distance traveled from point A to point B (by car).

I asked Elm Electronics (the manufacturer of the chipset), and they said that there is no standard OBD-II PID code to return the odometer mileage, although car manufacturers can provide PID. Since this method is not standard, I found another way.

PID 0131 (Distance traveled since clearing codes) returns what, in my opinion, may be useful. IF I can clear it at point A and read its value at point B, then I finished :)

I thought a lot about what “codes cleared” means, but I could not understand what it means? and another important question: how to clear the code or reset this PID?

Any suggestion will be appreciated. Thank.


Update

I just tested on two cars.

  • There is no OBD-II command in a Benz car. I could not get any data :(
  • I got the correct answer for a Persona car (Local Malaysia), but the 0x0131 PID always returned 7F01, which is 16608KM, even after passing a few Kms. I tried resetting it by sending command 04 (as Eric suggested in return), but nothing worked :) And I still got 7F01 as the answer.

My library can be used for anyone looking for an OBD-II lib from here .

, , (v), d = v * t.

+4
3

Elm Electronics . , , , .

04 . 04 reset MIL ( ) reset , reset.

, . , 04. Th 0131 65535 . , reset , , .

: 04 -

+1

, PID 0x011F ( ) PID 0x010D ( ). SD-, .

0

PID: 0x0121 Distance travelled with malfunction indicator lamp (MIL) on, MIL, 0x0131 Distance travelled since codes cleared, MIL 0x04. , (DTC). , , MIL.

, , afaik, , PID. , * X, PID Y Z , x y - PID , :

Real-Time mileage** = X + (y - Y) + (z - Z)

Trip distance (MIL Off) = x(end) - x(start) 

Trip distance (MIL On) = y(end) - y(start) 

* , PID 0x01A6 Odometer, .

** PID.

0

Source: https://habr.com/ru/post/1569657/


All Articles