I wanted to do something useful with the OBD interface of my car, this is the result.
Various data (atm: speed, coolant temperature, intake air temperature and mileage) is displayed on a video signal of a small ccd cam.
My car came with EOBD, but the data you can get from the various OBD-II interfaces heavily depends on the actual car. The range goes from basic data like speed and oxygen sensor up to the status of every single door (VAG cars for example) or even resetting the 250km/h speed limit of many german cars (can only be lowered, don't mess)
In my case (Toyota Celica T23 1ZZFE), I could read out speed, rpm, intake air temperature, mass air flow sensor, coolant temperature, load, ignition timing advance and some other stuff.
There is a lot of documentation about OBD available. A good start is reading the datasheet of a ELM323 or ELM327.
I used the ELM323 to access the OBD, which supplies a stable and easy way to speak with it via UART.
On Screen Display
For analog signals like such from my camera, its recommandable to use dedicated hardware if possible. I used a STV5730, which allows the overlay of a video signal with simple grey text. Its an old chip (EOL as far as I know), but quite easy to use.
An interesting part is the mileage calculation, which is not given by the OBD. Of course, what I get here is not more than a rough estimate, but the results I've seen were realistic (the build-in mileage displays of most cars do not work very accurate either).
Anyway, this method pays no attention to:
- richer mixture while the engine is cold
- lean mixtures
- fuel cut off on the overrun
- thermal expansion of gasoline
The calculation itself is quite easy:
- Read out the mass airflow sensor (g/s)
- Use the stoichiometric composition of 14.7g air to 1g gasoline to calculate gasoline g/s
- calculate l/s with the density of 0.74 kg/l (average!)
- use the vehicle's speed to get l/100km (or mpg if you like ancient units)
Source is available on request.