Model Engine Maker

General Category => Oddball => Topic started by: AlexS on October 23, 2018, 10:14:40 PM

Title: DIY Measurement fuel quantity and EGT
Post by: AlexS on October 23, 2018, 10:14:40 PM
My car can drive both on petrol and on LPG. Currently I could not measure the amount of LPG. I tank after a fixed number of kilometers. :thinking:

It seemed like a fun and useful project to make this measurable. There are various measurement systems for sale. But after my knowledge these are not as accurate and quite pricey.

Given this reason, I have been busy with a measurement system on an arduino board with LCD display.

The LPG tank is mounted on a matching frame in the trunk of the car. The idea is that the weight of the tank and frame is measured. This is realized by two load cells.
These load cells are mounted on the frame of the LPG tank.
The total weight of the tank is not fully absorbed by the load cells.
It is important to calibrate the whole.

When the tank is empty, the whole can be calibrated as a 'start value' to show 0 liters of liquid. This is also called the offset value. The second is calibrating with a quantity of fuel, as being 'scale value'.

As shown in the images, the amount is still displayed in kilograms on the LCD screen. This needs to be adjusted with the accompanying density of the liquid.

Given that there are still entries of the arduino available, I also added a thermocouple to read the exhaust gas temperature of the engine. This seemed nice to me to read.

The script and system are running. Now install it in the car.

If someone is interested in the script and wiring, you are free to ask!
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on October 24, 2018, 09:50:55 PM
Interesting project .... BUT - I really hope that you made very sure that the LPG tank can't move or being converted into at projectile in case of an accident ....

I'm pretty sure you would get into a lot of trouble here in Denmark if you use the vehicle on public roads with your modifications ...!

Best wishes

Title: Re: DIY Measurement fuel quantity and EGT
Post by: crueby on October 24, 2018, 10:19:19 PM
There are more and more vehicles (mostly commercial ones and cityy busses) here in the US that run on LPG (and natural gas I think). Do you know how they measure the fuel left in those? Also by weight, or is there a way to do it with pressure?
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on October 25, 2018, 11:15:18 AM
Our man in Thermo Dynamics might know about this subject.

I do know that you can get very accurate flow sensors for this purpose - but they cost a minor fortune ….
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on October 25, 2018, 12:39:39 PM
OK, that looks like my cue!

LPG is Liquified Petroleum Gas is essentially propane (with minor amounts of butane and ethane) which gives the fuel enough density to allow carrying sufficient for a reasonable range, while still at moderate pressure.  The liquid boils to vapour as it is drawn off to fuel the engine.  The term LPG actually applies to mixtures of propane and butane in any proportion, but most automotive fuel is mostly propane.

As a boiling liquid, the pressure is determined only by the temperature, and essentially, while any liquid remains in the tank, the pressure remains nearly constant.

I say nearly, because it takes energy to evaporate the fuel drawn off, and in the absence of any heat source, the remaining liquid has to supply the heat, which makes it cooler.  This lowering of temperature lowers the pressure, but the pressure change is a measure of the rate fuel is being drawn off, and of course increases as the quantity of heat is drawn from an ever decreasing mass remaining.  But still not a measure of the remaining mass.

The busses that run on natural gas (essentially methane) are different, in that I don't believe you can liquefy methane unless the temperature is below about -80 C, and then the pressure would be quite high.  Conventional LNG plants which keep LNG in large tanks operate at atmospheric pressure and a temperature around - 160 C, not very practical in a car.  I believe the refuelling stations have very high pressure compressors, so I think it is just stored in a bank of very high pressure cylinders.  Similarly for hydrogen powered vehicles.

However there are technologies involving absorption of the fuel in some sort of sponge like material where there is some sort of physical bonding which allows storage at more moderate pressures, similar to acetylene cylinders.  This involves different physics from simple boiling of a liquid, or gas laws for an ideal gas under pressure, and I don't know any more about those systems.

The fancy gadgets that you can buy to measure the liquid remaining in your bar-b-que gas bottle mostly rely on detecting the temperature change between liquid and vapour so only work when the fire is burning.  Some look like pressure gauges, and I don't know how, or even if they work over the full range of the bottle, or perhaps they just show the fall in pressure when the liquid runs out.  Not much use, as the bottle is then essentially empty.

So I believe the solutions lie in either weighing systems, with the attendant problems of allowing for vehicle motion and retention of the bottle in an accident as already mentioned, or a volume meter.  Turbine meters are used for larger quantities, and I assume some sort of positive displacement meter for typical automotive fuel consumption.  I can believe these would both be quite expensive unless they were really mass produced for the auto industry.  And I assume if you want to buy even a liquid fuel meter for your car as behind the typical fuel computer in modern cars, it would be a quite expensive meter, but still not suitable for LPG vapour and pressure.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on October 25, 2018, 10:52:41 PM
Thank you guys. You have pointed out an important point! This is also the most difficult issue to properly fix the tank. And it can indeed cause problems during an accident. The tank is mounted an older car in the trunk.

