I read some Question like that but the best that i found is to fill the tank and read how many km you can do with that tank and register it.
But i'm developing an application that read information with phone via the OBD2 port. And i can read type of fuel, engine coolant temp, rpm and speed. Also i know the distance and duration of user travel and i would calculate an estimation if the tank level can be enough for the travel.
It's possible to do that with the obd2 connected with the phone? I don't need very precise value but something that let the user if the fuel can't be enough for the travel.... Like a control every 5 min of some parameters that calculate the consume in real time...
I need some particular Pids of OBD besides rpm, speed, fuel level and fuel type?
Here a table with all PIDs in mode 01 (real time data) that i can read if the car support related pid... PIDs table on wikipedia
I read that is impossible to get distance traveled from obd2...the only thinks that i can read from it (if my car support it) is the PID 015E = Engine fuel rate (L/h). Or i can use the GPS that every tot time (5 min) can find location user and with: travel_total_distance - percur_distance_from_GPS(taken by start distance travel - total_distance_travel that is less every time)....
I try to use the MAF for calculating Fuel Consumption reading this Link but my car don't support the MAF PID, 0110 i get NO DATA response, so this formula is not good. The only think that is supported to all car is the speed car and with this i can use some inverse formula and get distance traveled.
Speed = Distance/Time, so Distance = Speed x Time.... i get time monitoring using phone from start travel to lecture consuming and calculate the percurred km.... anyway with this method the result is obsolete if car is stopped because 0km/h = no consuming :D :D (and it's wrong)...maybe i can set some standard value if the car is stopped but the motor is on.
instantaneous Distance D = VSS * t/3600
instantaneous Fuel F = 1 /(14.75 * 6.26) * MAF * t/60 instantaneous
MPG = D / F
VSS = Vehicle
Speed Sensor MAF = Mass Air Flow Sensor
Legenda translations: Km percorsi = percurred km Livello carburante = Tank level fuel Consumo stimato = stimed consumption Km percorribili = km that the car can percur with the remaining fuel