Water Level Sensing for outdoor plastic water tubs? - Page 1
Forum section: electronics / projects

author: victorhooi
author_rank: Regular Contributor
timestamp: September 02, 2024, 04:39:46 am
content: Hi,I have some open white plastic tubs with carnivorous plants on my balcony, and I need to monitor the water level in them (photo attached):I'm trying to keep the water level in them >= 30mm if possible. (At first, it will just be for alerting - later on, I'm going to try to link it to a drip irrigation and/or misting system)This is an an exposed outdoor balcony - I can have a waterproof control box somewhere, with a Raspberry Pi/Arduino/NUC, but it may be some distance (e.g. 1.0 - 3.0 meters) to where the sensors are.I'm looking at a few different types of water level sensors, and confused as to which would be best here:Float sensors - e.g.Atlas Scientific Short Vertical Metal Float SwitchUltrasonic Sensors -TI Paper on Liquid SensingCapacitative Pads - e.g.Grove Liquid Level SensoreTape Sensors - e.g.Milone eTape Liquid level sensorsPhotoelectric Sensors - e.g.DFRobot SEN0205Firstly, I'm not sure which of these would do best at these low water levels (e.g. 0mm up to 50mm).Secondly, I'm not sure which of these will do best outdoors, exposed to the rain, UV, and possibly a bit of dirt?Thirdly - although this may be surmountable - is the larger distances between the sensors and the waterproof control box.The Grove sensor above looks pretty good - however, it's I2C - so I'm guessing I might hit some kind of distance limitations? I was thinking I could use theQwiic Differential I2C boardsto try to extend the distance? (But then I also need to figure out a way to waterproof those boards, and the both the JST-SH and RJ45 connectors, since it will all be outdoors).Modbus (RS485) might be better for the distances - however, most of the Modbus sensors are quite expensive (e.g. > USD 100 per sensor), and seem more designed for every larger tanks full of petrol, oil, or other harsh chemicals (i.e. they're over-engineered for just water - and also I assume for very large volumes, and so may not do well at 30mm of water in a small plastic tub).What do you guys think would be a good solution here?Thanks,Victor

author: inse
author_rank: Super Contributor
timestamp: September 02, 2024, 05:09:35 am
content: If you only need to maintain a certain level range (which I assume is sufficient for your application), I would suggest the first solution with the float switch.If you take two of them you can distinguish three levels: too low - OK - too high.They surely would be the simplest and most reliable solution.If you’re into DIY, you could experiment with a hydroponics water level indicator and photo interruptors…

author: tooki
author_rank: Super Contributor
timestamp: September 02, 2024, 07:25:42 am
content: You got most of the important measurement methods. The one major measurement method that you left out is pressure sensing, which is one of the most widely used. (You also didn’t mention ultrasonic and optical distance measurement, which are less common.)When I was finishing up my electronics technician education, my class worked on a project about water level regulation, and I was in the group that did the level sensing. We ended up going with pressure sensing. If you use one with an analog output, you can have the sensor at a distance with no problem.We tried the eTape, too, and while it’s actually really neat, it is delicate, and the top of the tape is not waterproof (water must not get into the opening at the top, but air needs to be able to move in and out). In a sense, they’re actually a really weird shaped pressure sensor.But as inse said, if you only need binary sensing, a float or that dfrobot optical sensor would likely be easier. There are also pressureswitchescommonly used in household appliances, maybe one of those is for the 30mm depth you need.

author: victorhooi
author_rank: Regular Contributor
timestamp: September 03, 2024, 04:52:09 am
content: @inse - Got it, I can try with float switches. You're right in that I just need to make sure the water level isn't too low (i.e. binary output is fine).Can I ask why you'd prefer float switches here? Are they just more reliable than the other methods?Would a simple stainless steel float switch like this one work well?https://atlas-scientific.com/float-switches/short-vertical-metal-float-switch/(I'll still need to find a way to fix these to the corner of the container - not sure if waterproof duct tape would do it...lol. Maybe some kind of right-angle bracket?)Also, if I'm going to be reading these from say the GPIO pins on a Raspberry Pi or Arduino - I've read I'm going to need some kind of protection, right? (e.g.hereorhere).What sort of pull-up resistors would I need to add for the above float switch? And how would I handle the issue that the long leads act as an antenna?I might have 2-3 meters between the waterproof box and the white tubs - and also, there's maybe 5-10 tubs:@tooki - Ah, I didn't realise about pressure sensing. Do you think that might be worth trying here? If so, what sort of pressure *switch* would you suggest?I think I already had optical sensors (DFRobot SEN0205), and I added a short link to the TI paper on ultrasonic sensing (but I don't know of any good recommended sensors here).And thanks for the note about eTape - I thought it looked pretty nifty - however, I didn't realise about the top not being waterproof, but also needing airflow - so it might not be suitable for this sort of exposed/outdoor application.

