Fuel level gauge with smoothing

Hi there! i hope you can help me a bit with this. Im looking for a smoothing fuel level reading of a old car, it's just resistence that goes from fuel level gauge to cluster.

Resistance is :

Empty: 105-108ohm
1/2 : 29.5-35.5
Full : 3.5-5

Problem is fuel gauge fluctua according corner, so it's not too precise, ive been looking for to do this:

Im still very noob on this so id like to know if you can help me out for to make this possible.

Also since i will have to use a arduino board for this of course, wouldnt be possible to convert in other ouptut, from resistance to voltaje? i did a voltage divider ago long time for fun and that should works but i means, that would be possible even to set it up resistance reading "smoothed" , converted to 0-5v? maybe for a display that read only voltage and non resistance.

Thank you very much !

W.R

The project is highly doable.

A [url]https://github.com/sebnil[/url], a moving average filter might be of some help.

1 Like

Thank you i will take a look, since i have no much idea about codign yet, still learning, i hope someone can help me with that!

Thank you!

Can I ask why you are considering using an Arduino? The usual setup is to have a the sensor controlling the current through a simple ammeter. The reason it fluctuates is that the resistive track of the sensor becomes worn over use and typically becomes non-linear reflecting the way the fuel level has been maintained. Also the slider contact deteriorates.
So my first thought would be to replace the sensor with a new one?
How would you incorporate a new display into your instrument cluster?

The main reason it fluctuates is because the fuel sloshes about when the vehicle is moving.

Hi, yes, that's problem, sensor is good.

Do you can help me with smoothing code for starting?

i assume car sensor will replace that potentiometer, correct?.

if i understand correctly, reading is 10 times per second?

Input 0 : this is the pin when i have to connect resistance signal from sensor?

how do i can get output for connect to speedometer with resistance "smoothed"

Thank you in advance!

I suggest that you figure out reading the sensor first. When that's accomplished, then move on to smoothing.

What do you means exactly?

I've not seen this Steve - usually the response of the analog system is too slow for it to show. Of course if you connect it to a mechanism that responds quickly then it does become a problem; but in my experience with older vehicles ( 3 ford escort rally cars) track wear was the main problem, leading to inaccurate readings.

That's interesting, John. I must admit my experience is from many years ago, and in those systems the fuel gauge itself was heavily damped - I believe some of them used the heating effect of the current, which provided a high thermal inertia and slow response time.

Anyway, it perhaps doesn't matter. The OP needs a sensor in good working order, and may or may not need to smooth out the reading from it. I'll post a smoothing algorithm separately.

It means wire up your components first, and write some simple code which will read the value from the fuel level sensor and Serial.print() it to the PC. Use that to fine tune the resistor values and work out if you need a non-linear relationship between the sensor reading and the actual volume of fuel in the tank.

Once you are happy with it, then you can worry about smoothing the gauge reading so it doesn't waver when the vehicle is moving.

Smoothing can be done quite simply when you are ready.

https://www.arduino.cc/reference/en/libraries/moving-average-library/

Also, this low-pass filter works great and is very simple:

  #define SMOOTHING_FACTOR 0.8  //between 0 (no smoothing) and 0.99 (maximum smoothing)
  
  static float smoothedValue = 0;
  float unsmoothedValue = 0;

  unsmoothedValue = GetTheCurrentDataValue();

  smoothedValue = (SMOOTHING_FACTOR * smoothedValue) + ((1 - SMOOTHING_FACTOR) * unsmoothedValue);  //low pass filter

Thanks for your reply, i noticed ARduino doesnt has any resistance input, just voltage, right? as you can notice, im very noob lol, it only has voltage input so first time i have to make a voltage divider for convert resistance to voltage, does this correct?

Right, There is no such thing as a resistance input. The original gauges also used a voltage divider. The fuel sending unit is one side of the voltage divider. The other half is part of the original gauge.

Thank you for your reply. The stock fuel level gauge is wired up direct to fuel sending unit, fuel level gauge in cluster read resistance. Appreciate it a lot guys are trying to help me out a bit, appreciate it a lot! so i should have to make voltage divider first, then input to arduino board, is there any smallest arduino board avalable? then i dont know how to convert again to resistance for get reading correctly to gauge cluster. Thank you!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.