Photo: David Schneider When Appliances Attack: A single stuck valve led to a leak that slowly but relentlessly damaged my home so thoroughly it had to be gutted and rebuilt.
You’ve seen it in the movies—the protagonist inexplicably blinks awake from deep sleep because some silent but menacing force threatens. Something like that happened to me early one Sunday morning not long ago. And as soon as I stepped out of bed, I knew things were going to be bad, because the floor of my second-story bedroom was covered with water.
It didn’t take long to identify the source as I splashed down the hallway: the washing machine. An inlet valve had gotten stuck in the open position after we put in a load late the previous night. Eventually, the door of this front loader gave way. For several hours, water sluiced from our second-floor laundry closet onto just about every horizontal surface in the house—and quite a few of the vertical ones, too.
Fast forward six months. To fix the water damage, the interior of my house had to be taken apart and put back together. I decided that I never wanted to go through that ordeal again. But what would be the best way to protect the house from plumbing disasters? And could I do it without opening my house to another sort of threat, one from Internet of Things hackers?
One measure I took was a simple one. Scorning the cheap plastic catch pan under the washer—which did nothing to help on that fateful night—I put in a steel tray that lines the entire floor of the laundry closet.
My next bit of insurance was to install a valve with a mechanical timer [PDF] on the feed line to the washing machine. This closes automatically 2 hours after being opened. So most of the time the water valve feeding the washer is closed.
But what if all that failed—or if there was a water leak from some other source? This called for active electronic measures.
Ironically, I had built a device that monitored water flow in real time not long before. But that system wouldn’t have detected anything anomalous because it was designed to look for anomalously large water flows. And the flow that flooded my house wasn’t abnormally high—it was just in the wrong place. A simple audible water alarm would have done the trick, and I did buy a few of those, but they don’t help if nobody is home to hear them. The solution, obviously, was to install a system that would automatically block off the main supply line should water ever overflow onto the floor.
A little scouting online revealed no shortage of such systems available for purchase. But they had two drawbacks. First, many were part of network-based home-automation systems. I really don’t like the thought of hackers in Eastern Europe messing with my ability to take a shower. Also, these systems were rather pricey, costing much more than what the relatively simple hardware seemed worth to me. So I set about putting together my own flood-prevention system.
It wasn’t difficult because, well…I cheated. Instead of building the whole kit and caboodle from scratch, I decided to modify an inexpensive wireless alarm (US $29). This accepts radio signals from various kinds of sensors that transmit on 433 megahertz. For my house, I deployed four water sensors ($20 each) at strategic locations around my house.
The only other component I needed to purchase was a motorized ball valve ($67), which I had a plumber install when he was visiting to fix the water heater. This valve is actually quite nifty. It has a manual override knob and stores energy in a capacitor, allowing it to operate when power is removed. When you apply power, it shifts from open to closed, and when you remove power it goes back to open. Internal limit switches ensure that the motor is powered only when changing positions.
So all I needed to do was to make the wireless alarm trigger the motorized valve. I combed through my boxes of leftovers from various other projects, where I found an Arduino Duemilanove looking for a new home, a 12-volt wall wart power adapter, an LM317 voltage regulator, and a 5-volt relay.
The 12-V wall wart powers the wireless alarm and the LM317, which I configured to output about 9 V, which then supplies the Arduino. I used the LM317 to drop the supply voltage, because while it’s acceptable to feed 12 V directly to an Arduino, the onboard regulator gets uncomfortably hot. The wall wart also powers the ball valve when the 5-V relay commands it to close.
The wireless alarm has four red LEDs, each of which light up when a signal is detected. I connected one side of each of these LEDs to four of the Arduino’s analog-input pins. The voltage on the anodes drops to less than 3 V when an alarm is triggered. So the Arduino simply polls each of the four inputs constantly to see if any of them is reading under 3 V. If so, the Arduino energizes the 5-V relay.
Skeptics will point out that my fail-safe will itself fail if my house loses power. Yes, sure, but I’m not too concerned about that. The bigger worry I had when I put this system together involved where to place the sensors. If I put them too close to sources of water, say, a tub or kitchen sink, they might trigger from a simple splash. So I tucked them in places where only a significant spill would appear. But I suppose a true water leak could develop with the water flowing in such a way that it missed a sensor. Even so, I do sleep better at night knowing that an Arduino is watching over me.
This article appears in the April 2017 print issue as “Hold Back the Tide.”