author: inse
author_rank: Super Contributor
timestamp: September 03, 2024, 05:16:12 am
content: I would simply prefer the most simple solution - no over engineering.Fix the level switch to the container with a right angle bracket, duct tape does not last long in sun light.Using a 1k pull up should deliver a robust signal and two serial diodes to Vcc and GND protect against ESD.Check first if the level switch meets your demands before going into series production.

author: wobbly
author_rank: Regular Contributor
timestamp: September 03, 2024, 07:23:45 am
content: Just make sure the plants don't grow too close to the float switches and jam them in the wrong state.

author: Irilia
author_rank: Regular Contributor
timestamp: September 03, 2024, 08:21:14 am
content: This type is possibly the most simple for this applicationLevel Sensor, Non-contact Water Detection Sensorhttps://a.aliexpress.com/_EyhCVjL

author: inse
author_rank: Super Contributor
timestamp: September 03, 2024, 11:45:34 am
content: I had such a capacitive sensor fail when it got wet on the sensing side and would not turn off.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 03, 2024, 03:12:26 pm
content: Another option is to simply measure it's weight with a loadcell.A float switch is also a simple option. This can either be combined with a timer, or the switch can have a fixed hysteresis.There are also a bunch on:https://hackaday.com/blog/?s=water+level+sensorI like the latest, in which the arm of a float switch is used with an angle sensor. All electronics can be put in conformal coating or putty.Also, if you ever go full automatic, then also consider what happens if a sensor, pump or a valve fails. At a minimum I would have two valves in the main water supply, or have an inherently limited amount of water such as from a rain water barrel. (You can top off such a barrel with water from another source of course).

