Go Down

Topic: Ultrasonic sensor to determine water level? (Read 12160 times) previous topic - next topic

Hi!

I'm planning to build a water level sensor for my watertank of my espresso machine... And i was just wondering about, if a ultrasonic sensor can be used for this propose? Or is this a stupid idea? :smiley-red:

Maybe one like this:

http://iteadstudio.com/store/index.php?main_page=product_info&cPath=9&products_id=52

I have searching the net, but i cant seem to find any clean answer...

Chagrin

I don't think ultrasonic sensors work well in enclosed tanks. An infrared proximity sensor would be cheaper with the small distance you're dealing with. To measure the water level you can add some type of float that would sit on top of the water that the IR sensor would reflect off of. The voltage from the transistor will vary with the distance measured.

No specs on this one, but just to give you the idea of what you're looking for:
   http://iteadstudio.com/store/index.php?main_page=product_info&cPath=4&products_id=244
Sparkfun.com sells a better selection with more detailed documentation.

Yeah, you're probably right...

Your idea could work, but how big do you think the float object minimum should be?   

The watertank is 25cm deep... Sensor will be placed right above the water. approx 1cm..

Anders 2009

I have dealt with the exact same problem, but for a 20L tank and found several threads in the subject of water level measurement on this forum. Search around and you will find a lot of good input.

All-in-all, I have decided to go for a float with a neodymium magnet on it and measure the magnetic field strength using a Hall effect sensor. This has the added benefit that your electronics can be outside of the tank, provided it is plastic. IR will probably work as well I guess.


Nice approach... Haven't thought of that one  8)

I could also fit a line of fx. five reed sensors  on the outside of the tank, with a floating magnet in the water.. The resolution aint that good, but it would work...

But i think i will go for the IR sensor... Just because i can...  :P

f.schiano

#5
Jun 30, 2011, 11:24 pm Last Edit: Jul 01, 2011, 11:54 am by f.schiano Reason: 1
The cheapest method to control water level (I think) is this:
(I tried it and it works well)

You put 4 wires (A,B,C,D) inside your tank:



/.                    /
/.D                  /
/.C                  /
/.B                  /
/.A                  /
///////////////////

You connect A to 5V , and the other 3 wires to some analogic ports of the arduino.

When the water is under B but over A you read:
A=1023 (5V)
B=low value of voltage=C=D

When water is over A and B you will read:
A=1023=B
C=D= low vAlue of voltage

Did u understand?

Bye,
Fab
L'impossibile...richiede solo piu' tempo!

#6
Jul 01, 2011, 06:03 pm Last Edit: Jul 01, 2011, 06:09 pm by kucza83 Reason: 1
I understand..  :P

That could work. But when it is at drinking water tank, i dont think it is the best idea due to the electrolysis, and corrosion of the wires... Even it is just 5V. A opamp could minimize that tho... And the cleaning its made difficult with the electronics inside the tank.

But thanks for your reply :P

But i have been searching the net for a IR suitable for my plan. And its quite difficult finding one thats have the range 3cm - 30-40cm without its have a pricetag above 10 bucks! So maybe its a bad plan using IR!

Anders 2009:
I assume its a linear hall effect sensor you are using.. Right? Did you find one that could measure the magnetic field in the range of 30cm? Or are you just using a kickass magnet?  :smiley-eek:

f.schiano

It's not a bad plan... with just a couple of IR leds you can implement a distance sensor...

It's an idea of a Friend of mine...

Look here:
http://www.gioblu.com/prodotti?page=shop.product_details&flypage=flypage_images.tpl&product_id=184&category_id=63

and here:
http://www.gioblu.com/tutorials/sensori/59-sensore-prossimita-led

Sorry, they are italian but maybe with a google translator you can understand.
I tried them and they work fine!
Bye!
L'impossibile...richiede solo piu' tempo!

Anders 2009

I didn't get around to installing it yet, but maybe you don't have to deal with the 30cm distance problem if you place your sensor cleverly, or use several sensors? For me it is mainly to detect if the water level is running low, so if the magnet is far away, it just means that everything is fine.

Anyway, I did get several quite strong magnets just to be on the safe side when building it.

The magnet I am planning to use is a ring magnet with 7.7kg strength. I hope it will do the job.
http://www.supermagnete.de/eng/R-19-09-06-N

I also got a couple of these
http://www.supermagnete.de/eng/W-12-N

and finally
http://www.supermagnete.de/eng/S-25-07-N


Si

Quote
if a ultrasonic sensor can be used for this propose


I have just been playing with one of these: http://www.ebay.co.uk/itm/Arduino-Ultrasonic-module-HC-SR04-distance-sensor-/280693181997?pt=BI_Security_Fire_Protection&hash=item415a9e0e2d#ht_1500wt_907

and it is surprisingly good down to a range of about 5cm. I would be tempted to try one, in an enclosed space. They are narrow angle (15 degrees) and the first echo would be the one from the liquid, so I would be surprised if it didn't work.

If you are still interested, let me know and I'll go and experiment with it in the kettle ;)
--
My New Arduino Book: http://www.arduinobook.com

terryking228

Si, I would be interested in your experience with water level sensing.

I have a shallow spring/well about 10 feet deep and the water level typically is from 1 foot to 8 feet down. I'd REALLY like to have realtime data on the well level.

The HC-SR04 like you have has a maximum distance of about 1.5 meters.  At least with the typical software. I think.

Running it into open space (I have one running on the desk here) , I get  2661cm   1043inches   back, which I think may be the software or Hardware timeout.  I'd like to try it on the well! 

Also I'm about to test a new-improved model called SRF-06 which has temperature compensation built in. 