The idea is to mount the frame and tank straps on the original frame. Bolted on the flour of the trunk, but while maintaining some up and down movement for measurement. So technical, the tank can't move any way. Only a bit up and down (also not much space between tank an topside trunk). The setup shown in the first picture. Could place the sensor on two places , 1 and two shown in the pic.
But at the end, it is a own modification and not legal. Have to check this.

MJM460, thanks for your extensive explanation. I have heard that LPG typically contains 60% propane and 40% methane and filled with 8 bar pressure? After the temperature decreases, more propane is mixed. Kind of mass flow sensors are for this typical rate of gases way to expensive and complicated to use. The ones I know are for industrial and scientific purposes.
The LPG in my car is sucked in as gaseous with the help of evaporation.In modern cars LPG is mainly injected as liquid. The consumption of the fuel can thus be better determined on the basis of injection pressure, opening and injection time. But it would be nice that I can measure the quantity of the fuel, and if possible more accurate.

The measurement systems I know are kind of the type shown in the last two pictures. If I am right (someone told me), it seems like that the the magnet in the tank act like a 'float'. And a sensor measures the strength of the magnetic field. These senors are likely to fail and not linear and fluctuating values seen rocking the tank.
I could fix this sensor, but I am open for maybe other idea ;)
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on October 26, 2018, 12:30:27 PM
Texas Instruments (TI) makes an interesting line of IC's DRV4xx that can measure magnetic flux very accurate - but I will admit that I haven't got a clue if any of them are what you could be looking for, as distance measurement to float ….
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on October 26, 2018, 12:36:49 PM
Hi Alex, I would suspect that that fuel mixture might be propane - butane with only trace quantities of methane and slight larger trace quantities of ethane based on the vapour pressures. 

Eight bar (gauge or absolute?) corresponds to the vapour pressure of pure propane at about 20 to 25 deg C, so would not be sufficient to fill a fuel tank on a warm day.  However, the addition of 40% butane would lower the vapour pressure of the mixture.  In winter, I assume you have snow, and the temperature would not be sufficient to evaporate the fuel in the tank, though direct injection of liquid would overcome that issue.  But they might also use more propane and less butane in winter. Liquid injection would also overcome the issue of condensation on the outside of the tank due to the cooling which occurs to evaporate the fuel as it is being used, though I believe the normal scheme is to draw liquid from the tank, then evaporate it closer to the engine where there is more heat available.  Also overcomes the condensation issue.

I am unable to tell you the exact properties of a propane - methane mix, though it is easy enough for a chemical engineer, but pure methane vapour pressure is so high that it is not possible to get liquid above about -80 C.  While mixing with propane would raise that temperature a little, I really can't see getting 40% methane in a propane mix at any reasonable pressure at normal ambient temperature.

For comparison, our LPG gas bottles are pressure tested to 3300 kPa.  Based on 1.5 times operating pressure, this corresponds to about 2200 kPa maximum operating pressure, or 22 bar, which is the vapour pressure of pure propane at about 60 degrees C.  In this climate, that can relatively easily be reached inside a car.  I hope the boot (trunk?) is a little cooler without the glass effect in the passenger compartment.

Very little methane would release the blow off plug on a warm day.  Instead of guessing, I suspect your favoured search engine will allow you to check the typical composition fairly quickly, and possibly even the fill pump pressure for interest.

Those last two pictures are interesting.  I am not familiar with the particular instruments, but putting a magnet on a float inside the vessel would be difficult to connect to like your diagram through the pressure containment wall.  If it has no external connection, it could be placed inside the tank by the manufacturer, but I don't know if this is actually done.  It looks to me like possibly an ultrasonic transducer at the bottom, measuring the depth of liquid in the tank.  I wonder if the second device (labelled calibration) is a similar transducer, placed on the centre line to  indicate when the tank is half full from which point all other volumes can be easily calculated by a little calculus, even allowing for the shape of the ends.

In my work experience I am familiar with ultrasonic probes being used, though usually placed at the top of the tank.  I don't see why they could not be mounted top or bottom, which ever is most convenient, with the appropriate calibration.  Also commonly used are devices utilising a magnet in a float in a stainless steel tube which is detected by a follower on the outside.  This enables measuring levels without jeopardising the pressure containment and causing a leakage source. 

Either way, a microprocessor, such as your Arduino can easily measure the depth quickly enough to allow calculation of an average depth over several measurements to allow for surface sloshing due to the vehicle motion.  This method would give you the most accurate measure with the vehicle stationary, and would not require modifying the tank mounting system.  But of course the ultrasonic device can be expensive.

It would be worth getting more information on this sensor to see whether it is magnetic or ultrasonic, and whether it would give you a proportional output over the depth range.  And also what it would really cost.

I see that Admiral DK has discovered some IC chips that measure magnetic fields.  Definitely worth following up.  You can always get real data sheets from TI which will tell you all you need to know.  Perhaps those instruments are magnetic after all.

It is an interesting problem that needs a solution, you don't want to run out of gas at speed on the freeway.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: Pete49 on October 27, 2018, 04:20:32 AM
I have the duel fuel system in my Nissan Patrol (Fuel injected 4.2l) and it has the system in the last picture and is pretty accurate. I always have a full tank of petrol so I can change over when I run out of gas.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on October 27, 2018, 06:38:40 AM
Hi Pete, do you know how that one works?

