Pages: [1] 2   Go Down
Author Topic: Ultrasonic sensor to determine water level?  (Read 10540 times)
0 Members and 3 Guests are viewing this topic.
Denmark
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2516
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Denmark
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

Sweden
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
Arduino System Go!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Denmark
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice approach... Haven't thought of that one  smiley-cool

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...  smiley-razz
Logged

Germany
Offline Offline
Edison Member
*
Karma: 2
Posts: 1363
Here we go!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: July 01, 2011, 04:54:44 am by f.schiano » Logged

L'impossibile...richiede solo piu' tempo!

Denmark
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand..  smiley-razz

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 smiley-razz

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
« Last Edit: July 01, 2011, 11:09:30 am by kucza83 » Logged

Germany
Offline Offline
Edison Member
*
Karma: 2
Posts: 1363
Here we go!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

L'impossibile...richiede solo piu' tempo!

Sweden
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
Arduino System Go!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

UK
Offline Offline
God Member
*****
Karma: 13
Posts: 903
Twitter: @simonmonk2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink
Logged

--
My New Arduino Book: http://www.arduinobook.com

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1923
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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



Logged

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13707
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: May 01, 2013, 01:55:50 pm by robtillaart » Logged

Rob Tillaart

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

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1923
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Rob,

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

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

Logged

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13707
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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 smiley-wink

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)

Logged

Rob Tillaart

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

UK
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1] 2   Go Up
Jump to: