# Digital fluid level display project help.

Thread Starter

#### zorbzz

Joined Jun 16, 2008
20
Can anyone help with the program that would allow me to use an existing tank sender unit to read the fluid level from a generator fuel tank so I know how much fuel was in the tank.

The tank is from an old car and the gauge sender unit reads 10 ohms empty and 150 ohms full.

The tank has a maximum capacity of 68 litres so it would be ideal if I could either have a 3 digit readout of 0 - 100% or even better 0 to 68 litres with the 3rd digit being in 100 ml incriments like 63.5 etc.
Because we live away from fuel stations this project would be great for us as we would know when to get more fuel.

I dont have a clue about programming pics to this degree but I have all the equipment to do it and can buy whatever pic I need.

Im only new to pics and am trying to learn about multiplexing and adc so I think this would be an excellent project that with guidance I can learn a lot from.

I have pic16f684 pic16f628a pic16f88 and pic16f57 pics to use if that helps.

I can do step by step pictures and post the whole project here if someone can help me complete it.
Thanks alot this is my last resort.

#### johndoe45

Joined Jan 30, 2010
364
this is matlab code

here is what i got
decrease dx for more accuracy.
all do is change meter reading in ohms and it gives you level of tank in liters
however. sometimes the program doesn't have answer. for example 52.3.

dx=0.01;

tank=0:dx*0.485714:68; %liters
gauge=10:dx:150; %ohms

meter_reading=150; %ohms

tank_level=tank(find(gauge==meter_reading)) %liters

Last edited:

#### t06afre

Joined May 11, 2009
5,934
Hi Zorbzz
What kind of program language do you use. I also do not think someone have a project matching your needs 100% But break your task into small sub tasks. We can not do the project for you. But we will be happy to discuss any problem you will meet during your project work

#### rjenkins

Joined Nov 6, 2005
1,013
How about a simple constant current circuit feeding from 5V through the sender, then an off-the-shelf digital panel meter reading the voltage across the sender.

Adjust the current to get 0.68V across the sender when it's full and you will get a display in litres on the meter.

If linearity is not important (and the sender may not be linear anyway), a 470 Ohm fixed resistor plus a 1K preset for calibration may do as the current source.

Example meter (find one useable with 2V scale):
http://www.web-tronics.com/panelmeter.html

#### John P

Joined Oct 14, 2008
2,026
I wonder if an A-D approach is right, given the very low resistance that you have there. Maybe the thing to do is get a capacitor charged up to the power supply voltage (give it a good long time to charge, so it's at a steady state voltage) then have an output from the PIC connect it to ground via the level sensor, and use the PIC to determine how long the voltage takes to drop. I've had very good success doing this to read a manually adjusted potentiometer, and I could imagine it working OK for your tank sensor.

Presumably you don't need this thing to give readings very frequently, so if the charge-discharge time is say, several seconds, it should be OK.

Thread Starter

#### zorbzz

Joined Jun 16, 2008
20
Thanks for the replies so far.
I Only just started reading the picbasic manual. Ive never programed anything before but would like to learn. The picbasic pot command wont read my fuel sender its out of range I think the smallest is 5 k to 50k??
I really need to be steered in the right direction to either a project I can modify or someone that can write me some code to try.

John P I think your idea sounds pretty good but I dont know where to start with it.
I was even thinking about trying a project that is a vlotmeter and trying to modify that somehow but I cant get a pic16f676 where I am.

Would I be able to substitute a pic I have?
I have pic16f684 pic16f628a pic16f88 and pic16f57 would any of them work?

heres the diagram

If I made this how could I make it to read the input from the sender and maybe convert the ohms into milivolts like 0 to 680 mv.
Then half a tank would be 340mv whutch would mean 34 litres of fuel 285 mv would mean 28.5 litres etc. Possible ??

#### t06afre

Joined May 11, 2009
5,934
Do you have some basic electronics skills? Like you have used opamps before?

#### rjenkins

Joined Nov 6, 2005
1,013
I explained above how to get a scaled voltage from the sender.

I was thinking of displaying it with a simple digital voltmeter, but you could equally well measure it with a PIC ADC and do what you like with the measurement from there.

Thread Starter

#### zorbzz

Joined Jun 16, 2008
20
I explained above how to get a scaled voltage from the sender.

I was thinking of displaying it with a simple digital voltmeter, but you could equally well measure it with a PIC ADC and do what you like with the measurement from there.
Yeh but will that give me a 3 digit reading if I used a panel meter or just the voltage like 068 etc ?
Maybe a millivolt panel meter then reduce the voltage to suit?

t06afre yes I have built many projects before just never designed a pic one yet.

#### rjenkins

Joined Nov 6, 2005
1,013
If you adjust the current source (or resistor + preset pot) so you get 0.68V across the 150 Ohms of the sender, it should display as 680 on a 2V digital panel meter.

Add the appropriate decimal point link and you get 68.0

#### t06afre

Joined May 11, 2009
5,934
This is the car basic fuel gauge. You will burn the resistor inside the "sender" if you do not have some serial resistor. I also think you can do something with your panel meter. But check if it need a battery in order to work. Some measurement modules must have a separate power supply in order to work. They do not work if they use the same power source as the measurement target

Thread Starter

#### zorbzz

Joined Jun 16, 2008
20
Yep this meter uses either.
GO CHINA!!

Similar threads