Is the sender on the outside of the bottle, or installed through the wall? 

Good to know an accurate system is available.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on October 27, 2018, 11:39:35 AM
Did some test yesterday. It seems that there is a tank gauge with a gear transmission (shown in the image below). It appears that the gears can break if there is an empty tank or something else.
The meter, shown earlier, still appears to work. This meter is a analog sensor and that has a resistance between between 0-95 ohm. The hands and thus the resistance is determined on the basis of the tank gauge. The hands move on the basis of a magnetic connection with the tank gauge.

I let the weight measure as it is, I can use this nicely for my own engine project. Now I see if I can get another tank meter from a specialist. Maybe it is repairable by my self. But first properly degassing the tank and remove the sensor.

But guys thanks for your input!
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on October 28, 2018, 06:32:26 AM
Hi Alex, I am glad you solved the problem.  A pity the mechanism broke.  As you say, rattling in an empty tank or inevitable sloshing of the liquid?  Hard to tell.  Perhaps both and just a limited life wearing/tearing component, though not totally easy to replace.

Be careful when degassing.  One thing that may be helpful is that now they use nitrogen in many car tyres, you can probably get nitrogen to pressurise and vent it down a few times.  Much safer than using air, but only outdoors or in a well ventilated space.

I hope the project continues to proceed well.  Did you find out anything more about the gas composition?

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 06, 2018, 07:31:31 PM
Hey MJM460,

The mechanism seems not broken. Someone has inserted a screw for preventing the float from blocking, but that seems fine. While putting the gauge in the mechanism, the gauge seems follows correct the mechanism by operating the float. And the resistant of the gauge increased by operating the float.

So it looks like it would work. But. Only thing I noticed was that the float might reach the 80% filler limiter (also a kind of float system). Those kind of crosses in the middle of the tank. Maybe someone has changed the filler limiter when turning or bending the float. But my car is equipped with a 60 L tank, and the maximum volume that I have tanked was around 46 liters. So that seems also working correctly. Added a picture with the overview of the fittings and piping of the tank and one of internet source.

So I now did place it back, hoping that maybe the refitting solve the problem. But this does not help, while put some gas in the tank the sensor shows no change. It is very change.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 06, 2018, 07:52:04 PM
The second is that the tank should be mounted at an angle of around 52 and 60 degrees.

I went to an LPG specialist later. And he indicated that the angle under which the tank is currently mounted is actually not sufficient. He indicated that you could not fill the tank completely and that maybe the chance that some liquefied gas could be sucked in.
However, it is not possible to mount the tank at a larger angle. You will soon encounter the torsion bars of the trunk.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on November 06, 2018, 09:54:00 PM
I see bad potentiometers almost every day - mind you, they are consumer grade ... but I wouldn't be surprised if it is the culprit here too - even if better quality. Can you change it without disassembling the tank again ?

Best wishes

Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 07, 2018, 10:30:34 AM
Hi Alex, good news that nothing has broken.  It should be more satisfactory to reinstate what was originally installed, but very confusing that it does not work when reinstalled in the tank.  You probably said "Dang and blast", or perhaps something stronger!

Not an item that I am familiar with, I am used to climbing into the gas tank through a 20 inch diameter flanged man way, and having stair rungs welded on the inside to get me safely to the bottom to have a look.

The Admiral has mentioned the possibility of a faulty potentiometer, so I assume you are checking that, though I think that you said the resistance changes when you move the float.

It is surprisingly hard to convey in a drawing how the floats for level and overfill interact as they move, but presumably any interference there would allow some movement to be visible on the gauge, before it was blocked from further movement.  Certainly important to be sure they clear each other and work correctly.

A couple of thoughts.  It's hard to judge the angles when the unit is inserted in the tank, but is that blocking screw the correct side of the post holding the swinging arm?  When I rotate the picture so the fixed part is about 60 degrees, it looks like you are holding the float in the full position - it should go down with fuel consumption from there towards empty, or is it at the bottom by gravity in your picture?  And the gauge temporarily connected should indicate over the range.

Also, is the unit installed in the tank in the correct orientation at the mounting flange.  I don't know if the mounting flange is a standard five bolt SAE type with only one possible orientation.  Is there any possibility that it is inserted 180 degrees out (or some other angle) when installed in the car?

Thirdly, is there any possibility that someone previously has replaced a damaged float?  The specific gravity of LPG is only about 0.51.  I would expect the float to be solid due to the pressure, but a float made for water (SG of 1.0) can be too heavy to float in LPG, hence not rise when you fill the tank.  I have seen the wrong float fitted in industry, and they don't float in LPG.  You can weigh it and measure it to see if it has a reasonable displacement when the liquid is only 0.5, but unfortunately, only by removing it from the tank again.

I am also wondering if the wiring could be crossed so that it shows empty when it should be full, and the potentiometer orientated incorrectly some how.  Have the gears been separated and reassembled wrongly meshed?  But this seems least likely.

I am grasping at straws really, I am sure you will have thought of all those things.  I am really interested to see what you find. 

Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on November 07, 2018, 11:33:23 AM
OK - I should have mentioned that many of the pots I come across actually measures correctly with a VOM, but are still more or less useless in the circuit.

