Sensor for water depth

I have a stream in the garden and I need to monitor the depth of it, as it can rise quite quickly when heavy rain occurs, and if it goes above a certain level, that’s bad news.

Because of the flow rate at times, I am thinking that the sensor will have to be inside a vertical pipe for protection, as items as large as a railway sleeper have been known to be carried down, and the speed at peak spate is close to 2 Mts/sec, so it’s fast,

The channel is 1 Mtr deep, and it can come out of it’s channel by up to 700 mm onto an overflow area before it becomes a serious problem, so I need to be able to measure up to 1.7 Mtrs depth. The rate of change will be relatively slow, even if a large object blocks the grid, causing a major backup of flow, the rise to 1 M will take a few minutes, and above 1 Mtr, it will depend on the flow rate, as it’s into overflow mode at that stage,

I’m not sure what the best sensor to use will be, I’ve looked at Infra Red and Ultra Sonic, but I have no experience in these areas, so things like side lobes are an issue that I don’t know how to deal with. I did wonder if I could use something as simple as a set of resistors in series with an exposed pole, but I suspect that contamination from the water quality will degrade it quite quickly, and unless I use AC current, Electrolysis could be an issue.

If necessary, I can put a float into the pipe so that there is something other than water to detect. I don’t need to resolve to better than 2.5 cm, and the change rate is not essential, the main thing is to be able to get a reliable depth indication, there will be more than one sensor, as I need to be able to detect that rubbish or a large item has blocked the grid, as that causes a significant differential in depth between before and after the grid, and I also want to be able to highlight when the level is high because of volume of flow.

Plan will be to feed back to a computer that will also be tied into a weather station, and over time, this should allow me to correlate depth against rainfall, as well as have a warning system for blockages or high flow volumes.

So, has anyone any suggestions. A float system based on the car fuel tank sensor concept isn’t likely to work, as I need too big a height operation, and the float arm will be too susceptible to damage. Optical sensing may be a problem, as this is very much an outdoor application, and keeping windows clean on a sensor could be problematic.

Any and all suggestions appreciated


Hello, Steve.

I searched Google for “water depth sensor” and found several products that do it by measuring the pressure.

Here is a write-up about how to do it with an Arduino: … pth-sensor

If you put the Arduino above water in a non-metal enclosure, you could attach a Wixel to it using the Wixel shield and transmit the data to a nearby PC to be logged.

This sounds like a cool project. I’d be interested in seeing some photos of the stream you’re trying to measure! What kind of garden is this?



Thanks for the link, it confirmed what I’d seen, and that this is a possible route to go down. I had seen that link, and went digging a bit, and while there’s a reasonable level of information about the arduino side, and I’m sort of familiar with them from Radio control research I’ve been doing recently, there’s very little about the actual implementation of the sensor. It’s a route I’d been thinking of, as I’m aware of the concept from model aircraft airspeed sensors, which use this or a similar device, but what’s not clear from the page is the size of the tube they use, in that it’s a trapped air column, so the volume of the column will affect the pressure. I’ve been changing bearings on a washing machine this week, and seen the same concept used there for the water level in the drum, but they use a larger vessel to trap more air in order to get the higher pressure differential, so it clearly is a factor in the operation of the sensor.

There are also temperature implications, which may be dealt with on the interface board, so I shall have to dig a bit deeper.




I have no experience with this and have only been thinking about it for a few minutes, but it seems like another option would be something similar to how your toilet tells when the tank is full. What if you put a buoyant object in a tube and connect it by a long arm to a linear pot that’s safely above the water level? As the river level rises, the buoy would slide the pot wiper and you could use the pot in a voltage divider to compute the height of the water. You might need some sort of spring mechanism to pull the pot wiper back down when the water level falls, though.

Edit: I just noticed:

I guess that’s what I get for posting after skimming. Sorry!

- Ben


This seems like a really tricky problem. To use an air-based pressure sensor you probably would want some kind of a membrane separating the sensor from the water. How about using something like a mostly-deflated bicycle tire submerged in the water, either with an absolute pressure sensor sealed inside or with a thin tube connecting to an external relative pressure sensor? The large area of a tire should make it less susceptible to debris in the water, though you would probably want to enclose it in some kind of cage for protection. I have no idea how long a tire would last in your stream.

Another thought that occured to me is to connect a float of some sort to a force sensor so that you can detect when it gets submerged without the float actually having to move. I do not know whether the force sensors we carry would be appropriate for this application.


After doing some Google searches, I came across the air bubbler technique, which sounds really nice. You just need a small air pump out of the water, a long tube leading down into the water, and a relative pressure sensor.



