3

Is there a way that I can calculate the current range of a vehicle, using data provided via OBD-II?

I know I can find out the fuel percentage using fuelLevelInput, but how can I find out how many miles that equates to?

I am using a OBD system that roughly calculates MPG for me, is there a way I can use that in conjunction with fuelLevelInput, to estimate the current range of the car in miles?

My understanding is that all I have to do, is to multiply the MPG with the current fuel level in gallons. The problem is that fuelLevelInput only provides a percentage. Is there a way to find out the fuelLevelInput in gallons or litres?

Thanks for your time, Daniel.

  • Welcome to Mechanics.SE! I've just spent the better part of 30 minutes looking for a duplicate for this question and cannot find it, lol. I'm not sure which "OBD system" you are using or how you are pulling the information from the vehicle. It seems to me a little bit of programming along with the amount of fuel in the tank should allow you your answer. It's just a matter of quantity divided by current MPG should give you your range. How to get that done is going to be dependent upon the system you are using to get the information out and whether it can be further programmed. – Pᴀᴜʟsᴛᴇʀ2 Jan 31 '17 at 11:39
  • @Pᴀᴜʟsᴛᴇʀ2 Yeah I'm programming an app that read OBD data. The only way I can think of, is to get access to a database that provides "max fuel capacity" for any vehicle. I can then use the fuelLevelInput percentage to roughly figure out the current vehicle fuel level in gallons, which can then be multiplied by MPG, to figure out the range. The only problem is that I cannot find a suitable database. – Supertecnoboff Jan 31 '17 at 11:46
  • 2
    You may have to create your own database, which would take a little bit of research. I'm thinking there should be easier ways to get approximate range, but you'd have to know how much fuel is in the tank. I was thinking you were doing this for one car, but rather you are trying to make it generic and be able to work on any OBDII vehicle. – Pᴀᴜʟsᴛᴇʀ2 Jan 31 '17 at 11:50
  • I found a suitable database in the end, that provides the max fuel capacity in gallons. Thanks for your help. – Supertecnoboff Feb 1 '17 at 10:47
  • What car? A lot of makes have non-standard OBD2 PIDs that already give the range. Ford, Subaru, etc. – Nick Feb 1 '17 at 15:19
2

I managed to solve my own problem, below are the steps I took to calculating the range (in case anyone else is interested):

1) Store the fuelLevelInput percentage for later use.

2) Use the following website to get details about the car (identification via car VIN number). The property I am after is called "Fuel Capacity" - the car's max fuel tank capacity in gallons.

3) Convert the current fuel level percentage into gallons by doing the following: (fuelLevelInput * max fuel tank capacity) / 100 = current fuel level (in gallons).

4) My OBD device/app that I am working on, calculates/stores all the MPG values of the recorded trips. So I add all the MPG values together and divide by the number of trips, to find out the average MPG value.

5) Now simply multiply the average MPG value with the current fuel level in gallons and you have an approximate current fuel range.

Note

Obviously this does not take other factors into consideration, such as but not limited to:

  • Driving gradients
  • Start/Stop traffic
  • Rate of acceleration
  • Rate of deceleration
  • Gears used (and the rate of acceleration in each gear)
  • Wind resistance

So its not going to be the most accurate range, but in my case it will do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.