Thursday, 23 February 2017
Raspberry Pi Water Sensor
Since I'm already using my Raspberry Pi as a radius and Amazon button server I figured I may as well start learning some hardware hacking and I've had water in the basement before so I want to know about it before it happens again...
I already had a 4 conductor wire running from my automation area to my utility room for a previously failed washing machine detector project (replaced with a Wemo Insight now fully functional)
I made 3 detection areas, 1 for fun and 2 practical...
One right under the hot water tank, one on the floor and right behind the washing machine and one inside the drain of the washing machine.
For the hot water tank I took 2 pieces of wire and stripped them bare and ran them along the under side of the tank spaced fairly close together but not touching... On either end I put in a few conductive wood screws and wrapped the wire around the threads.
I did the same thing near the floor and behind the washing machine, I had multiple wire/contacts on a single sensor so if either one gets wet it will trip the system.
The final one is a pair of bare wires going down the drain, this can tell me when the washing machine is draining in it's cycle and confirm the whole thing is still working.
On the Pi, I connected GPIO 23, 24 and 25 and a common ground which one of each of the wire pairs was connected to and tied together with a wire nut.
I then wrote a little python script that would periodically poll those GPIOs and send me an alert if one went low (was using internal pull up) or switched states for more than 10 seconds (this would stop it from toggling back and forth as it dried out, and stop nuisance alerts)
This was a super easy project and a great start to working directly with hardware...