author: tooki
author_rank: Super Contributor
timestamp: September 03, 2024, 06:30:07 pm
content: Quote from: victorhooi on September 03, 2024, 04:52:09 amDuct tape? LOL no. (There do exist tapes for outdoor use. But they're not to ghetto-rig things, and require clean surfaces that mate properly.)You need a bracket, and understand that one half of the float switch shown has to be in a dry enclosure. You can't just have the wires floating in the wind!This style of float switch needs to be perpendicular to the water, so the float moves only up and down along the shaft. Other kinds exist that move in different ways, like the angle-sensor based one mentioned above.Quote from: victorhooi on September 03, 2024, 04:52:09 amAs I said, pressure sensing is extremely widespread. (Your dishwasher and washing machine are practically guaranteed to contain one or more of them each.) In older appliances they mostly used on/off pressure switches, while newer ones use pressure sensors that let the microcontrollers control fill level dynamically.Pressure sensors are very sensitive (in the good sense), and have the cool property that you can mount them a bit away from the water itself, with the sensing hose connecting the sensor to the water.For water level sensing, IIRC you want a differential pressure sensor so that changes in ambient air pressure don't affect the measurement, so you just get the pressure increase caused by the water. (Basically, the water traps a column of air in the hose between the sensor and the water. As the water level rises, it compresses said column of air, increasing its pressure relative to ambient.) I don't have the part number at hand of the sensor I used, but I can dig it up if need be.I don't have any specific recommendations for pressure switches since I've never actually used one in a project. You'd want one intended as a replacement part for a washing machine; industrial pressure sensors are quite expensive.

author: inse
author_rank: Super Contributor
timestamp: September 03, 2024, 07:07:30 pm
content: The type mentioned seems to be completely sealed at the electrical side and as it’s only operated at 3.3/5V the wires surely can be left dangling around.Heat shrink tubing provides more than sufficient isolation for the extension wires.

author: tooki
author_rank: Super Contributor
timestamp: September 03, 2024, 07:16:50 pm
content: Quote from: inse on September 03, 2024, 07:07:30 pmI wouldn't want to rely on the insulation (especially the woven kind, even if it is impregnated) for long-term outdoor use.

author: Irilia
author_rank: Regular Contributor
timestamp: September 04, 2024, 12:09:19 am
content: Quote from: inse on September 03, 2024, 11:45:34 amNever had this experience. you can modify the sensitivity, but otherwise I'm really surprised they didn't work as expected.

author: Poroit
author_rank: Frequent Contributor
timestamp: September 04, 2024, 04:23:47 am
content: Float Switches best suit your application.Two Sydney based mobs below;https://www.dwyer-inst.com.au/Product/Level/LevelSwitches/Float/SeriesF6-F7Horizontal?Query=level%20switcheshttps://temperature.com.au/SinglewithTails?ProductName=74

author: floobydust
author_rank: Super Contributor
timestamp: September 04, 2024, 04:47:48 am
content: I think plant leaves and roots will find their way to any sensor used inside the tub. That makes floats/electrodes etc. a poor solutionOutside the tub, capacitance sensors can work, but they also like to fall off. Ikea containers are usually recycled PET and I'm not sure what glue works good for that. Falling off will cause catastrophe with overfill, use a timeout for filling max. xx seconds. You can also look at home aquarium water level sensors.Popular are theXKCTechnology sensors offered on Aliexpress/Amazon etc.XKC-Y25is cheap and the manual has some ideas for mounting. Limitation I think is the sensor is 28mm dia. so minimum liquid level sensed would be around that but not sure.

author: Irilia
author_rank: Regular Contributor
timestamp: September 04, 2024, 06:09:45 am
content: Quote from: floobydust on September 04, 2024, 04:47:48 amThanks to confirm what I was thinking, sensor don't go together, ultrasound sensors could work but the space is very limited for this type of sensor.A simple Timer is probably the safest, if you have a constant flow. I recommend to have an or something to track the water level and averting you if the level of the water become to low.

author: inse
author_rank: Super Contributor
timestamp: September 04, 2024, 08:01:08 am
content: It’s all not maintenance free, I guess.If the plant gets too close the capacitive sensor, it will be disabled as well.

author: eutectique
author_rank: Frequent Contributor
timestamp: September 04, 2024, 12:36:41 pm
content: Drill a hole or two in the wall of the tub at the desired water level. Every 2-3 days feed the tub with water for 10-30 seconds. The excess will be discharged through the hole.Improvement:-- Run a pipe from the discharge orifice into the next tub positioned 20 mm below the first one.-- Scale.Further improvements:-- Build a weather station which will regulate the frequency and duration of water supply based on temperature and humidity.-- Create a web page, publish the graphs and a live video.

author: inse
author_rank: Super Contributor
timestamp: September 04, 2024, 02:31:17 pm
content: Actually a brilliant idea to connect all containers in daisy chain with a hose entering and exiting at the desired water level. The containers would not need to be stacked, same level or lower is possible.And the excess water is collected in a pot and there the level is sensed and controls the fresh water inlet.Pot to be drained at regular intervals or pumped to the first container.

author: Randy222
author_rank: Frequent Contributor
timestamp: September 04, 2024, 04:50:19 pm
content: Plants and bugs almost always clog mechanical means.If you did something like a probe (two wires close to each other, float, etc), water contact could be indicated using logic in the MC. The probe should be put in a perforated tube and then tube wrapped with some type of fine mesh to keep bugs and plant out.Moving parts like floats will eventually fail.Is too much water in the bucket also a bad thing?

author: IanB
author_rank: Super Contributor
timestamp: September 04, 2024, 05:13:28 pm
content: A long time ago, water level sensors might have used stainless steel rods of various lengths dipping below the water surface. When a rod pokes below the water line, conductivity between rods indicates the presence of water. A very similar principle is used in soil moisture sensors for house plants. In fact, a soil moisture sensor might possibly be repurposed for this task.

author: tooki
author_rank: Super Contributor
timestamp: September 04, 2024, 05:21:32 pm
content: Quote from: IanB on September 04, 2024, 05:13:28 pmAs long as it's one that is properly designed and uses AC. The cheap ones that use DC don't survive very long.

author: floobydust
author_rank: Super Contributor
timestamp: September 04, 2024, 08:21:45 pm
content: Ikea's plant watering alarm Chilipulver used two SS electrodes, one on each side of a thin tube. It's battery operated and not relevant for OP but the format - a thin pen with electrodes on the side looks good - if inside a larger tube (well) which prevents plants from touching.(I bought one but it did not work - bad firmware it never alerted to dry soil and the plant almost died. It's shit and discontinued now I wonder why lol. It had a boost-converter and ARM MCU).Connecting all plant containers with a daisy chain tubing, I found a bad idea as small insects could traverse between them and spread. Spidermite everywhere.That starts to look like hydroponics?

author: victorhooi
author_rank: Regular Contributor
timestamp: September 06, 2024, 03:51:47 am
content: Thanks everybody for the suggestions/ideas - I've tried to answer them all, and added some follow-up questions. When I figure this out, I'll make sure to update with photos of the setup, and let you know if it works...My main concern actually is if I use the float sensor, I'm a bit worried about frying the MCU - @inse mentioned a 1K ohm resistor - and using two diodes - does it matter what type? and where would you put them? I'm going to look at the other approaches as well.@floobydustQuoteThe plants are actually in individual pots usually- so the white tubs just have water, with some dirt that might have leaked/fallen out.Some plants do get a bit bushy (which is a good thing! As in, I love plants, and I want them to grow well, haha), but it shouldn't get *too* overgrown*. Do you think that's still an issue?@ IriliaQuoteUnfortunately, all of these tubs are outside (since carnivorous plants need *lots* of sunlight - and also, they plants generally do much better outdoors. Many of them originate from bog conditions in the US Pacific Northwest).Hence, I get a lot of water loss via evaporation (although that evaporation loss is also what boosts the humidity around the plants, which is what they crave), but then also some top-up through rainfall. Hence why I wanted a sensor on the tubs, so I know when they're empty, and so I can link it up to a drip irrigation system.@inseQuoteThat's a clever idea - however, I have a *lot* (> 20) of tubs, and I think it would be also very difficult to get them all in some decreasing height or have it all flow neatly like that.@Randy222QuoteAs mentioned above - the plants themeslves are in black pots, which are then sitting in water in the white trays.However, there's obviously dirt etc, which can and does get in the water.For say, a stainless steel float sensor (e.g.PLS-045A-3VAIthat one - how sensitive is this to dust/dirt or clogging up?)@Randy222QuoteYup, it is unfortunately. If the water level is too high, it causes root rots for the plants. The idea with carnivorous plants is that you sit them in water, and the media wicks up water via capillary action so that the growing media is wet but not waterlogged. Hence why I try to keep say 2-5cm of water in all of my trays. But obviously with outdoor weather in Australia, it means they can dry out in a few hours (on a sunny day), or may overflow (with the rains etc.).@ IanBQuoteI did actually think about using those wireless water leak detectors - apparently you can attach wires directly to the electrodes on them, and then dangle those wires into a container. Then you would flip the alert around so instead of detecting a water leak, it would detect the absence of a water leak (i.e. to indicate the container is dry).https://www.reddit.com/r/homeassistant/comments/zwouod/could_you_submerge_a_leak_sensor_and_use_it_as_a/https://www.reddit.com/r/Aqara/comments/13f1ych/know_if_water_tank_full_with_leak_sensor/https://www.reddit.com/r/homeassistant/comments/vxf6t1/low_water_level_detection/https://www.reddit.com/r/HomeKit/comments/ibogq3/aqara_water_leak_sensor/https://www.reddit.com/r/HomeKit/comments/iaei09/water_sensor_and_then_ifttt/However, I was a bit concerned that this would drain the battery on those sensors quickly (since they're designed to detect water leaks, and likely assume those are rarer), and also, it only detects when completely dry - whereas I ideally want to top up the water wel before it gets to that point - as by that point, the plants are already suffering).The soil sensor idea is interesting - however, I don't know how well they'd do with constant submersion in water....In fact, most of the soil sensors out there tend to fail after 6-12 months, I assume due to corrosion - apparently the salts etc in soils mixed with water are very bad for electronics.Also, I water with RO (reverse osmosis) water, so this is what will be in the tubs. I've heard this can be incredibly corrosive to metals - but perhaps stainless steel should be ok?

author: Irilia
author_rank: Regular Contributor
timestamp: September 06, 2024, 04:08:59 am
content: You can use 2 or more temperature sensor, with one above the water on one below the water you just have to use the difference to know if the third or more sensor is above or below the water. Will not Block and you can very easily know if something is wrong

author: IanB
author_rank: Super Contributor
timestamp: September 06, 2024, 04:12:00 am
content: Quote from: victorhooi on September 06, 2024, 03:51:47 amThe worse thing is that RO water will have low conductivity, so it might not work so well with a conductivity sensor.I don't think corrosion would be much of an issue. Pure water is inert: it doesn't react much with anything. (For instance, if you put iron in boiled RO water in a sealed container, it won't rust.) It is additional things dissolved in water that make it more corrosive, like salt or oxygen.