Go Down

Topic: Water Level Sensor for Water Tank (Read 16255 times) previous topic - next topic

radman

Ultrasonics are used in industrial water treatment applications, so a practical home solution should be possible. Floats also sound good but have moving parts. Another option might be to weigh the tank.

dannix

#16
Jul 17, 2012, 01:20 am Last Edit: Jul 17, 2012, 01:23 am by dannix Reason: 1
I've just recently done this for a growhouse water storage. I used the pressure differential approach. SPecifically I used a Freescale MPX2010 which is temp compensated. http://www.freescale.com/files/sensors/doc/data_sheet/MPX2010.pdf but you will need a OpAmp to use it. Freescale can send you a sample too.

Regarding the code without giving everything, it's quite simple really. You need to read the analog value returned, make it fit the calibration settings with constrain() and finally map the value if you want a 0-100% style reading, as I did.

Code: [Select]
sensorValue = analogRead( TANK_SENSOR_PIN );
 constrainedValue = constrain( sensorValue, TANK_EMPTY_SETTING, TANK_FULL_SETTING );
 tankLevel = map( constrainedValue, TANK_EMPTY_SETTING, TANK_FULL_SETTING, 0, 100 );


EDIT: added schematic that I used for the MPX2010

dc42

That's an interesting device, however the following excerpt from the datasheet would concern me:

"The MPX2010 series pressure sensor operating characteristics and internal reliability and qualification tests are based on use of dry air as the pressure media. Media other than dry air may have adverse effects on sensor performance and long term reliability".

Allowing water into the device doesn't sound like a good idea to me. It would be possible to have the pressure sensor connected to an air-filled tube, with the other end of the tube at the bottom of the tank; but in this arrangement, the air is always going to be at 100% relative humidity, so it's hardly dry.

Or maybe you have an ingenious arrangement that keeps the sensor in dry air all the time?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dannix


That's an interesting device, however the following excerpt from the datasheet would concern me:

"The MPX2010 series pressure sensor operating characteristics and internal reliability and qualification tests are based on use of dry air as the pressure media. Media other than dry air may have adverse effects on sensor performance and long term reliability".

Allowing water into the device doesn't sound like a good idea to me. It would be possible to have the pressure sensor connected to an air-filled tube, with the other end of the tube at the bottom of the tank; but in this arrangement, the air is always going to be at 100% relative humidity, so it's hardly dry.

Or maybe you have an ingenious arrangement that keeps the sensor in dry air all the time?


Although this device has been used by many it seems for the same application, yes you do need to keep it dry using a trapped column of air. The RH didn't bother me as the application notes suggest using it for Application Examples • Respiratory Diagnostics, doubt that 0%RH either. What exactly is considered "dry air". Anyway I placed a loop in the tube filled with a oil. Naturally the oil can move in the loop. So the tube goes from the bottom of the tank, loop round then out the top of the tank. The loop prevents the oil just dropping out the bottom of the tube.

If you have access to an outlet pipe at the bottom or the bottom of the tank that's better as you won't have diffusion problems with the air mixing with the water and the water moving up the tube giving lower tank level readings.

Anyway, It's worked for me and others so I'm happy with any risk of blowing the sensor. Plus I ordered 2 samples from freescale so I have a spare.

dc42

That's a neat idea, using oil to separate the wet air from the dry air! I guess expansion of the two air pockets may make the reading temperature-sensitive, but probably not enough to matter.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

if you want an ultrasonic range finder, here's a link to parallax's PING))) documentation about using PING))) in a humid environment http://www.robotshop.com/content/PDF/water-level-with-the-ping-28015.pdf, you can make a floating platform where you attach your PING))) so whenever the water level goes down, the floating platform goes down too...
Don't let the PING))) touch the water, attach it about 2 inches above water, and protect it with nylon, and do your calculation to get perfect measurements!
Also there's an Arduino code for PING))) http://www.arduino.cc/en/Tutorial/UltrasoundSensor

dannix


That's a neat idea, using oil to separate the wet air from the dry air! I guess expansion of the two air pockets may make the reading temperature-sensitive, but probably not enough to matter.


The sensor is temperature compensated. I'm not sure if the oil added any inaccuracy to the reading given it will expand and contract at different rates to air.

I have a water pump that pumps up the system until a set pressure point. Open a tap etc and the pressure drops turning the pump back on. Same as a caravan water system. Of course if the tank should empty, pressure will never be reached and the pump would run continuously dry, something it's not designed for. What I have ensures the pump won't run dry. Having said that, it's not been setup long and in the UK it's done nothing but rain!

radman

