This project is a simple sketch reading 2 sensors and publishing it to an MQTT topic:
- a DHT combined humidity and temperature sensor
- a JSN-SR04T ultrasonic distance sensor
To have an idea how much water is in the tank. It helps to identify a dirty filter when no or little additional water is measured after rain.
I used a wemos D1 pro and placed the hardware (sensors and voltage converter) inside an electrical box to which I applied silicone to waterproof it. The Wemos D1 pro has an external wifi connector that I use for an external wifi antenna mounted on top op the box. The humidity/temperature sensor remains inside the box as I noticed during my initial prototypes the readings halted as the box got filled up with moist causing electrical failure. This way I can detect water leakage inside the box and hopefully prevent future failure. Too much moist has also been the reason my initial attempts with an HC-SR04 (that was put outside the box) failed as the sensors got clogged up with water. Currently I am using an JSN-SR04T sensor that I fitted in a drilled hole at the bottom of the box (see pictures) and this has been proven to be stable. The whole electrical box hangs on top of my rain well tank and is powered by a 220V powerline that gets activated each time for a couple of seconds when we demand rain water (e.g. flushing toilet or washing machine).
The readings are sent to an MQTT server. Im my case it's feeding a NodeRed dashboard, that I use to control my domotics, and an InfluxDB/Grafana setup for record keeping.
I wasn't able to waterproof the electrical box, so far this bottle seems to keep it dry: