Connect with us

Measure distance to water surface

Discussion in 'Sensors and Actuators' started by WWild, Oct 20, 2018.

  1. WWild

    WWild

    2
    0
    Oct 20, 2018
    I'm looking for a sensor that will measure the distance to a water surface. Some approximate specifications are:
    1. Operating range: 0 to 2 metres
    2. Update interval: 0.1 sec (10 per second)
    3. Accuracy: 1cm
    Naturally it needs to be water resistant or able to be mounted in a water proof housing, and operate continuously for up to 3 or 4 hours.

    It will need to connect to a programable controller that will process the measurements and control an actuator depending on the distance to the water surface. I'll need to program the controller as the movements are not a simple linear or curve relationship to the distance, it will need to be able to handle velocity and acceleration as well as straight displacement as it needs to have dampening effects and filter out noise.

    Can someone advise of any existing hardware that fits the bill? And a suitable programmable controller that it can connect to?
     
  2. Bluejets

    Bluejets

    2,981
    578
    Oct 5, 2014
    Arduino would be well within capability.
    Many different sensor arrangements such as sonic, slotted IR via codewheel, rotary encoder, but water resistant or waterproof throw up 2 different requirements initially and a host of mechanical possibilities.

    Then you have velocity and acceleration to add so perhaps the latter of the sensors.(gives something mechanical to connect to)

    As far as I can make out, it would need to be one or the other but one would allow for that in the programming.

    Need for interfacing whatever the "actuator" might be.

    Last but not least, how are you at programming?
    Given the need to ask initially suggests, not much.
    Even for a well experienced programmer, this is a rather large requirement overall and suggest it needs to be broken down into realistic pieces and solve each one at a time.

    Perhaps keep in mind a simplified version of what it is you are trying to do, whatever that is.
    I doubt there is anything "off-the-shelf".
     
    HellasTechn likes this.
  3. WWild

    WWild

    2
    0
    Oct 20, 2018
    I can program. If implementing a particular algorithm becomes an issue I'm sure I can find resources to help. A simple linear map will do to start with. I just want to be able to make it more complex later if necessary.

    My biggest issue is getting suitable components to start with, such as a device to accurately and reliably measure to a rapidly changing water surface at the required interval and write to an interface. Then to have a device that accepts the input and processes it to tell an actuator what to do, basically move up or down.

    The measuring device is step one. For example, there are units like the Arduino HC-SR04 Ultrasonic Sensor, but I have no idea if it can sense a water surface accurately.

    https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
     
    Last edited: Oct 20, 2018
  4. kellys_eye

    kellys_eye

    4,289
    1,143
    Jun 25, 2010
    There are many monitors available for measuring tank liquid levels - oil, water, sewage - and they commonly use ultra sonic (non-contact) methods of measurement. As such I suggest the standard Ultrasonic modules used with Arduino and via the I2C interface providing you can make the necessary protection for the transducers.

    If you Google remote liquid level monitoring you'll find many tank systems that may fit your bill without the complication of construction/programming.

    There are, of course, other methods to measure liquid level (floats) including PRESSURE if the liquid is in a sealed container.
     
  5. hevans1944

    hevans1944 Hop - AC8NS

    3,911
    1,867
    Jun 21, 2012
    Here is an application note on the HC-SR04 sensor that may be useful in calculating your measurement error. Note that this sensor performs no temperature correction for the velocity of sound. The width of the return echo is a function of distance and is the parameter your microprocessor interface must measure. No idea (and no specification) on how much jitter occurs from the end of the 8 cycles of transmission burst to the beginning of the return echo pulse that terminates the echo output, but this would affect both resolution and accuracy.

    The return echo pulse is not provided. Only a crystal-controlled timer output is provided, which is started after the last 8 cycles of transmission and terminated when the echo is received. It is the length of this timer output that you measure, but who knows when that output is terminated, i.e., how many (or how few) cycles of the transmission burst must be received to stop the timer? This, too, affects accuracy and resolution. Still, its a fine piece of electronics integration if you can tolerate its rather loose specifications.

    You can "roll your own" by purchasing the ultrasonic transducers separately and building your own echo-based ranging system. This would allow you to design in some sophisticated receiver circuitry that would use multiple received echos to improve the range accuracy.

    Some questions you should ask before attempting to re-invent this particular wheel: Why does the transmitter emit eight (and only eight) cycles of ultrasonic sound? Is this related to the mechanical self-resonance of the piezo-electric ultrasonic transducers? How does the transmitter ensure that only eight cycles are emitted per trigger input pulse? Does this even matter? Does the receiver have a count threshold on the number of cycles it must detect before terminating the echo output pulse? What happens if no echo is detected, either because the target surface is too far away or the return echo signal is somehow attenuated below the receiver detection threshold?

    Presumably the designers of the HC-SR04 module have considered and answered these very same questions and now make their wisdom and product available to you for only a dollar or so. I would take advantage of that, if possible, unless you just want to learn how to design and build ultrasonic ranging sensors. We've come a long way since Polaroid put these doobies on their instant-photo snapshot cameras, and later made the circuitry available for public use and purchase. The HC-SR04 is somewhat simplified in that it uses two ultrasonic transducers, one for transmit and one for receive, whereas the original Polaroid camera managed to get by with just one, albeit much larger, transducer.
     
    darren adcock and HellasTechn like this.
  6. Externet

    Externet

    632
    131
    Aug 24, 2009
    Last edited: Oct 21, 2018
    hevans1944 likes this.
  7. Bluejets

    Bluejets

    2,981
    578
    Oct 5, 2014
    hevans1944 likes this.
  8. HellasTechn

    HellasTechn

    1,361
    190
    Apr 14, 2013
    UltraSonic is also very reliable.
     
  9. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    431
    98
    Aug 27, 2013
    Hey WWild!

    I have wrestled this problem many times over the years .... with varying degrees of success. One method that works fairly well for a simple cistern type scenario is a pair of "Flow Meters" one for water in and one for water out with a simple "Float Switch" to prevent over filling. These are cheap and readily available:

    https://www.ebay.com/itm/NEW-G3-4-W...h=item232dcc3d9b:g:UGgAAMXQfvlSdkEu:rk:1:pf:0

    Perhaps the most accurate "level indicator" I have played with uses one of these:

    https://www.ebay.com/itm/0-40kPa-At...h=item1c99b4398f:g:15cAAOSwcUBYSNSp:rk:2:pf:0

    I purchased some of the version with the built in 24-bit ADC, but I haven't tested them yet ....

    https://www.ebay.com/itm/2-Digital-...d-Water-Level-Controller-3-3-5V-/401433500416

    I did some preliminary testing with the analog version (linked first), using my bench VOM measuring water in a 500ml graduated cylinder ... I don't remember the actual numbers, but the VOM reflected a response to single drops of water .... and 10 drops caused a very consistent change in voltage.

    In theory 40kpa translates to 5.8psi or 160 inches of water, but the pressure is relative to Atmospheric Pressure which can vary from as low as 87kPa to as high as 107kPa with a standard value assignment of 101.325kPa. While it is unlikely any fixed location would experience either extreme, atmospheric pressure certainly changes from day to day and could lead to inaccurate readings unless taken into account ...

    Other methods of note include:

    Creating a capacitor from a pair of insulated metallic tubes or plates separated such that as the tank fills the space between the tubes/plates is filled with water thus changing the capacitance in a repeatable way ... if this capacitor is used in an RC oscillator then the output frequency becomes a repeatable function of water depth.

    A simple encoder can be rigged to a float to give highly accurate, absolute level readings.

    If you are measuring volatile or corrosive liquids obviously you need to take pertinent precautions.

    If I could give one bit of advice it would be: "Simple is generally more reliable than complicated." I have several water cisterns that need to remain relatively full without needlessly cycling the "fill" pump ... what I have found works best is a pair of float switches ~ 12 inches apart in depth ... the switches connect to logic that turns the "fill pump" on only when the water drops below the bottom switch, once the pump is on, it runs until the water reaches the top switch then turns off until the water again drops below the bottom switch. In my 500 gallon cistern the top switch is located ~450 gallons and the bottom switch is ~300 gallons so the pump runs for at least 30 minutes before cycling off.

    In a different cistern I use a pair of optical sensors and a single float that moves a rod with a pair of "flags" ... In this case the distance between the switches is only ~6 inches, but this is a larger cistern and 6 inches is around 300 gallons.

    Good Luck!

    Fish

    Fish
     
  10. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    24,865
    2,571
    Jan 21, 2010
    Aaaagh @Fish4Fun... I also thought of measuring the depth of the water via a pressure sensor and using that to calculate the position of the surface. I'm glad you provided a link to a pressure transducer.
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.