The water level reading with ping article sounds good. I am not sure what was meant by the floating platform idea though. Surely you would just keep the ping in a fixed location above the water which would rise and fall. Questions about humidity have been raised, I have not seen  ping so I don't know how they might be affected but long term it might be an issue especially with condensation. Perhaps you could try one out with clingfilm stretched across the transponder?

There was mention of using a pressure lock keeping air and water separate with oil. That is quite neat but oil and fish might not mix so contamination might be an issue.

dannix


The water level reading with ping article sounds good. I am not sure what was meant by the floating platform idea though. Surely you would just keep the ping in a fixed location above the water which would rise and fall.


Looks to me like you would lower the 3" pipe into the tank and fix it there, water will rise and fall in the pipe. Maybe the pipe helps with echos vs the ping being above the tank


There was mention of using a pressure lock keeping air and water separate with oil. That is quite neat but oil and fish might not mix so contamination might be an issue.


If that was a reference to what I said adding oil in a loop, you essentially have a 4mm tube, air in the bottom, small amount of oil then air again. My expectation is that the oil would never come into contact with either end of the tube. Add to oil from the sensor end so there is no residue on the bottom water end.

radman

There is another thread about measuring the level in a petrol tank (sorry there is a bit of a cross post). Looking at that I came across the fact that there are piezoresistive sensors available. One of these could simply be bolted into the bottom of the tank. It sounds as if they may be sensitive to temperature but I guess in a fishy environment that will be controlled or at least measured and so could be compensated for if need be.

I get the idea with the oil and air now, neat, and you could always use codliver oil.

dannix


There is another thread about measuring the level in a petrol tank (sorry there is a bit of a cross post). Looking at that I came across the fact that there are piezoresistive sensors available. One of these could simply be bolted into the bottom of the tank. It sounds as if they may be sensitive to temperature but I guess in a fishy environment that will be controlled or at least measured and so could be compensated for if need be.

I get the idea with the oil and air now, neat, and you could always use codliver oil.


Errm the MPX2010 is a piezoresistive pressure sensor, it still can't be submerged. However what was linked in the other post is probably more suitable for petrol!

radman

Quote
Errm the MPX2010 is a piezoresistive pressure sensor, it still can't be submerged.


But, but, but... I skimmed the datasheet and it said it was suitable for use with nasty chemicals.
Surely that means the pressure surface can come in direct contact with them and H2O (though it dissolves a lot of stuff) is not in the nasty class?

dannix


Quote
Errm the MPX2010 is a piezoresistive pressure sensor, it still can't be submerged.


But, but, but... I skimmed the datasheet and it said it was suitable for use with nasty chemicals.
Surely that means the pressure surface can come in direct contact with them and H2O (though it dissolves a lot of stuff) is not in the nasty class?


This
Code: [Select]
http://www.koboldmessring.com/fileadmin/koboldfiles/pdf/gb/p2gb_sen-3247-3276-3245.pdf says it's good for nasty stuff not the MPX2010 Both are piezoresistive pressure sensors. The former as the datasheet pic shows (and the price will confirm) has a housing to prevent the juice contacting the actual sensor. The MPX2010 just has some silicone inside it. What I was getting at is piezoresistive does not mean dunk it in what you like.

For water as in this topic I feel the MPX2010 is adequate. For Petrol as in the other topic, I'd go with your pick if the price of the part isn't prohibitively  expensive. Bare in mind I got 2x MPX2010 for a couple of quid direct from freescale.

johncc


Alright, let me give a bit more detail.
...

The purpose of this project is to be able to monitor the level of my top off tank for my salt water aquarium while I'm traveling. 
...



Isn't the "larger purpose" to maintain the level of the tank, not just monitor it?

What if you just had a sealed, raised, container whose outlet hose opening was put at the water level of the tank you are maintaining?  Sort of like an automatic pet watering setup.

Sorry if that's naive, I don't know anything about salt water aquariums :)

Or, what about a toilet valve in an aquarium?  Depends on your aesthetic sensibilities I suppose, but what a conversation piece!!

John

Constantin

James may correct me if I'm wrong, but my recollection about all aquarium water supplies is that they're very picky on account of the impact that common water treatment chemicals have on the fishes inside. There are particular chemicals that can be added to common tap water to help mitigate this issue, but I've heard stories of folk harvesting rain water and then adjusting it's pH as needed to minimize treatment chemicals.

A salt-water tank will have the additional challenge of adding water with just the right salinity to the mix or your fish will be killed via osmosis. I once accidentally killed some lobsters via immersion in fresh water when I was a kid - didn't know better.

Go Up