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.