Fuel consumption display


Closed Thread
Results 1 to 18 of 18
  1. #1
    Join Date
    Nov 2006
    Posts
    2

    Default Fuel consumption display

    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
    Attached Files Attached Files

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    If this is a newer (95-Present) car you may want to think about interfacing with the onboard diagnostics computer via the OBDII standard. You will be able to compensate for all the variables mentioned above and make the device fairly accurate.

    This company makes a chip that interfaces directly with the computer (check out the ELM327). You could tie your pic to IC and read the onboard computer directly:
    http://www.elmelectronics.com/

    I know your are looking to make your own device but here is some inspiration:
    http://www.scanguage.com

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    On another note, I'm in the process of making just such an item. Interfacing with OBD2, pulling air flow data, temp's, rpm, speeds, etc. and calculating fuel mileage. The only problem is that nobody sells a blank PCB to stuff parts into. That's what I'm designing right now, getting the bugs out, making sure it can stand up to a vehicle's rotten power system. Hold off for another week or so and I should have a load of blank PCBs on hand.
    JDG

  5. #5
    Join Date
    Nov 2006
    Location
    ist
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Veijavi ,
    Im interesting your project ,

    also I think you dont need rpm data ,
    if you know injectors duty cycle, calculate per hour fuel consumption .
    for example ,if your injectors 200 cc/min ,duty cycle is 100 percent (of course this is example ,otherways most car injectors duty cycle is maximum %70-%85 ) your consumption is 200 cc per minute /per injector ..

    So ,
    How are you calculate injectors duty cycle ?
    I dont know well ,but people do it ,only 1 injectors input ,calculate duty .

    Here you can check this,I have this kit ,they are only use a 16f84a pic microcontroller and only 1 injector data ,than calculate easy and its true ,I use and check it .

    http://www.jaycar.com.au/productView...=&SUBCATID=347

    Other friend say about rail fuel pressure ,
    yes its true ,because fuel pressure regulator is change fuel pressure ,mostly on turbo car ,it is a problem also ..

    Maxi

  6. #6
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    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
    Hello you All..

    Skimask, are you there?

    I built my car fuel consumption and something is not going well. It works like this:
    The software does the measuring of the injector's on_time and also the distance run. TMR1 ticks every 100us and the injector's on_time keeps being added up by 1 at each tick in a WORD variable. The distance is also being added up in a word variable. (my car 'distance' sensor ticks 8,31 pulses per meter). The software keeps counting both ticks and on every kilometer (8310 pulses) it does the math and calculates the km/L by a running average of 10km.

    So, the thing is. When driving at a low rate of speed it shows a very low km/L. When driving at high speed, it shows a very high km/L. For example: Driving in the city, it shows 5~7 km/L (it should show 7~9 km/L) and driving at the roadway, it shows 13~20 km/L (it should show 9~11km/L).

    I read what you wrote about pressure's difference and stuffs like this. But, what I can not understand is: Isn't the injector's on_time proportional to its output? Do you know why this is happening?

    It would be great any tips now..

    Thanks in advance!

    Regards.
    Last edited by sirvo; - 24th September 2007 at 04:39.
    Sylvio,

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sirvo View Post
    Isn't the injector's on_time proportional to its output?
    Hi Sirvio,
    The short answer is, likely not. The OEM computer in your car keeps adjusting injector on time based upon sensor input from the oxegen sensor in the exhaust, the throttle position sensor, the mass airflow sensor, if equipped, a MAP sensor, if no MAF sensor, temp sensors in the air and water, a BARO sensor, a data lookup table, Knock sensor, and probably the engineer's astrologer too. So there is no design requirement for the injectors output to be linear, in fact most computers have what they refer to as BLOCK LEARN, which is most likely flash or eeprom memory to keep track of fuel curves so as to alter the computer's calibration around your driving habits. I notice my old exCHP car sure runs better after the wife drives it for a while.
    Last edited by Archangel; - 24th September 2007 at 07:23.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  8. #8
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi Sirvio,
    The short answer is, likely not. The OEM computer in your car keeps adjusting injector on time based upon sensor input from the oxegen sensor in the exhaust, the throttle position sensor, the mass airflow sensor, if equipped, a MAP sensor, if no MAF sensor, temp sensors in the air and water, a BARO sensor, a data lookup table, Knock sensor, and probably the engineer's astrologer too. So there is no design requirement for the injectors output to be linear, in fact most computers have what they refer to as BLOCK LEARN, which is most likely flash or eeprom memory to keep track of fuel curves so as to alter the computer's calibration around your driving habits. I notice my old exCHP car sure runs better after the wife drives it for a while.
    Hi Joe.. thanks for answering..
    I agree with you but, let me ask you in another point of view. Lets think that the pressure on the gas line is constant (~3bar). The same way, lets think that if you let 1 injector 1s on, it will output 15ml, it means, the injector outputs 15ml/s. If I can measure the injector on time, It does not matter the fuel curves and engine maps, only the on time. Isn't that write? In other words, the sensors, maps, curves, engineer's astrologer (heheh) and so... only change the on time, but not the 15ml/s. Could you get it?

    I did not mean to be rude or anything. Don't get me wrong please! I'm not english neither north american so sometimes my english does not help me to be clear.

    Thanks a lot..!

    Regards..
    Sylvio,

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink K.I.S.S. always K.I.S.S. !!!

    Hi, Servo

    You're right, fuel pressure keeps steady ... so, just measure how long your injectors are open, make a "real life" calibration ( how much fuel vs total injectors "bleeding" time ) and that's it ...

    It's very simple ... just look at fluid mechanics laws for quasi-ideal liquids, and you'll see volume is a function of time and pressure @ 99.99% !!!

    so, you just have to measure the pulses driving your injectors ... just 5 wires to wire !!!

    Alain
    Last edited by Acetronics2; - 24th September 2007 at 08:19.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  10. #10
    Join Date
    Dec 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Lightbulb Re: Fuel consumption display

    I am trying to calculate fuel consumption as a function of RPM. So for a given rpm and an engine size I can fetch the approximate fuel consumtion (liters per minute). Does any one know of an equation that can achieve that.

    Also your equation which you have used (Fuel consumption (liters/100km) = (RPM * injector open time * injector flow) / speed * 100000) is quite good and it is working for me. However, do you have a reference for where you got the equation for. Also is the 8 ms a standard for flow open time for all engines.

    Thank you kindly for your help

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    You will be closer at guessing the next lottery numbers than using just RPM to measure fuel consumption. You need to know BSFC and AF ratio as a starting point.

  12. #12
    Join Date
    Jun 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    Just a thought but if you can get 2 fuel flow sensors you can get a pretty accurate reading. You have to get the flow in and out of the system and then just do a little subtraction. Can't remember where I saw it. But someone did this and it worked over all driving conditions. If you have a flow of 5 gallons per hour(GPH) in and 3GPH out then you are using 2GPH. Or what ever measure you use. You get the in and out because the injection system has a return line to the tank for the fuel not used. Only problem with this is trying to find the flow sensor. I have been trying to find just one for my old truck and they seem to be non-existent now. They used to be every where.

  13. #13


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    The flow sensors we use in drag racing are about $2000!!! They are deadly accurate but very pricey.

  14. #14
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    Guys, I'm no authority on this, but if that data is available on the OBD2 connector in your vehicle, how about just getting a bluetooth OBD2 adapter, and couple it with a tablet/phone running Android (App: Torque)? Would be an inexpensive, and easy solution.

  15. #15
    Join Date
    Dec 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    Thanx.

    BUt what I need is an approximation. I understand that there is no way to caclulate the fuel consumption because of the acceleration, deceleration, and load. However, if you are calculating fuel consumption at a constant speed, then wouldnt there be an equation to calculate the fuel consumption.

  16. #16
    Join Date
    Dec 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    Also, does any one know where this equaiton comes from:

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

    Is there a source or is it just a wild guess...........

  17. #17
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    Hi,

    post #1 was not clear enough ???

    I do not see a clearer explanation ....

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  18. #18
    Join Date
    Dec 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Fuel consumption display

    I will make the question clear, if a car is moving at a constant speed (constant RPM) no acceleration or decleration (no going up the hill or down the hill).

    Through some research I found this equation: Fuel consumption per minute = (RPM/2)*(Engine size in Liters), however the number it gave was really out of scope.

    The other equation which is the one I got from this thread which is

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

    For the this equation, I assumed that injector flow is the engine capacity and it gave me good results but I still need to know the source for the equaiton.

Similar Threads

  1. Hdsp 21xx display
    By Original in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th June 2012, 20:07
  2. Using CCP1 and CCP2 to measure instant fuel consumption
    By srspinho in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th September 2008, 15:50
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 13:12
  5. Replies: 14
    Last Post: - 26th September 2007, 05:41

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts