Connect with us

Measure distance to water surface

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

Thread Status:
Not open for further replies.
Scroll to continue with content
  1. WWild


    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


    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


    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.
    Last edited: Oct 20, 2018
  4. kellys_eye


    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

    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


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


    Oct 5, 2014
    hevans1944 likes this.
  8. HellasTechn


    Apr 14, 2013
    UltraSonic is also very reliable.
    davenn likes this.
  9. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    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:

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

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

    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!


  10. (*steve*)

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

    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.
  11. ritesht


    Jan 6, 2019
    I was in the same boat of requirement and to my surprise there are quite a few new sensors in town. This one has 2 transducers instead of 1, therefore has less minimum detection distance as compared to JSN SR04T. It is also completely sealed and waterproof.

    Before finalizing on this I had bought another one which was a waterproof modified version of HC-SR04 from here

    The 1st one is much more rugged and waterproof as compared to the latter one.
  12. Elainedan0228


    May 16, 2019
    There are many ways like using a float sensor to determine the water level, or using probes to detect peak and low level in the tank. it is simple to use ultrasonic sensor which gives the depth, by determining the tank depth we can set the maximum and minimum level [​IMG]
  13. hevans1944

    hevans1944 Hop - AC8NS

    Jun 21, 2012
    Hmmm. @Elainedan0228, how does your "monkey see, monkey do" picture add anything to this discussion?

    BTW, it appears that the original poster (OP) was a "drive by" who has considered their "problem" solved and has driven on to somewhere else as of October 20, 2018, the same day as their original post, as well as the day they joined this forum. It's not that I didn't enjoy reading the interesting comments and links that other members of this forum posted, but sometimes I wonder why do we even bother if there is no dialog established with the original poster?

    Distance measurement is a fascinating subject whatever the application. I first encountered the need for it while learning to maintain a radar-controlled 20mm Gatling gun. Range-to-target is an important parameter that needs to be accurately measured and used in calculating solutions to the ballistic equation in "real time" if the fire control system is expected to perform adequately. It's hard enough to do this shooting backwards out of the tail of an airplane, a relatively stable platform, but I cringe at the thought of having to do it from a ship-at-sea, at close range of only a few hundred meters, with one or more missiles bearing down at supersonic speeds. Somehow the Navy does manage to do it.
  14. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    Thread closed.
    Last edited by a moderator: May 18, 2019
    hevans1944 likes this.
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.
Thread Status:
Not open for further replies.
Electronics Point Logo
Continue to site
Quote of the day