I did Arduino sketches before.. also with help from here but this project is something else, for many here an easy task, for me quite the challenge
Try a 200 ohm resistor if you have one, or two 390 in parallel (195ohm).
That could push it up to 900+
A 180 ohm resistor will probably clip (1023). You should avoid that.
Get those raw readings right first with the Arduino and resistor you're going to use,
before thinking of calibrating the tank.
You need those A/D values, as PaulRB explained.
That will give you a list of litres vs. A/D values.
Then you need a list of fuel gauge vs. A/D values (the pot).
The Arduino can then, with multiMap(), convert between them smoothly.
Leo..
My goal for tomorrow is to get some numbers and make some charts.
I have all types of resistors but no pots on hand.
Which do recommend to use?
10k linear.
Post your proposed circuit for the gauge.
Leo..
Let's not get confused. It's the PWM values Vs the gauge readings (the pot values are not really important).
After @Wawa 's suggestion to try different resistor values, maybe it would be better to use a multimeter to take resistance readings from the sensor at each fill level, rather than the analogRead() values. Then you can choose a resistor value later and calculate what the analogRead() values would be for that resistor.
Well today i spent most my timegetting the fuel levels mapped with the sensor.
My plan was to also measure resistance from the sensor directly but i get different values when the connected to the breadboard.
I also mapped out the PWM to the gauge scale in 17 increments manually
I wrote down every A/V value per litre to get a more accurate scale and if i follow the 17 gauge increments i can use the A/V value from every 3 litres
In the video i control the gauge with simple sketch with 87 to 255 PWM to test.
DeLorean Fuel Gauge scaling.pdf (206,0 KB)
See pfd for the chart.
Am i on the right track?
Maybe not.
I expected 2 tables. One for sensor reading Vs tank fill. Another for guage reading Vs PWM value.
But you have combined them into a single table. How did you do that exactly?
What I would have done next, using the 2 tables, would be to use Excel or other spreadsheet to plot a chart/graph to visualise the shape of the line. It should be pretty clear from that shape if the relationships are linear or more a complex curve.
Well.. i posted my findings of today in a single table for my own conveniance for now.
The first colomn are the physical gauge readings which i divided in 17 section and manually found the PWM for each 17 of them.. true it is a bit confusing seeing the table.
The first and last belong together and middle two belong together so in fact 2 seperate tables.
I will dive into Excel to graph both.
Is there a decent explanation into multiMaps here or somewhere else?
And to add.. the sender has a range from 1010 to 723. Now it will only go as far as 785 because the float can not go any higher because it will hit the ceiling of the tank.
Is there a code setup where the analog is constantly being monitored and ty all measured numbers from A/V to PWM.. for example when the sender sends out around 883 a PWM of 129 is generated?
I think it will be difficult to come up with an exact formula to calculate the analog to a PWM value due to the very non linear movement of the gauge... so i have been told by someone who makes special electronical upgrades for this particular car
So the tank is full before the sensor/sender/float hits the top of the tank? That's a good thing, isn't it? If it hit top of the tank before the tank was full, that would be a problem!
Thinking more about it, maybe your table is fine. In fact, perhaps exactly what is needed. As long as the readings on a row all belong together.
That's exactly what multiMap() is designed for. It's not a standard Arduino function, you need to install a library for it. You will find some example code appears in the examples menu when you install the library that will illustrate how it is used.
Once you have the gauge reading correctly for all tank fill levels while the track is steady, then it will be time to think about how to smooth out sloshing.
This is just a matter of knowing how to compute it.
LibreOffice has a feature that can calculate a lot of different functions
linear, logarithmic, exponential, power, or polynomical
If you put the values analog vs pwm into a LibreOffice table
and then create a XY-chart from it.
It has an option to insert a trendline and to show the formula of the trendline including
a value that characterises the deviation (The R²-value. The closer to 1,0 the better the approximation.
This is an example where I deviated the x²-values a little bit around the exact value
in the table
The approximation function
![]()
is calculated by libreOffice.
That's what computers can do best. Calculations
That sound similar to the fuel gauge on my first car, a 1950 Mercury. The gauge needle was moved by a bimetal strip. The strip was heated by a coil of wire wound around the strip. The delay time took care of the fuel sloshing around in the tank.
OK this is the graph. Nonlinear descending.
The value-pairs would make it easier
if you have no experience with which trendline-type to choose test them all and look which one has the highest R²-value (= smallest deviation)
by the way is this car this delorean used in back to the future?
Yes, luckily a good thing
Yes, all the numbers belong together in the same row. As seen in the graphs the sender works linear.. the gauge otherwise not so much
Still need to wrap my head around multimaps
Yep, the slosh is the main reason for using arduino, second very useful for tuning the gauge exactly. Original setup is a disaster.
I will get on this, thank you
Luckily winter is coming and have some time for it. Only the sloshing programming/smoothing has to be done on the road to get the best results
Yes, it is ![]()
That doesn't sound very good.
Can't you fix that (mechanically).
Leo..
Unfortunatelly no.. i can bend the rod more downwards but will hit bottom of the tank sooner, so what you gain at one end you loose at the other.
Then again.. this isnt a daily driver but when i drive it i need to rely on the gauge
I would increase fixed resistor value to get A/D results more in the ~500 range.
1010 is too close to 1023.
Leo..



