Quote Originally Posted by veijavi
I have a project to build an instantaneous fuel consumption meter for my car. I'm quite a new in PIC programming and PICbasic so I would be very pleased if you have any hints or opinions about my project.

I’m planning to use 16f628a, 20x2 lcd and few buttons. I have melab’s LAB-X3 proto board for code testing.

For the consumption calculation I need vehicle speed, engine rpm, injector open time and injectors flow rate @ 3bar.

-speed signal form speedometer hall sensor, it outputs 16 pulses per tyre rotation
-engine rpm from 58 teeth vr sensor or alternatively from rev counter signal
-injector pulse width from injectors

I think that the consumption is calculated with following formulas:

Fuel consumption (liters/sec) = RPM * injector open time * injector flow

and

Fuel consumption (liters/100km) = (RPM * injector open time * injector flow) / speed * 100000

e.g.

Fuel consumption (liters/100km) = (( 1500 rpm / 60 ) * ( 8 ms / 1000 ) * ( ( 190 cc/min ) / 1000 )) / ((( 30 km/h) / 3.6) * 100000) = ~7.6 liter/100km


I think that it might be enough to measure 500 -1000ms each signal and after that calculate the results and print the results to display.

I have searched the forum about pulse counting and pulse width measurement. Something like this is maybe suitable for injector pulse width measurement: http://www.melabs.com/resources/samp.../pbp/ccpx2.bas

Do you have any tips for counting the other pulses and handling all the three signals almost at the same time?

The attachment is a excel file for demonstrating the calculations.

-Vili

The consumption meter won't work as you have it described. I've tried it ('98 Nissan and '01 Dodge). The numbers end up out in the weeds.

TPI, multiport, (sequential fire, batch fire, doesn't matter) etc. fuel injection systems have a fuel pressure regulator referenced to manifold vacuum which means the rail pressure changes as the manifold pressure changes. Now, yes, this does mean that the pressure across the tip of the injector remains relatively constant, but it's not nearly as precise as a person would think.
Then you have to throw in the fact that most autos don't spend all of their time in perfect closed loop. Hit the gas, and you're burning roughly a 12-13 to 1 Air/Fuel ratio, get off the gas for a stop sign and you might only be burning 20 to 1, idling will tend to be on the rich side of stroich (14.7:1).

BUT! Don't let all of that negativity stop you! It's a fun project to play around with. And as I learned, you get to play with figuring out how to hook up to various inputs, condition the noise out of them, and do math in the relatively restrictive environment of a PIC. Even if the fuel meter part doesn't work so well, you can log your speed, rpms, pulse width, etc. and look at it later to see what you were doing. Just don't forget to keep your eyes on the road while you're testing the system, and not on the LCD to see what's going on!

JDG