Can you remove the pot without doing anything else to the tank ?
I ask because I would suggest that you turn the pot while it is connected to the rest of the car, in order to see the meter on the dashboard respond as it should.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 07, 2018, 12:47:19 PM
Hey guys, thanks for responding and thinking along.

It is possible to remove the pot/gauge without doing anything else to the tank. There is only one way to install this pot in the float mechanism, this is shown in the image below as an example. Also when i remove the pot you can twist it, while float installed in the tank, you can see that the needle of the gauge changes. It changed for example from 10% to 90%. I have measured also the resistant, it also changed from let say 8 ohm to 90 ohm.
This gives the same results when I did earlier remove the float mechanism out of the tank, and I latterly move the float.

So yes, if I turn the pot I can see a increase on the gauge value and resistant of the pot.
Besides this, the dashboard is currently in my car not working. A previous owner has installed a second electrical system for the LPG system. No idea why. But beyond this, it does not affect the working of the pot and float system. It only indicates the LPG level and switching to petrol.

The float mechanism is mounted on the basis of four bolts. And can also be mounted in four different ways. However, I have already taken this into account for the assembly. And the gauge shows a value of 10% content instead of 90%.

When I removed the float from the tank, I put it in a container with water. After my knowledge floated sufficiently. And I saw no cracks or he felt heavy. Would the specific gravity of LPG make the difference?
Other while I would almost think that the 80% filling safety float is in the way the level float mechanism?

I try to explain the 80% safety system operation and the placement in the tank.
This safety also includes a kind of float. With a certain amount of volume in the tank, it cut off the supply. The rod of this 80% filling crosses the level float mechanism as if it were true. If the tank is empty in this case, the rod of this safety system rests on the position of the gear mechanism of the level float. If the tank is going to 80% fill, it would be lifted and thus float on the LPG liquid. However, if I look at this, the level float itself has enough space to move up and down. The float does not run into anything.
However, I can imagine that the rotation of the gears can be somewhat limited by the fact that the 80% filling system rests on these gears. But the question is how much and whether it has an influence.

I could remove the float mechanism. That is not a big deal. Maybe I should get some more information about the location of the components in the tank. Whether the rod of the 80% filling is mounted correctly. Or get the float out and compare with a new one with an LPG specialist.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 08, 2018, 10:21:24 PM
Hi Alex, sorry I missed answering this one yesterday, I was somewhat distracted.

I see you tested the float on water.  You did not say if it floated high or low relative to the surface.

Water has a density of 1000 g/litre, and a specific gravity of 1.0

LPG has a specific gravity of 0.5, so a density of 500 g/litre.  If you float has a density of even 550 g/litre, it will easily float on water but will not float in LPG.  Unfortunately I don't have much information about the SG of plastics, but the measurements are reasonably simple if you have a digital kitchen scale.

I would suspect that if the overfill protection float is resting on the gear, the friction would also prevent the float from responding, particularly if the bouyancy is a bit borderline.

The over fill protection is to prevent you filling to near 100 % which produces very high pressure in the tank due to thermal expansion of the liquid and too small a vapour space I f there is any temperature rise after you have filled up, so you want that working.  A bit low is better than too high.


Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 09, 2018, 12:53:37 PM
Thanks MJM460. I would check the system!
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 09, 2018, 09:02:09 PM
The float system is currently working again!

I had removed the level float and weighed it again. The float, however, was 16 grams and an order size of around 30 by 60 mm. That seems light enough. Also placed the float in a container with petrol. He kept on driving neatly.

Next thing I have spoken to an LPG specialist. And he indicated that the overfill protection with accompanying float should always be straight. And that this was possible that the one in my tank was bent.
So I removed the total overfill protection from the tank and bent it straight. This was firmly in the tank. The bending was easy given that it was (probably) made out of brass.
When I assembled, I noticed that the protection was stuck against the internal supply pipe when the connection was tightened. This was easily remedied by lifting the associated float in the tank so that it did not touch the gas supply pipe. This could possibly have been the cause that the overfill protection was bent before.

So install the other components and piping and go for a refueling.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 09, 2018, 09:11:54 PM
Great to have it working again.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 09, 2018, 09:19:40 PM

Did a quick test at a local gas station. Later on I will tank several times to get some data for a calibration of the senor.

I want to read the sensor analogue. Resistance has some changed. But they are higher and that would be better for the arduino, lower amperage.

Empty tank 3930 ohm.
9.1 L 4080 ohm.
24.8 L 4170 ohm.

A quick look, as expected, the resistance does not run linearly on the basis of the quantity of liters.
The next time I refuel several times until the tank is full. So that have a number of measuring points. This should give a picture of how resistance to volume is.

I am thinking of taking an average resistance per volume of gas for the total tank volume. This average resistance as value 'a' and an offset, being start value as 'b' given formula y = a.x + b.
Or I was thinking of taking this average resistance per two known calibration measuring points. As being between 0 and 9 liters, 9 and 24.8 liters, etc. But first, you need more measuring points and a reading in arduino.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 09, 2018, 11:17:21 PM
Hi Alex, calculating the volume in a horizontal cylindrical tank as the level increases is a nice exercise for a calculus student, it is even possible to allow for the shape of the ends.  I had to do it for a large LPG tank as a young graduate engineer.  Then the circular movement of the float adds a further complexity, then the potentiometer characteristic.  Incremental filling seems the most practical procedure.

