reading a fuel gauge

hi everyone,
I know almost nothing about electronics, but I'm trying to learn.
I need your guidance on this one, because it's still out of my understanding.
As my very first project, I'm doing a motorcycle dashboard, including the speedometer and the fuel indicator amongst other things.
if i'm not wrong, the fuel gauge, it is a variable resistance, that I should be able to read with analogRead. the problem is that, knowing nothing about electronics, i'm afraid I might blow up my Mega(and here in Argentina it's not easy to replace it).
Trying to read the value of the resistance using a tester(please correct me if it's not the right name) ,it says 9,8 ohms at almost full (again, i might be wrong). So, before plugging the arduino pins to this, I tried plugging 5v at one end, and a voltage tester at the other end, to read how much of the 5v gets trough the variable resistance. Something went wrong, because the power source turned off, like if there is a short circuit (wich is probably what happened) . I'm using a branded cellphone car charger as power, since it seems quite good at converting 12v from the motorcycle battery, to the 5v needed for the usb, and the label reads 800mah.
My question is how could i safely read this, without killing my board? is 10 ohm a very low value for a fuel indicator? Googling other projects, they had higher values, am i reading wrong? my idea is to apply 5v trough this, and read the analog value on the other end, to get an approximate of the remaining fuel.
I can add more detail if something it's not clear, but that's the idea.
Please excuse my poor english, and thanks in advance for reading.
Marcos

The fuel sensor on most motorcycles is a variable resistor as you said. The variable resistor (rheostat) is grounded and a float inside the tank moves the wiper up and down proportionally with the level of fuel. A full tank usually moves the wiper of the rheostat to a low resistance and an empty tank has a high resistance. The high resistance varies among manufacturers: 90, 110, 180, 510 ohms. The gauge unit usually has a fixed resistor that is connected from +5VDC to the wiper of the rheostat, forming a voltage divider. The receiving unit usually incorporates an A2D converter that reads the voltage at the junction. A high voltage = low fuel, and a low voltage = high fuel.

If you applied a voltage to the wiper of the rheostat when the tank was full (~10 ohms) the power supply tried to provide a half ampere.

The size of the fixed resistor would be dependent on the size of the rheostat. Just be aware that, when the tank is full, the majority of the current limiting will be done by fixed resistor. An acquaintance of mine put in a too small a resistor and the current drained the battery. It could have produced pyrotechnics, yes!

I want to suggest something different. Instead of a voltage divider, drive the rheostat with a constant current source, thus the current would never get out of hand and would still produce the same voltage. I use 3.3V to keep the voltage as low as possible.

I am attaching a schematic that would give you ~0.2V with a full tank.

Just a thought...

My last post is just crazy! Why put in five components when one would do? My only excuse is that I have a bad cold and was guzzling Nyquil like Dr. Pepper. Sorry for the techno-dribble.

Here's my thoughts this AM:

Since the rheostat has about 10 ohms when the tank is full, we can figure out the size of the fixed resistor. We don't want the analog voltage to be too low, so let's use the 0.2V as a target. I still like using 3.3VDC as the lower the voltage the safer the circuit.

If we want 0.2V across the sensor @ 10 ohm, we want about 20mA to be flowing. The fixed resistor should be dropping the remaining 3.1V, yes?

So 3.1V / 0.02 = 155 ohms. Common resistor values are 150 or 160 ohms, so I'd use 150 ohms as a starter, although 180 ohms is a popular value for motorcycle gas sensors.

Read in the analog voltage, subtract it from 3.1, and them map() the remainder to 0 to 100. You could then make a bar graph out of LEDs.

sane_gas_sensor_schem.jpg

hi MaJiG!
First of all, thanks for the effort, no matter what, you spent your time helping me, and for free, so thanks.
Just for the record, i did put the 12v through the rheostat, and i could hear the fuel "boiling"(?), that's when i decided to post a question, before i blow myself up.
Well, at first, i was surprised ( i'm still a newb, so everything looks like rocket science to me) of the first post, i had no idea that it could be done that way, i was going to leave it until the weekend, and then use a whole day to build it(maybe more than a day).
Now the other post just makes me want to go outside and test it right now(it's 1am here :slight_smile: )This is something i can do(probably) and if not right now(depends on resistor values at hand), i'll be testing and posting results tomorrow.
To give more context, this i going to be on a 3.2" touch display. I've totally removed the dashboard, and i'm placing gauges and indicators one by one. I'll post a picture or video after adding the fuel gauge.