# Fuel gauge measuring

The fuel gauge on my car has died recently, so in stead of buying a new unit I decided to make one in stead.

I have done a lot of reading on the web regarding similar projects, and tried writing several sketches, but get dissapointed with every step.

The problem I am running in to is that I don't understand how to 'tell' the Arduino to read between 10 and 350 ohm and map this value to 1-100% so I can display this on a 7-segment display.

The fuel sender in the car has a value 350ohms when empty and 10 ohms when full. I've tried adding a 10K resisotor as voltage divider and reading out the value of the fuel sender.

Who can give me some advice on how to approach this project, and what I am doing wrong at this moment?

This is how far I have gotten so far...

``````int senderPin = A0;

void setup() {
pinMode(senderPin, INPUT);
Serial.begin(9600);
}

void loop() {
val = map(val, 0, 1023, 0, 100);
Serial.println(val);

delay(100);
}
``````

The fuel sender in the car has a value 350ohms when empty and 10 ohms when full. I've tried adding a 10K resisotor as voltage divider and reading out the value of the fuel sender.

...and what was the result?

I should think that 10,000 ohms makes a poor divider with 10 ohms. Maybe pick something closer?

MorganS:
…and what was the result?

I should think that 10,000 ohms makes a poor divider with 10 ohms. Maybe pick something closer?

I think that the main problem is that I don’t know where to start with choosing a divider.
Could you perhaps elaborate a bit on what’s wrong with this value?

Go back to the basic equations for a voltage divider. Work out what value will give you the greatest 'useful range' which means the voltage varies as widely as possible across the 0-5V analog input limits.

Then work out what the current through the fuel gauge is - I suspect it should be kept down in the milliamp range because you really don't want a 5-watt heater inside your fuel tank. Do the calculations again with this new information.

While you're at it, consider what will happen if plus or minus 24V is applied to the input pin on your Arduino. Some idiot is going to plug this in backwards one day and you don't want to burn the Arduino. Put in some resistance after the divider to limit the fault current to 2mA, which will be safe for the Arduino. Check the current through your divider resistance is within that resistor's limits for both fault conditions.

Klavkjir:
I think that the main problem is that I don't know where to start with choosing a divider.
Could you perhaps elaborate a bit on what's wrong with this value?

I suggest that you look at the page here:
https://learn.sparkfun.com/tutorials/voltage-dividers
It looks like it contains some useful material for you.
In the section headed "Simplifications", there is something relevant to the problem you are having. Read what it says about what happens when one resistor is much larger than the other. (I am assuming that your fuel sensor functions as a resistor whose value varies depending on the amount of fuel.)

You should use a voltage divider with two resistors of each 2 k ohms. Now enter the source voltage (input). Use this Voltage divider calculator. In the load change the value of resistance from 10 to 350 ohms and check the output voltage it produces. Using these voltages you can set the conditions and then can do it. I am attaching a screenshot for 10 ohms.

Your values of resistors can vary but I hope it will work for you.

Here's the circuit diagram for that calculator. I think the calculation is incorrect for this application. R2 should be the 10-ohm sensor in the tank. The load resistance is extremely high (hundreds of meg ohms) because the Arduino analog input takes almost nothing from the circuit it is measuring.