It will be interesting to see if it is close enough to linear, or if you need to use a more complex equation.  The great thing about excel is that you can get the computer to insert a trend line of almost any form once you have a number of points.  Then let the Arduino do the maths.

How are you getting a suitable input to the Arduino from the potentiometer resistance?  A reference voltage and a resistor divider perhaps?

With the float 3 cm by 6 cm, a rectangular float more than 2 cm thick will displace 18 Gm of LPG so should float if the arm is not too heavy.  If cylindrical, well you can see the maths is not too hard.  You need a float at least 32 cc, plus allowance for the arm weight.

Looks like you are making good progress.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on November 11, 2018, 08:30:10 PM
Great that you have solved the float issue and that the gauge is (kind of) working again.

The fuel meter on my bike isn't linear - but this suits me fine as most of the "movement" (LCD) is on the last quarter of the tank, where I need the resolution the most.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 13, 2018, 09:18:01 PM
It is nice that I can now read the tank contents on the gauge at the tank. Now let's see how I can get a correct readout via arduino. I have been busy with this for the weekend.

The idea of ​​using a trent line by means of Excel is a good idea!

But I'm still playing around the potentiometer anologe readout via the arduino. In principle you read the voltage from what is on the corresponding input (Convert the analog reading to a voltage). In this case you measure the remaining voltage which is not over the sensor.

In terms of programming it is a fairly simple script. And testing through the use of a potentiometer works fine.
Only the strange thing is that this does not work if I connect an ordinary resistor or the sensor of the tank. The 5 volts are connected to one side of the resistor and the other to the analog input.
I have tried different resistances. But I get a reading of 0 volts. While a potentiometer can regulate the voltage between 0-5 volts (15kohm-0ohm).

The strange thing is that when you connect both the resistor or the senor, you can measure different voltages with a multimeter.

Maybe I'll miss something! However, I am still learning with electronics.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 14, 2018, 09:51:54 AM
Hi Alex,

My knowledge of the Arduino system is pretty basic, but I am more familiar with Picaxe.  A different chip manufacturer, but might be similar enough in principal to help you find the right path.

The analogue to digital conversion on Picaxe needs a voltage input, maximum less that the actual chip supply voltage.  This may be less than the voltage to your board, as I think the Arduino boards include a voltage regulator.  On Picaxe it is 5 V Max.

To read your potentiometer you probably connected the ends of the pot to zero and five volts and the slider to the ADC input.

For your fuel gauge, I initially assumed you would use a 12V supply.  But on further thought, it would be better to use a 5 V supply so the slide always sees something between 0 and 5V.  Then connect one end of the transmitter potentiometer to the 5v, the other end to 0V, and the slider to the ADC input

I hope the similarities of the working principals of the different chip makers are enough for that to help. 

Title: Re: DIY Measurement fuel quantity and EGT
Post by: Stuart on November 14, 2018, 10:00:57 AM
Most older car fuel gauge systems used a 10vdc regulated supply , a very crude one to boot

Reason the fuel level would vary with the state of charge / alternator output

Between nominal 12.5 vdc to 14.6 vdc

Just a 2 pence worth

Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 15, 2018, 10:04:54 AM
Exactly, Stuart.  Hence my feeling that it is better to use a 5 volt regulated supply.  Easily made with a three pin chip and some condensers, then it is independent of the car operating voltage.  It can operate on any voltage above about 7 V.

Alex, I assume you know how to do this, but I can send you a circuit if you need it.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 15, 2018, 01:46:16 PM
Indeed stuart. Thanks for your comment.

I'm curious about your circuit MJM460, any help is welcome ;)

Only thing is that a potentiometer has three connections.And the sensor in the tank contains two. Like as a normal resistance.

I have also seen another arduino script that works with the hx711 chip to read resistance. I used this chip before to read the load cells. The operation is in principle the same as what I have done here (5 volts through the sensor). Only now a much smaller voltage is sent and transformed into a digital signal.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Stuart on November 15, 2018, 02:22:38 PM
Bet that that pot on the sensor has 1 leg internally grounded

So ground leg  centre let’s call it sensor and the other is the voltage ref

Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 16, 2018, 11:05:40 AM
Hi Alex, if you have an Arduino script to read current as opposed to voltage, that sounds like a reasonable approach.  The picaxe system I am more familiar with actually requires a voltage input and requires a slightly different but very different circuit.  So long as the Arduino has an ADC input function that reads voltage and converts it to digital either will work.  I assume you have the circuit that you will need to use if you go with current measurement method.

I will give you some circuits and a bit more information about those three terminal voltage regulators tomorrow or the next few days, (this has been a rough week for me so no opportunity today). I suspect you will need one to run your Arduino from the car electricals anyway.  I think you may need a 9 V supply to the board, but perhaps you can confirm that.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 17, 2018, 10:03:38 AM
Hi Alex,I will try and give you the quick rundown on the ADC input to microprocessors like the Arduino and those voltage regulators.

You will need some sort of circuit to supply your Arduino board from your car electrical supply.  There is a series of low cost three pin devices in a case like a transistor, which give an accurate regulated voltage suitable for this.  They have numbers like 78xx, where xx is the output voltage.  They include 7805 which gives 5 volts, 7809 which gives 9 V and 7812 which gives 12 V but would need over 14 V supply to be reliable, so probably not useful.  I believe Arduino boards are normally powered by a 9 V supply so the 7809 would be the one to choose.  The circuit in the attachment is what the Picaxe system recommends, and would probably be ok for Arduino with the appropriate regulator for 9 V.  The capacitors are not always necessary but are probably good for reliability to avoid problems from other systems on the car.  Look to see if your Arduino system advises something similar.

The Analogue to Digital Converter or ADC requires a voltage input, and draws practically zero current but requires a reference voltage.  Sometimes the chip supply voltage is suitable (which is not necessarily the board supply voltage), and sometimes the microprocessor provides alternatives such as 2.046 which can give you better resolution is a particular application, and might be better for you if it is available.  With a three pin potentiometer you probably connected it like the second circuit I have drawn.  The total resistance determines the current through the total resistance, and the position of the slider picks up intermediate voltages as the input to the ADC function.  It is often recommended that you include a resistor, something in the range of 330 to 1000 ohms in the path to the input pin.  It helps in some fault conditions, and as the current input to the ADC is near enough to zero, it does not affect the values you read.

I am a bit confused about the range of resistance your tank potentiometer provides.  Ideally it would be enough to reduce the current to a few milliamperes with say a 9V supply at V+, but you have to work out the values for your system using ohms law.  The second diagram is a suggestion if the potentiometer has only two connections.  The extra resistor which I have labelled R1 is calculated to provide the maximum input value to the ADC with the the potentiometer slider at that end, and it will be close enough to zero at the other end.  If your potentiometer has only two connections, R1 will have to be connected to the slider.

I know this is all a bit general, but the principals are the similar for all the microprocessors, so this should give you some clues as to what to look for.  The circuits are very simple with few components.  I find it useful to download the manufacturers data sheet for each of the chips.  Amongst all the technical details, there is often a few clues to using them that are helpful even in hobby applications.

I hope this helps.

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 18, 2018, 12:38:05 AM
Thanks guys!

Like the idea. The potentiometer, like you suggest as second option, has two connections. But maybe I am confused, money R1 as the potentiometer with two connections (the tank sensor)?

Normally the arduino can be feed both with 5V or 12 volt. So far I know, digital and analog signals can be only read between 0-5 volt.

And I understand that you were confused with the different resistances of the tank sensor. I also did not understand why this was increased. But now it gives a more real value of between 0-95 ohm. approximately 65 ohms at 25 liters and 77 ohms at full tank (46 liters).

Thanks again for the input. I am looking forward to it tomorrow!
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 18, 2018, 01:07:46 AM
I think you push me in the right direction to get a ohm measurement script for arduino.
I have found a script that can measure the resistance on the basis of a known resistance. Basically this looks like the schedule that you have shared. However, I am planning to adjust the script anyway by entering averages, measuring points and conversion to liters. Sometimes it seems more complicated than it actually is.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: MJM460 on November 18, 2018, 09:17:47 AM
Hi Alex, I hope I am not pushing too hard, the intent is just to contribute to the thought process.  I always feel the key is to understand what is going on.  Then you can easily design a suitable reliable arrangement for what you want to do. 

The key to that Arduino script is the circuit that produces the measured value.  I am not very familiar with Arduino, but it looks like it is actually measuring a voltage at an ADC input and using ohms law and the value of the fixed resistor and measured input voltage to calculate the unknown resistance.  Is this your understanding?

I was clearly a bit tired last night, and left out the circuit arrangement with your tank sender unit which gives you only two terminals.  I have attached that one this time.  The fixed resistor labelled R1 is necessary to limit the current drawn when the sender unit is at the zero ohm end.  Then the total of R1 plus 100 determines the current at the 100 ohm end.  In addition this current at the 100 ohm end of the sender times 100 ohms determines the voltage the Arduino sees when the tank is full.   The more of the 5 V input range you can use, the better your resolution will be.  But if you are happy with the resolution with say 2 volt maximum, you can use larger resistors, so less current.  And make sure you use an adequately rated resistor for the current so it can dissipate the power and not get hot in continuous operation in the car.

The remaining bit of the puzzle is how to provide suitable input voltages to the Arduino board and the resistor/ sender circuit.  That is where the voltage regulators come in.  Also, I would suggest a resistor in the line to the ADC input as a protection for some potential fault conditions.  It makes no difference to the measurement as the current to the input terminal is practically zero.

Once you have suitable input voltage to measure, you can add your averaging and filters in the script.

I will be most interested to see what you come up with.


Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 18, 2018, 12:21:07 PM
thanks for your comment! No problem, it is much clearer to me now. Last night I was already pretty tired.

The key to that Arduino script is the circuit that produces the measured value.  I am not very familiar with Arduino, but it looks like it is actually measuring a voltage at an ADC input and using ohms law and the value of the fixed resistor and measured input voltage to calculate the unknown resistance.  Is this your understanding?

Yes it does not work as you describe it. Below I have an overview of what I am going to experiment. Added an extra resistor to lower the current(and so also dissipate the power).

For powering the arduino in the car I will use of a 5v, 2 amp step-down converter. Input voltage: 6-24V DC. However, I will check what the actual voltage across the resistor is in comparison to what the arduino measures at the analogue input.

I'll let you know what's going on at the end of the day!

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 20, 2018, 10:04:37 PM
Hey guys.

I have taken over the scheme and the corresponding script. It tested on a breadboard. It works well. The use of an extra resistance provides more fluctuation of the measurement of the resistance of the test potentiometer. The extra resistance was 1 k ohm, but when reading 220 ohms it caused it to fluctuate between 205 and 235 ohms.

I also measured the amperage of with and without extra resistance. At a set resistance of around 20 ohms (potentiometer) and both the comparison resistance and extra resistance of 1 k ohm, the amperage was halved. However, the amperage was, however, around 5 mA without extra resistance.
Not really exciting to say.

So I decided not to mount extra resistance for the sensor in the LPG tank.

The whole tested in the car. This could quite accurately measure the resistance of the sensor, compared with the measured value of the multimeter (around the 0.5 ohm difference). However, the ohm fluctuates by 1 ohm, but that is fine.
Again, I measured the amperage at a sensor value of around 40 ohms. However, the amperage amounted to an order of 8 mA ampere. In short, this would provide heat for minimal dispensation.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 20, 2018, 10:18:34 PM
Only thing I forgot to mention was that the biggest cause was that the arduino could not measure resistance. And the multimeter was the original wiring from the tank sensor to the original LPG display / buttons unit.
One of the sensors connected through a 1.5 mm2 cable and the second through the ground of the car.
I replaced this with a multi-core cable with a much smaller diameter (direction awg 20).
This connected to the arduino, and immediately fixed the problem.  :DrinkPint: I should have done this immediately!  :hammerbash:
Strange is that the resistance has not changed what I could measure with the multimeter.

So I finally soldered the whole. I did this with pinheader, so you can plug in and out of the arduino.
It was important that the pinhead is sufficiently long after soldering. These have seen the incidence of collapsing that the plastic envelope becomes partly soft during soldering.

Now it is useful to give a bracket for the LCD screen and the arduino a place under the dashboard of the car.

The whole once again tested in the car. It appears to work well. The temperature sensor of the exhaust gases also works well.

I would soon make a picture of the whole.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 20, 2018, 10:34:50 PM
Recently an attempt was made to calibrate the whole.

With every 5 liters I noted the resistance that the arduino displayed on the LCD screen.

The first graph shows all measuring points that have been observed.

The second one is two out of sight given that the same or almost the same value as the previous measuring point.
I also do not expect a linear relationship. But it seems to me that after 5 liters the resistance is the same. Unless the sensor can not go higher or lower (full or empty tank).

The third graph shows the measuring points of graph 2 + measuring points that I measured during a previous tank turn.

May I ask, what do you think of this measured data?
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 20, 2018, 10:47:30 PM
The arduino script for calibrating the tank + EGT.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on November 21, 2018, 12:06:16 PM
I'm only interested in the last graph - but … is this made up of two different times you measured the pot resistance or ?

If the pot is ok, you should measure close to the same resistance every time you have the same angle on the shaft …!

The two very different values for 25L do not look good, and to be honest - I can't tell you if they are a result of bad connections, bad measurement or bad pot  :thinking:

Why are some points missing if you measured for every 5L ?
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Allen Smithee on November 21, 2018, 03:15:51 PM
Sorry for coming late to this thread - I didn't see it.

I used to have a ford focus LPG - one of the ~300 that Ford made in 2003/4 to test the market and then abandoned. The car had the standard petrol tank for petrol, and a flat circular LPG tank installed in the spare-wheel space under the boot floor (the boot floor itself having a ~100mm layer of styrofoam insulation to stop the chilled LPG freezing the contents of the boot. The car had the ability to switch from petrol to LPG and back at any time (static or under way) - it was always started on petrol but if LPG was selected an automatic sequencer would switch it to LPG as soon as the feed heater (the feed pipe inside the LPG tank included a heater/vaporiser unit) had built sufficient gas pressure. In the summer this switch-over was almost instantaneous, but in the winter if the car was cold-soaked overnight it could be 10 minutes of fast driving before the LPG feed was warm enough!

The car had one fuel gauge which would indicate the contents of the currently-selected fuel tank. The petrol tank used a conventional resistive float sender, but as I remember the LPG tank had a capacitative fuel level sensor (as used on aircraft) - no moving parts and no floaty bits! Having said that, it wasn't all that effective. It was accurate from full to about half a tank, but from there on it would read anything from empty to 1/4 tank seemingly at random, so I had to use the trip-meter as a refuelling guide.

Final thought - like most cars the focus had a low-fuel warning light which came on when you had about 25 miles left in the tank. But while the fuel *gauge* switched between petrol and LPG tanks as you selected them the Low Fuel light ALWAYS refered to the petrol tank. This was a safety feature, because if it came on you know you HAD to put some petrol in or run the risk that there was no fuel left for the initial start (it had to use petrol for starting). The petrol station which I passed on my way home every day sold LPG, so I ran on it pretty well all the time, and in the summer it could take me 3 months to burn through a gallon of petrol. So without that warning light I may never be aware that the petrol tank was dry and the car would be unable to start!

€0.00007 supplied,

Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 21, 2018, 04:43:08 PM
Thanks guys for responding. Welcome Allen.


Indeed, the measurement differs at 25 liters.

The first measurement session was after I had mounted the tank sensor.

This was the first test session without arduino and measured over the existing wiring of the sensor (a connection over ground and an over a 1.5mm2 wire).

In a previous post in this topic I had the result shown in a graph.
With hearing values:

Did a quick test at a local gas station. Later on I will tank several times to get some data for a calibration of the senor.

I want to read the sensor analogue. Resistance has some changed. But they are higher and that would be better for the arduino, lower amperage.

Empty tank 3930 ohm.
9.1 L 4080 ohm.
24.8 L 4170 ohm.

The strange thing was that this measured at the dashboard was so much higher than in a previous test (without refueling).
Given this reason no further refuel than 25 liters.
Measured again the next day, the resistance now turned out to include 66 ohms instead of 4170.
Probably bad connection.
Here I have completely refueled the tank and measured 77 ohms over the existing wiring with a multimeter.

Test session 2, the results that I showed yesterday (seven measuring points), were done over a new two core cable.
The resistance values ​​are derived from the reading of the arduino.

Good that you come here. Personally, I think that, partly because of the other cable and measuring method (arduino instead of multimeter), the resistance differs.

I think it is best to perform this test again. Also for more measuring points. I hope I have explained it a bit clearly now.

I deliberately omitted the measuring points in Graph 2. However, the values are displayed in the table. The red bars are values that are considered 'strange' to me.
You would expect resistance to rise per 5 liters. The increase would differ. In the area of a half empty tank (28 liters) there would be a somewhat flatter increase of resistance (tank shape and twist sensor mechanism). And with an empty and full tank, the increase would be more stylish. Until the senor is out of the range of the sensor arm.
It turned out, however, that there was still 10 liters in the tank before measuring. With an empty tank, the sensor gives a resistance of around 10 ohms. Given this reason, I expect to measure an increase in standing position after the second measuring point instead of twice ~17 ohms.

This is a bit I try to explain on the basis of the measured values.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on November 21, 2018, 08:52:20 PM

I assume that the LPG was liquid injected at the ford focus, as LPi or G3 installation?
It is extra important here to refuel LPG in time. Given that a fuel pump is installed in the tank and may otherwise run dry.
My parents used to have a ford galaxy mpv first gene with also lpg. At the time it was a huge cost considering the LPG price of 0.30 euros per liter. Currently that has doubled. I have heard that in the United States it does not make much difference in terms of price compared to petrol?

Compared to cars with a G3 installation, it is not always necessary to start on petrol in older type cars. The LPG is developed as a gas in an evaporator. This evaporator works on the basis of the heat of the cooling water of the engine.
However, I notice that even in the winter the engine starts quickly on LPG. The slant six comes to temperature fairly quickly without overheating in the summer.
On petrol, however, the engine needs more time to get well warm. The switch to hot intake air and EGR system has already been removed. And if necessary I manually use the choke instead of the bimetal unit. This is often done because the engine will run on LPG.

However, I find that the exhaust temperature with driving on LPG fairly low. In comparison with newer engines, obviously better cylinder heads and heavier loads and turbo. But a short test will be the egt between 250 and 350 degrees Celsius. And by pulling strongly towards the 500 degrees.
One time compare with driving on petrol.
It is nice that you can measure this. But have a plan to electronically adjust the ignition for both fuels. Considering the engine in base is adjusted to low octane which was available in the United States at the time and euro 95 and LPG is much more resistant.
Title: Re: DIY Measurement fuel quantity and EGT
Post by: Admiral_dk on November 21, 2018, 10:13:48 PM
I can't be sure, but I think that the pot is a "wire-wound" one and these can be strange beasts  ::)

One reason is the very low resistance - it is obviously made to "drive" an old mechanical meter directly and these usually requires quite a bit of current in the automobile world - a more "modern" pot would not like high current.

The second is the strange value change - if the wires aren't consistent wound around the former, you will get irregular changes as the angle changes and sometimes even no connection along the way => this type is crap in connection to a MCU ....

If you do have to change it - use one that has a max resistance about 1KOhm. and a travel as few degrees more than needed as possible (unless you get down to less than 10-15 degree extra).
Title: Re: DIY Measurement fuel quantity and EGT
Post by: AlexS on January 05, 2019, 11:51:53 AM
Thanks for the input and ideas Admiral!

My apologies for my late response. I have been busy in recent weeks. And there are other activities in between. In this way I did not continue with this project.
I want to continue with this soon.

Good point regarding the wire wound potentiometer. However, these sensors are available with 95 ohms and one of 200 ohms.

But an accuracy with the current 95 ohm sensor would be fine. Given that I use it as a gauge.
However, it is only important that it gives us some repeatable results. Run a matter of multiple measurements to check this.