I woke up at 6 am on the morning of my most recent birthday to a steady rain falling outside, eventually thinking to myself "you know, I don't think I've heard my sump pump run in a while." It had been a very wet and rainy couple of weeks up here in the northeast, too. After dashing downstairs through my wife's freshly built basement office and tearing off the pit lid, my fear was confirmed. The water level was nearly at the top of the pit, well above the point where the pump should have kicked on. I quietly wished myself a happy (milestone) birthday, and then swiftly ushered off to the local Ace hardware store to purchase a new sump pump.
Knowing that I had gotten lucky this time and not wanting to rely on luck again, I decided to build my own sump pit water level sensor/alarm and integrate that into my Nagios monitoring server for email/text message alerts. Sure, I could have just bought some sort of commercial alarm, but it would likely not have had all the features for which I was looking and would have been grossly over-priced. Hence I started on my journey.
The BuildThe guts of the monitor is an Arduino UNO with an HC-SR04 distance sensor. The HC-SR04 is mounted in a 2" PVC pipe that runs through the pit lid. I mounted it inside a pipe in order to protect the sensor from water splashing onto it, for obvious and various reasons. The sensor is connected with 4 wires from a CAT5e cable.
I traced the inside diameter of the pipe onto an old unused DVD case and I cut out holes for the sensor to sit on. When the clean-out is glued into the coupling, it locks the plastic mount into place. The sensor actually sits in the coupling portion and the clean-out allows me to easily access the wiring/sensor while also protecting it.
The clean-out is glued to the coupling and the coupling is mounted onto a PVC pipe. I did not glue the coupling onto the pipe because I wanted to be able to remove the entire clean-out/coupling component in the event I ever have to replace the sensor. The pipe is meant to be a semi-permanent fixture in the sump pit.
I used some expired red Sugru that I had laying around to create my own gasket which also serves to stabilize the pipe.
I didn't want to just rely on Nagios email/text alerts, just in case there was an issue with an SMTP daemon crashing or whatever, so I also added a set of LEDs - one red and one green - that provide alerting redundancy in the form of visual feedback. These were clipped and salvaged from a busted set of Christmas lights. They are hot-glued/mounted in a "common" area in the basement for ease of viewing.
Obviously the lights don't do any good if you aren't walking through the space, so I added one final piece of alerting redundancy and that is in the form of a buzzer.
Where the wiring all comes together is ugly - I admit. The board mount is also primitive. I would have preferred a nice plastic box where I could route wires, but that didn't happen. I chose to re-saw a 1/4" strip of some scrap 2x3s on my bandsaw and then mount all the components onto it. The mount is zip-tied to my computer rack.
All the GNDs/- are wired/soldered together and then protected with a crimp cap. The constant 5v+ are also soldered/crimped together. I did this because I didn't have enough connections on the board itself. It's not elegant by any means.
One final note here on the HC-SR04 sensor: I wasn't sure how accurate/consistent it would perform in a pipe like this, so I setup a test rig with a fixed distance and just let it run while I collected the data for analysis. I gathered over 75,000 data samples and I found it was outside the acceptable range (+/- 2CM) on less than .03% of the readings.
24 / 75516 = 0.00031781344351
0.00031781344351 = .03%
.03% error is good enough for me in this case.
Comments