I have photos and how-to on these modules on my Arduino-Info WIKI here: http://arduino-info.wikispaces.com/UltraSonicDistance

I need to do some more testing and I don't have my hands on the SRF-06 yet but at $8.50 it looks good.

Anyone? Test down a tank or well??

I'll post what I learn...

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com



Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

robtillaart

#11
Jul 21, 2011, 01:30 am Last Edit: May 01, 2013, 08:55 pm by robtillaart Reason: 1
Quote
If you are still interested, let me know and I'll go and experiment with it in the kettle


Think in a kettle you have a rising very high humidity (100%) and rising temperature:

* affects electronics as posed earlier
* which changes the speed of sound through the air (lets do some research)

Enviromental Effects on the Speed of Sound
Source -  http://www.rane.com/pdf/ranenotes/Enviromental%20Effects%20on%20the%20Speed%20of%20Sound.pdf - http://bit.ly/omGpzb -
- http://www.rane.com/pdf/ranenotes/Enviromental_Effects_on_the_Speed_of_Sound.pdf -

Temperature effect
float sos =  331.45 * sqrt(1 + t/273);  // t in Kelvin

This means sos == 331 at 0 Celcius and  385 at 100 Celcius. An increase of 17% !!
(on a hot day 30C the change is allready 5%)

Humidity effect
Humidity is a tougher job as the effect of humidity on the speed of sound is temperature dependant.
However the effect is substantial smaller than temperature for the range 0..40C, however looking at the numbers in the 100% RH colums I see an exponential pattern.
at 100%RH every 10 C increase, give an ~1.82 times higher number.
furthermore if the temperature is constant the effect is almost linear with the RH

increasePercentage =  RH * 0.11  * power(1.82, (t/10));  // t in Celsius; RH in %

For 100C the increase is 45% !! so more than
==>
increaseFactor = (100 + RH * 0.11  * power(1.82, ((t-273)/10)));  // t in Kelvin, RH in %

combined
float sos =  331.45 * sqrt(1 + t/273) *  (100 + RH * 0.11  * power(1.82, ((t-273)/10)));  // t in Kelvin

This formula is based upon the assumption that the exponential pattern goes on until 100C

If this assumption is correct the cummulative effect 100C and 100% RH
==> 1.17 *1.45 = 1.69 so almost 70% increase in speed of sound from 331 @ 0C,0%RH to 560 @100C,100%RH

conclusion
Using an ultrasound sensor for measuring the waterlevel is both temperature and humidity dependant.
Depending on the ranges the speed of sound increases with a factor up to  1.7. (under above assumptions)
That means that an uncorrected measurement will show up too short with this same factor.
In practice this could mean that an almost empty tank could appear half full.

disclaimer: there might be some mistakes in my math as it is getting pretty late here ;

fun!
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

terryking228

Hi Rob,

As usual, you expose the rest of us as Just Hackers  :)

I have a temperature-compensated sensor: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=115

...that I want to try.  If the humidity (in a closed top well 1M in diameter) is always close to 100%, maybe that can be calibrated out.

Probably more accurate than me opening the top of the well and looking in!

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

robtillaart


Hi Terry,

1) Take a long stick, longer than the well is deep,
2) add 2 wires to the top of the stick -> if they touch water a contact is made - analogRead() ?
3) attach the distance sensor at 1,2,3,4, ... feet from and make readings and
4) create your personal well calibrated lookup table ;)

Alternative (mid tech),
If you have such a long stick with the two wires, you could just make some notches at known distances from the top
When the wires touch water a LED will light up (buzz) and you can read the depth from the notches.

something like:
[LED & battery] +++++++++++++++++++++++++++++++++++=

Aternative (low tech)
* take a long perspex tube,
* put in a polystyrene (or cork) tube in it to create a bobber (like fishers) .
* give the perspex tube a fixed mount in the well, so the bobber floats on the water.
* If the water in the well rises the bobber will rise in the tube.

// we have such a low tech thing here to measure ground water level - notches every 10 cm in three colors green (OK) yellow (LOW)  red (TOO LOW)

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

cog1

Hi everyone

I'm also really interested in this topic.

I want to detect the level of river water at a specific location.  I have a fixed structure to which I can attach a vertical sensor of some sort.  The water depth range is 6" to 54".  The water is brackish and frost will be a consideration to exposed equipment that'll be damp.
I'd like to get to a resolution of at least 2", but 6" would be OK.

This is a great idea:  http://lifeboat.co.nz/arduino-water-level-gauge/
However, over time the exposed wire will decay thanks to electrolysis.  I can limit this by using a digital pin as the supply and only switching it on for a couple of seconds, measuring the level and switching the supply off again - I want to sample the river level every 30 minutes.  The salt content of the water is an issue too; deposits of salt on exposed wire when the water level is low might make the level detection less accurate.

Another method might be a number of float switches, each with their own resistor in series.  They could freeze open or closed though, when exposed to the air in winter.

A small pressure transducer connected to a short length of flexible hose, and fixed at a point a few inches above the river bed would be great, but I can't find any reasonably priced device to do this unless I build my own.

What I'd like to try is a length of rigid plastic tubing, say 1" diameter, with an ultrasonic range detector mounted at the top, "looking" down the pipe.  The bottom of the pipe would be open and there'd be a vent at the top, so the level of water within the pipe matches that of the river.  The advantages of this are simplicity, no moving parts, less issues with frost although a build-up in the pipe might reduce accuracy.  There are also reasonably priced (around £30) ultrasonic range detectors.  I could mark the levels on the outside of the pipe and note the output of the transducer to calibrate the device.

Has anyone else tried any of these approaches in 'open' water?

Many thanks

Go Up