The bubble system might work, but could get complicated. What I was wondering is if I put a pipe, possibly 2 or 3 inch diameter, galvanised so that it lasts, vertically in the stream, which I can do because of the shape of the channel, and arrange to have a small hole in the bottom that’s downstream of the flow, so that it is less likely to get blocked, I will then get a column of water in the pipe that reflects the level, and does not get as disturbed as the main flow might, and also ensures that debris can’t block the sensor path.

If I then have a float (ball or similar) that can sit in the pipe, I was kind of hoping that either an IR or Ultrasonic sensor would be capable of detecting the ball, and working out the distance from the sensor, which could be mounted in a cap on the top of the pipe, above water level, which should provide reasonable weather protection. In this case, the top would need to be vented so that air can escape. The area I’m not sure of is the implications of reflections of the IR or Ultrasonic beam off the wall of the pipe, which might invalidate the reading returned by the sensor.

The other possibility would be to use a sealed at the top pipe that has a differential pressure sensor on it, and in this case, I suspect that the size of the pipe may have to be a lot smaller, then as the water rises, the air is compressed, giving differential pressure. Below a certain level, I would not be worried if the water drains completely from the pipe, as that would then ensure that the air gets changed, and a known volume is trapped the next time the water rises. Again, the sensor can be mounted above the water level, so there’s no danger of contaminating the sensor diaphragm with water.

If the concept works, there will be several sensors in different locations, 2 in the stream, monitoring the overall level, and the level difference at the grid, which gives me warning of a blockage of the grid, and there are also a couple of sumps in the garden, one large, one a lot smaller, which are surface water drains, which normally discharge into the stream. To prevent backflow, they had to be fitted with non return flap valves, so I want to put a sensor in the sumps to ensure that if the level comes above a determined point, and the pumps that are in the sumps have not cut in automatically (which they should do), I get a warning of a high level in the sump. These sump sensors could in fact be simple float switches, as they would only be a backup check of the correct operation of the pump float switches, but it would be useful but not essential to have in indication of the rise and fall of the sump levels.

There’s also (longer term) an option to have a warning if the main electric supply has failed and the generator (30Kva diesel standby unit) has not cut in to provide power. Plan would be to use Arduino or similar to monitor all these sensors, and pass the data back to a logging PC that’s also logging weather information (and maybe later some other things as well) to provide a complete building management type facility. Longer term again, I may try to set up monitoring of power usage, and maybe even heating oil usage, again that could be cross referenced to weather and other data, with a view to trying to reduce spend on energy, given the way prices are going in that area.

So, going back to water level sensors, I guess the main question I’d like to get some feedback on if I can is the feasibility of using either IR or Ultrasonic sensors to measure the float height, and if it will work, or if reflections off the tube walls will make it impossible to get an accurate reading. Alternately, if anyone knows how I can get some theory on the pressure change of a fixed volume of air in the column that could then be measured by a differential sensor, then that also would be a huge help to me right now. The actual interfacing and programming of the Arduino or similar has already been basically done from what I can see, it’s the sensor design that’s causing the pain at the moment, as it’s a hostile environment for electronics, or even mechanical items, due to the flow rates and potential for damage from mobile debris.



Hello, Steve.

I don’t think the trapped column of air would have a fixed volume, but the number of trapped molecules should be constant for short time scales. (For long time scales I think you might have to worry about the air dissolving into the water.)

To build a theory about the pressure of the air trapped in the tube, I think you’ll need these three pieces:

  1. The pressure of a fluid (such as air or water) is higher in the bottom parts of the fluid because the bottom parts of the fluid needs to have enough pressure to counteract the force of gravity pulling the fluid on the top. This is the effect that allows us to use pressure to measure depth, and you can learn more about that here:

  2. The trapped air can probably be described by ideal gas law: … degas.html

  3. Inside the tube, at boundary between air and water, I think the water and air pressure need to be equal (if one pressure were greater than the other, the boundary would move).

I’m probably missing something here, but I think if you apply all these laws then you can find the air pressure inside the tube as function of atmospheric pressure, temperature, water height, and the amount of air that got trapped (which depends on the pressure and temperature on the day when the air was trapped).



In addition to air dissolving into the water, but you will also have to worry about bubbles, splashes, air leaks, stuff growing inside the tube, and so on. I doubt that this technique will work without recalibrating the tube every day or two. What seems hard about the bubbler technique? The only extra thing you need is the aquarium pump, and then you will not have to worry about any of these other issues.


Hello, Steve. Any updates? Did you get a depth sensor working? --David