Main Content

Home Assistant ESP32 Wireless Sump Pit Level Monitoring IoT

Monitor the level of a basement sump-pit and trigger notifications/alarms if the level becomes too high

Background
In a previous project, I had configured a raspberry-pi 5 to host Apache which served up the temperature of the Pi’s CPU for my Home Assistant Machine to scrape and report to the dashboard (https://www.hackster.io/Tom-DeCircle/home-assistant-rasperry-pi-5-custom-sensor-9a4101). This project should be a bit simpler on the software end as I’ll use an ESP32-C3 from Seeed Studio to host a web server which reports the distance of the water from an Ultrasonic sensor in my basement sump pit. I’ll then get Home Assistant to scrape the page and show the data on my Home Assistant Dashboard.

Theory of Operation
Our sump pit works by collecting water from the drain-tile that surrounds the exterior of our house’s foundation and then pumps the water through PVC pipes out to the back of our property. If the pump ever fails, the basement could flood in the event of extended or extreme precipitation events outside. We currently use a water alarm located at the top of the pit which will trigger a siren and a phone notification in the even that water completes it’s circuit. To add another layer of security and to create a smarter home, I’ll add the ability to monitor the water level of the sump pit and report the information to the Home Assistant Dashboard.

The HC-SR04 is well suited for this application as it measures distance to an object through ultrasonic pulses. The module does some on board signal processing before it returns an echo signal after being initialized by the trigger signal. The echo signal pulse-length corresponds to the distance an object is from the sensor. The below image shows the Trigger signal coming from the ESP32-C3 pin D4. The length of the Echo pulse on ESP32-C3 pin D5 encodes the distance to an object. The longer the pulse is, the farther away the object is.”

Link to article