Measuring water (petrol) level

I'm trying to come up with a way to add an accurate fuel gauge to my motorbike, seems as it doesn't have one. As I've always wanted an excuse to play around with an Arduino, I thought this to be a good excuse to get one and experiment.

What I'm essentially thinking of is:

  • Fuel Tank on Motorbike (10-20Litres)
  • Tube connected to the bottom of the tank
  • Tube connected to pressure sensor
  • Arduino does maths on values
  • Percentage of Fuel remaining is printed to the console (the first aim is to simply print it to the console, I'll display it properly later)

My initial searching for the project, and the above idea, was formulated mainly by Practical Arduino. Namely, this project.
Not knowing a great deal about electronics though, I was getting a little confused over the circuit and the cost was surprising me too.

More searching then lead me to this project which was basied off of the Practical Arduino project. The author notes how he could have used an MPX5010DP rather than a MPX2010DP because it would have operated in the 0-5v that Arduino operates on, saving the need for the amplification circuit.

Further searching then lead me to this project where the author commented on using a MPX5010DP, but how he should have used a MPX5010GP instead because he wanted to measure against the atmospheric pressure.

I also want to measure the pressure relative to the atmospheric pressure, so that the fuel gauge would still be accurate when the atmospheric pressure changes. Does this mean that I actually need the Gauge sensor rather than the Differential sensor?

Also, it may seem like a stupid question, but I'm confused. As to the pipe connecting the fuel tank to the sensor. Is this a sealed pipe full of air, located inside the petrol tank, or an open pipe in which the petrol goes down to reach the sensor?

Then the MPX5010GP or MPX5010DP (whichever I need) would be able to connect directly to the Arduino, without the need for extra circuits?

Sorry for the long first post. Just trying to clear up some questions, get a firm idea of parts and costs and decide whether I really have the ability to do the project/the money to fund it.

Thanks,

Jordan.

It would be possible to get that working, I'm sure.

But every production car, bike, truck and so on uses a float based system. Surely that is a hint that this may not be the most practical way to tackle the problem?

Surely that is a hint that this may not be the most practical way to tackle the problem?

Maybe it is a hint that it isn't the most cost-effective way to tackle the problem.
I'm fairly sure some washing machines gauge drum water level using a simple air pressure switch, I guess because it would be impractical to have a float in a cylindrical drum.

I've always found float based systems on a motorbike (never owned a car) largely unreliable. My previous bike's gauge would sit at full for the vast majority of the tank and then quickly fall to just above empty, where it would again sit for a while.

My thoughts for using the pressure sensor are that:

  • should theoretically give a more accurate fuel level, not affected by the angle of the tank
  • could be installed with minimal modification to the actual tank

All that I should really need to do to install this is add an additional petcock to the tank like this one.

You will be disappointed then. With a pressure sensor you'll measure the vertical fluid head. If your tank is formed like a triangle on the tip you'll have only a third of the tank when the pressure is half down.

The tank is quite an even shape (pic) although the drainage rate will be a little bit uneven.

Perfectly accountable for with a bit of smart programming though?

I'm not so much interested in how full the tank is though, rather what percentage of fuel is left. So let's say there are 10L left of the 20L tank but that 10L takes up 2/5 of the tank. So long as it shows 50%, that's all I really care about.

For my eyes it looks quite a bit like the triangle I mentioned. To get linear results with the pressure sensor the tank has to have just straight vertical lines in the design. I guess a motor bike never has a tank shaped like that. But your right, with a bit of programming you probably could compensate for the "irregular" shape. Once you have your sensor installed you could just empty the tank and then fill in liter by liter and note the value you get from the sensor. That way you have "calibrated" your gauge.

It's hard to find a picture which really shows off the shape, but I guess it is more triangular shape.

I'm more than happy to program in the calibration manually though. The smaller increments I do it in the more accurate it should be too.

Which pressure sensor is it that I will need for this job though, Differential (leaving one pipe open) or Gauge?

I think I'm going to buy myself an Arduino Mini to work with.

I'd go for a gauge type, although I don't have experience with both types of sensor.

Okay, great.

I'll try and get some things on order tomorrow then and figure out how to mount the pipe inside of the tank once I pick up my (free XD) donor tank.

Thanks for all the replies everyone. :slight_smile:

Generally, motorcycle tanks have a complex shape. The arduino gives you a chance to linearize the sensor reading (after some experimentation) to give a more accurate representation of the actual fuel level

You don’t need another petcock. Just T it in-between your present petcock and the carburettor, this giving it a bit of an extra head, which will increase the accuracy.
As mentioned previously, you fill the tank with one litre (maybe half a litre) at a time, and take readings.
You can then enter these readings into an Excel spread sheet, which can be used to return a graph and formula for that graph.
The formula can then be used to give a very accurate reading.

ConfussedLayman:
You don’t need another petcock. Just T it in-between your present petcock and the carburettor, this giving it a bit of an extra head, which will increase the accuracy.

Will it really work that simply? I would have thought that using that fuel line would give off incorrect readings. Worth a shot though if you think it will work.

I'm definitely going to do the filling it up in increments. I was thinking even smaller than half a litre at a time to give the most accuracy. Plotting a graph is a good touch.

I'm also thinking about adding an accelerometer to the build so that I can detect when the tank is being tilted, so that if there are any variations in pressure when tilted I can compensate for them.

jordanmoore:
It's hard to find a picture which really shows off the shape, but I guess it is more triangular shape.

I'm more than happy to program in the calibration manually though. The smaller increments I do it in the more accurate it should be too.

Which pressure sensor is it that I will need for this job though, Differential (leaving one pipe open) or Gauge?

I think I'm going to buy myself an Arduino Mini to work with.

Most 'gauge' pressure sensors are differential internally, they just don't break out the reference leg for utilization, only the measurement leg, but the reference leg is exposed to ambient pressure internally. So you can use either a true differential or a single port gauge pressure sensor. As long as you aren't using an 'absolute' pressure sensor, it will work for measurement of the 'head pressure' created by the weight of the liquid height in your tank. An absolute pressure sensor is also a differential sensor, but the reference leg has been evacuated of air to create a vacuum and sealed, so it's measurement is not effected by changes to ambient pressure changes.

Lefty

retrolefty:
Most 'gauge' pressure sensors are differential internally, they just don't break out the reference leg for utilization, only the measurement leg, but the reference leg is exposed to ambient pressure internally.

Cheers, that clears a bit up.

I was confused because I had seen many people doing this concept using the differential sensor rather than the gauge. I'll order the gauge one then; it's a little more expensive but simpler to use.

I had a crazy idea for this. (not very practical ) you get a PING))) sensor and put it at top of tank somehow (tank would need to be cylindrical) then you get distance measurements on liquid do math. you get accurate measurement. I could see this would be a lot more work. just throwing it out there.

Putting a ping sensor in a small enclosed space is really not a good idea, because of echoes.
Putting an electrical device in a small, enclosed space filled with explosive vapours (despite the thread's title) is a really bad idea.

arduinopi:
I had a crazy idea for this. (not very practical ) you get a PING))) sensor and put it at top of tank somehow (tank would need to be cylindrical) then you get distance measurements on liquid do math. you get accurate measurement. I could see this would be a lot more work. just throwing it out there.

I was considering something like this originally. However for the reasons below I'm not going down that route. I don't want to put any electronics in the tank. Also, it could involve taking the tank apart to install.

AWOL:
Putting a ping sensor in a small enclosed space is really not a good idea, because of echoes.
Putting an electrical device in a small, enclosed space filled with explosive vapours (despite the thread's title) is a really bad idea.

I'll update the title now. I used water as the word as it was a more common search term/project. I didn't think about the explosive part.

On another note, I've ordered my self an Arduino, breadboard and jumper cables. I'll be picking up an MPX5010GP from RS on Monday probably on my way home from college.

I didn't think about the explosive part.

Really? Then you should walk away from this project before you set your face on fire.

-j

kg4wsv:

I didn't think about the explosive part.

Really? Then you should walk away from this project before you set your face on fire.

-j

Of course I thought about it from the project's "blow-myself-up" perspective, just not the perspective of getting help from a forum.