Fuel Metrics
A widget that calculates and displays fuel consumption, cost, and economy in real time. Depending on what your vehicle exposes via OBD2, it automatically picks the best source from three options: PID 0x5E → MAF → Speed-Density estimation. This page covers how each method differs, how to tune Speed-Density mode, and what each setting means.
1.Overview
The fuel metrics widget combines instantaneous economy, cumulative consumption, cumulative cost, and average economy into a single slot. The core calculation is fuel flow rate (L/h) — get that right and everything else is right.
Because the data available over OBD2 varies by make and model year, three fallback methods are provided. Newer vehicles get the most accurate source; older ones still get a usable approximation via Speed-Density.
2.On-screen items
The slot displays the following — exact items shown depend on slot size:
| Item | Unit | Meaning |
|---|---|---|
| Instantaneous economy | km/L · MPG · L/100km | Speed / fuel flow |
| Fuel flow | L/h | Live consumption rate |
| Cumulative consumption | L | Session running total |
| Cumulative cost | ¥, $, etc. | Consumption × unit price |
| Average economy | km/L | Distance / cumulative fuel |
| Calculation source | — | PID 0x5E / MAF / Speed-Density / not connected |
3.Fuel flow calculation (three-tier fallback)
The app picks a source automatically in this priority order, based on what the vehicle supports:
① PID 0x5E — Engine Fuel Rate (most accurate)
Reads the fuel flow value the ECU has already calculated internally. Since it comes from actual injection quantity, it is the most accurate option and requires no user tuning.
Supported on: relatively recent vehicles (some 2010s+ models)
② Estimated from MAF (Mass Air Flow)
Uses the air mass flow from PID 0x10 and assumes a stoichiometric air-fuel ratio to back out fuel mass. Practical accuracy in low-load conditions.
fuelRate (L/h) = MAF (g/s) × 3.6 ÷ AFR (14.7) ÷ density (0.75 kg/L)
| Constant | Value | Meaning |
|---|---|---|
| 3.6 | — | g/s → kg/h unit conversion |
| AFR | 14.7 | Stoichiometric AFR (gasoline) |
| Density | 0.75 kg/L | Gasoline density |
Supported on: any vehicle with a MAF sensor
③ Speed-Density estimation (for vehicles without MAF)
Estimates the air mass flow itself from MAP, RPM, intake air temperature, displacement, and volumetric efficiency (VE), then derives fuel flow from there. This is the only mode that requires user tuning.
Air density ρ = MAP / (287.05 × (IAT + 273.15)) Volumetric flow V = displacement × RPM / (2 × 60) // 4-stroke MAF estimate = ρ × V × VE Fuel flow = MAF / AFR ÷ density × 3600
Dynamic VE correction: VE is corrected by base VE × (1 + 0.13 × load%), where load% is derived from MAP / atmospheric pressure. Idle vacuum maps to 0% load, NA WOT to 100%, and boost is clamped at 120%.
AFR enrichment under boost: AFR = 14.7 / (1 + enrichment × min(boost/40, 1)). Enriches the mixture proportional to boost, approximating the fuel enrichment turbo engines apply at high load.
4.Deceleration fuel-cut detection
In Speed-Density mode the app approximates fuel cut during engine braking. When all of the following conditions are met, fuel flow is throttled to the idle ratio (default 0.5×):
- Fuel-cut feature enabled (fuelCutEnabled = true)
- Vehicle speed > 5 km/h
- MAP < 30 kPa (high vacuum)
- RPM > 1500 (high engine speed)
5.Detail settings
Settings split into "global" (tied to the vehicle, shared across all slots) and "per-slot" (display customization).
Global (vehicle parameters)
| Item | Range | Description |
|---|---|---|
| Calculation mode | Read-only | Shows the currently selected source (PID 0x5E / MAF / Speed-Density / not connected) |
| Engine displacement | 1000–20000 cc | Used by Speed-Density calculation |
| Volumetric efficiency (VE) | 0.50–1.50 | Base VE for Speed-Density. Tune by comparing against actual fill-ups |
| Boost enrichment | 0–30% | Fuel enrichment under boost. NA: 0%, turbo: 10–20% as a starting point |
| Decel fuel cut | ON / OFF | Treats fuel use during engine braking (high vacuum + high RPM + moving) as zero |
VE, boost enrichment, and fuel cut only appear in Speed-Density mode (irrelevant when PID 0x5E or MAF is available).
Per-slot (display)
| Item | Description |
|---|---|
| Price unit | L / US gallon toggle |
| Fuel price | e.g. $5.50 /gal |
| Show fuel cost | Toggle the cost line (active outside tall/wide layouts) |
| Cost alert | Notify per N units of cost (e.g. every $5) |
| Display unit | km/L / MPG / L/100km |
Design principle: physical, vehicle-bound parameters (displacement, VE, enrichment) are global; user preferences (pricing, currency, alerts) are per-slot.
6.Update rate and session handling
| Item | Value |
|---|---|
| Calculation interval | 500 ms (2 Hz) |
| Accumulation | dt × flow (L/h) / 3600 = ΔL |
| Outlier filter | Samples with > 5 s gap are ignored |
| Auto-reset triggers | BLE connection / recording start / slot settings cleared |
7.Tips
Improving accuracy
- First, check "calculation mode" in the detail settings to see which source is active
- If PID 0x5E is available, no tuning needed — it comes straight from the ECU
- MAF mode usually does not need tuning either (stoichiometric assumption is accurate in cruise)
- Only Speed-Density mode requires VE tuning. Compare cumulative consumption to actual fill-ups: too high → lower VE; too low → raise VE
Turbo vehicle starting point
- VE: 0.85
- Boost enrichment: 15%
- Fuel cut: ON
NA vehicle starting point
- VE: 0.80 (typical)
- Boost enrichment: 0%
- Fuel cut: ON
Pricing and cost alerts
- Gallon mode targets the US market — pairs naturally with MPG as the display unit
- Alert intervals let you set notifications "every $5 / $10 / $20" for long drives
8.FAQ
How do I tell which mode is active?
The "calculation mode" field in detail settings shows the current source (PID 0x5E / MAF / Speed-Density / not connected).
Cumulative consumption does not match actual fill-ups
In Speed-Density mode, tune VE: too high → lower it, too low → raise it. If MAF mode is also off, the MAF sensor itself may be aging or the air filter may be clogged.
Is it normal that consumption keeps climbing at a stoplight?
Yes. Engines burn fuel at idle. Decel fuel cut only applies during engine braking, not at idle.
Does it work on diesel vehicles?
Currently the math assumes gasoline (AFR 14.7, density 0.75 kg/L). Diesel has different AFR and density, so values won't match.
How do I clear cumulative values?
There is no dedicated manual reset button. Cumulative consumption, cost, and average economy are reset automatically when (1) the OBD adapter (re)connects via BLE, (2) a recording is started, or (3) slot settings are cleared.
Why no average economy in playback?
Recording snapshots only store the instantaneous flow rate — cumulative values (trip fuel, average economy) are not saved. They are visible only during a live drive.
Download OBD NINJA
Free on iOS and Android.