Water management in a rainwater well-coupled system: monitoring potable water quality

Hi HA community,

I’m currently gathering all bits and pieces to add rainwater collection and treatment to my home. I’m looking at monitoring water quality before and after successive filtration stages. This planned rainwater collection system will consist of 2x5500lt+ rainwater holding tanks, a backup well connection for dry season, several stages of filtration (including Ultrafiltration and Ultraviolet) upstream from a 3000lt roof-mounted concrete tank. Have a look at the attached jpg’s (from SGV files) to get a better idea of the system…

Tank water level, pipe pressure, flow and even tank/well temperature will be monitored at several points of the process using cheap and readily available sensors: Ultrasound sensors (8USD), DN8 transducers for water pressure (7USD), DN25/DN32 Hall effect flow meters (9USD) and DS18B20 (2USD) respectively. I’ll be using Wemos D1 Mini Pro’s (4USD), as these are compatible with both 5V and 3.3V sensors. The sensors will be set for MQTT integration in HA. Sonoff POW’s (8USD) will be connected to the pump to both monitor power and shut off pumps and UV filtration (when not in use for more than 2 hours). I’m trying to avoid using expensive and unreliable solenoids…

I will integrate this in HA using both the regular UI and @pkozul’s fantastic floorplan GUI. All sensors will be monitored via InfluxDB & Grafana with outputs on custom State Cards and/or panels. HA, MQTT, InfluxDB & Grafana are hosted on a Synology NAS. These components already work well with Tasmota flashed Sonoff POW’s and temperature/humidity sensors. Milight lamps, CCTV cameras and media servers are also part of the present HA setup (I will describe my setup more fully in another post, if there is any interest).

Now, what is missing from this system is some way to monitor water quality. In a best case scenario, this would be done at different stages of storage (well, rainwater tank, post-filtration tank). At the very least, water quality monitoring is needed in the potable water holding tank. Adding a few in-tanks PH sensors (15USD) will be relatively easy in spite of their short lifespan, but that info would not be enough to indicate whether water is potable at the tap.

What other sensors is the HA community using to monitor water quality? Maybe, some aquariophiles/ fish tank buffs can chime in? The only info I could find on here was on a great thread by @cowboy: Going to next level of Aquarium Automation...who's with me?

On that thread, I’ve noted the use of Seneye sensors, but these cost 400USD (the price of my current entire sensor setup) and do not fill the task at hand completely. Libelium offers monitoring options, but this looks like an industrial (expensive) solution. I’ve contacted them anyway, just in case their monitoring solutions will not leave me bankrupt.

In an ideal world, I would need sensors for Acidity (pH), Turbidity, Oxidation-Reduction Potential (ORP), Dissolved Oxygen (DO), Conductivity (Salinity), Calcium (Ca2+), Iodide (I-), Chloride (Cl-), Nitrate (NO3-), Magnesium (Mg2+), Sodium (Na+). Considering there is both well and rain water connected to the system, data on these could also be useful: Nitrite (NO2-), Perchlorate (CIO4-), Fluoroborate (BF4-), Bromide (Br-), Chloride (Cl-) and Fluoride (F-). My max budget (300USD for a single station) probably does not allow that type of setup…

TDS tester units (6USD) are readily available, but I cannot find any cheap standalone sensor that could do this job. Turbidity (25USD) are available and seem easy to integrate. ORP (74USD), DO (199USD), Ammonia (90USD), Bromide (215USD), Fluoride (215USD), Chloride (215USD), Calcium (215USD), Sodium (215USD) sensors from China are available under the Bante brand.

Has anyone used any of these sensors or others available at an affordable rate? Any pointers in the right direction would be much appreciated…

Update on the Libelium solution:
It looks like the Libelium solution to monitor Calcium, Chloride, Iodide, Nitrate, DO, ORP, Conductivity and pH will set you back 2500 Euros, ouch. Anyway, here is the link to their site: http://www.libelium.com/new-ion-sensor-probes-pro-ammonia-magnesium-nitrite-sodium-nitrate-lithium-fluoride-chloride-iodide-cupric-bromide-silver-smart-water/

There is also a DIY Dfrobot solution called KnowFlow that looks more promising with a price tag under 200USD with 3 sensors.

3 Likes

Wow…and I thought my water management goals were ambitious! I’m impressed with your objectives and planning of your “little” project and will be watching and following closely. :+1:

Please do continue to share your progress. I’ll be very excited to see how you continue…it looks very cool what you’re doing. :grinning:

1 Like

Alright, I think DFRobot is the place to look for DIY water quality sensors. I’ve just ordered TDS sensors (12.90$), Pro PH Sensors (56.90$) and Turbidity sensors (9.80$). These should already give a good general idea of water quality.

I’ll try to set these up with ESP’s before moving onto DO (169$), ORP (69.05$), EC (69.90$) and, maybe, ion electrolytes at a later stage.

I’ll post back here when things are working to try and help others. HA users with experience with such sensors are welcomed to chime in and give tips…

1 Like

Got some time to mess around with @pkozul’s great floorplan implementation. Got a special floorplan GUI sorted for water management while waiting for deliveries of the bits & pieces I need. Here is the SVG file.


Let me know what you think!

3 Likes

hello ,

were you able to incorporate TDS and PH sensors i also need to integrate my ph and tds sensors in a hydroponics project

Thanks in advace

1 Like

Hey @monkey-house, did you finish your project?

Would you mind sharing your schematics and related setup?

Thanks

I’ve hit a few brick walls, e.g.: ph sensors needing constant recalibration, ultrasound sensors being unreliable, pressure sensors not being easily implemented…
I’m looking for alternative ways to do the same, such as using pressure to measure water volume or even simple contact sensors rather than ultrasound.
Ideally, I’d want to rely on several ESP’s tunning ESPHome or similar, including some that are solar powered for remote tanks.
Like all of us, I need to clear time!

1 Like

ok thanks, very interesting. I am looking to monitor the quality of water in our borehole and I want to see what sensors I should be using… any advice you can give in terms of reliablity, accuracy etc for ph and EC would be greatly appreciated.

Thanks

@monkey-house even the most expensive PH instruments require constant calibration. Have you tried just using PH Strips daily? Just record the result to a variable and treat it as a sensor? I do that with TDS and PH…it works for my needs and creates a usable trend.

Also have you tried these ultrasonic sensors? I have found they are very good quality and reliable.

Yup, recalibration need kind of annihilates the very need for this. I do use strips daily and that is the pain I was looking at easing.
The ultrasonic sensors I was using are JSN-SR04T. Your link points somewhere else…

1 Like

Oooops fixed the link and yes…JSN-SR04T are the ones I use. What sort of problems are you having with them?
How did you mount them?

I did not mount them after testing and realising how unreliable it was. Tested them on a bench moving a box along a meter. Will try with another unit if you confirm they work for you…

They are by far the most stable ultrasonics…well cheap ones anyway…I have used. Best $9.00 I ever spent.
Can you post a photo of your install possibly?

1 Like

@monkey-house Here’s how I have them mounted.

Distance from sensor to highest level is approximately 25cm.

I use 20mm PVC pipe which I find fits the sensor almost perfectly.

Above shows the trend over the past 24hrs for the two settling tanks shown above. At around 0730 this morning I backwashed to fill the left tank (green trendline). As it filled to overflow to the right hand tank (orange trendline) you can see at 0810 the rise in level of that tank and the subsequent rises as my solids removal system sends the waste stream to these settling tanks. There is no real noise affecting the trend…rises and falls can all be explained.

2 Likes

That looks great. Well done. How come you have negative percentage values though?

One of my tanks (rain tanks) has a height of 2.5m that cannot be measured by these sensors. Generally it should be fine as I would rather never empty them totally anyway. Comes rain season, I do like to use only rainwater rather than mixing it with well water.

I do believe these rain tanks could benefit from more precise measurements, such as pressure. Unfortunately ESPHome does not seem to have any implementation for these at the moment…

Will nonetheless try with another ultrasonic sensor I’ve got laying around…

1 Like

Negatives and >100% happen because my initial calculations were based on incorrect high level and low level value. One day I might correct it but for now it is no real problem.

Hey the specs on these say that ‘Maximum distance: 5M’ so 2.5m should be fine?
The ‘Blind area: 25cm’ is important though…is that the problem you have?

I only use water down to 500mm above empty to ensure wind doesn’t blow my tank away in storms (Brisbane is bad for big wind).

1 Like

Right now I’ve only been testing this with a meter and a box to reflect the signal. I’m getting relatively accurate readings from .23m to 1.98m only… I’m sure there are different manufacturers and I would not be surprised if you had products with different specs doing the rounds.
The 23cm blind area is no issue. Can set up a template sensor for that in Hass. The more than 2m height could be an issue unless I decide to fill up the tank before it gets empty… I do however like to drain it fully at times in dry season and use only rain in low season. Again, I may be able to account for this and have a different rule on rainy days based on the sensors from my weather station like I do with my irrigation system.
I’ve got a 2 inch thread atop the tank I want to plug the sensor in. The idea is to design a box/cover for the sensor that I can just screw in there. I could design this first then try it out directly on the tank and calibrate it then. This can be done while connected to a powerbank for now.
Ultimately, I’ll need to set up an ESP32 with solar panels to power it. Will have it in deep sleep mode and awaken at 15 minutes interval, maybe more often when filling from the well( twice a day). Also need to desolder the LED to keep energy.
Thanks for the input: I’ve now got some motivation to try it again :wink: So little time though!

1 Like

The only problem I can think of with your testing setup is not considering the ‘cone’ which needs to be clear of objects to not reflect false signals back. Cone angle is <50 degrees (which is a very good angle…I have used others that were around 90 degrees)
In the above example shown my sensor is in the exact centre of the 600mm diameter drum and when the level is @ empty the cone edges would be close to touching the sides of the drum…ie: anything less in the tank will get false echoes.

Try pointing it horizontally at the wall 3m away from a height half the height of the wall.

Is your tank 3.6m diameter? If something like that the sensor should work fine to 2.5m depth when mounted at or near the centre point of the tank.

1 Like

Hey @wellsy,

Thanks for this. I did note realise this cone of 50 degrees played a role. I assumed it was a fairly straight angle instead. This probably explains why I had issues with my testing rig.
For the actual setup, it does mean that I will need to place the sensor close to the middle of the tank below the tank ceiling. This can be annoyance for measuring a full tank with the 23cm minimum distance, but I believe I can come up with rules and automations on Hass.
Will test and get back as soon as I get a minute. Now toying with kodi, @pkozul’s floorplan and new lovelace interface…

1 Like

May I have to figure out some kind of holder for one of my tanks. Concrete 2.5mx2mx1.4m. That 23cm lost would be an issue there.

1 Like