How you can build Home Security System

Scare intruders away with a ridiculously loud alarm

Security System

The last straw was a midday break-in right next door. For months, my wife and I had worried that our neighborhood in the Seattle suburbs was suffering from a nasty rash of home burglaries. We had toyed with getting a security system for our house but balked at the monthly fees and installation hassle of conventional systems. Then our neighbors alerted us that intruders had just busted into their home—only a few meters from ours—in broad daylight.

Home Security
Photo: W. Wayt Gibbs:: Home-brew House Guard: A microphone connected to a Wi-Fi–enabled Arduino Uno listens for the Scout’s alarms. A wireless switch turns on the siren.

I started researching DIY security systems the next day. Thanks to advances in mesh networking and Internet-of-Things standards likeZigbee and Z-Wave, the market has exploded with wireless security systems that are easy to install and expand, connected to smartphone apps, and much more affordable than their hardwired counterparts. Most of them include built-in batteries and 3G cellular radios, so they still work if the power or Internet router goes down.

As I waded through the support forums of several promising-looking systems, however, I noticed a common complaint: Their sirens are pathetic. The “siren is not loud enough” thread on Scout Alarm’s website, for example, had 156 posts from unhappy customers, along with (as yet unfulfilled) promises from the company to fix the issue by redesigning the case. It’s surprising that none of the DIY systems make enough noise to scare off would-be thieves (or include terminals for connecting an external siren). Apparently their designers didn’t have deterrence in mind.

I decided to order a Scout system nevertheless. It offered the sensors I needed at an attractive price. I liked that it works with IFTTT (If This Then That), an IoT-unifying Web-based service that I wanted to use to flash a Lifx lightbulbon my nightstand when the alarm goes off. And I had an idea for amplifying the siren to be as loud as I wanted—an idea that should work with any security system, IFTTT-enabled or not (IFTTT can be sluggish responding to a trigger, not the kind of thing you want when trying to stop burglars in their tracks). All I had to do was to build a follower siren.

It’s an idea borrowed from photography, where studios sometimes deploy extra stand-alone flashes that go off when an attached photodetector picks up the light of a flash directly attached to the camera. My gadget would similarly use a microphone to listen for the distinctive chirp of the Scout’s alarm and then send a wireless signal on my local network to turn on and off a much louder siren in sync with the Scout.

Related Article: Seabed Mining Robots Will Dig for Gold in Hydrothermal Vents

Setting up the Scout was easy. It took less than an hour to configure the hub (US $129) by using the free iOS app and to link it to a couple of entry-door panels ($69 each), several door/window sensors ($29 each), and a few motion detectors ($49 each). I connected the system to IFTTT and configured an app called DO Button to let my wife and me arm or disarm the system with our phones.

For the listener part of the project, I bought an Arduino Uno ($20), anESP8266 Wi-Fi shield for the Uno ($15), and a sound detector sensor board($11) from SparkFun. Compared with more advanced microcontrollers, the Uno is smaller, cheaper, and can run on batteries. But its limited memory later proved problematic.

I made things easy on myself on the siren side by buying Belkin’s WeMo switch ($39), which connects to Wi-Fi and can toggle power to any appliance—in this case, a 9-volt power supply for a 110-decibel Honeywell Ademco 702 siren ($23). The WeMo also comes with a free smartphone app, which serves as a handy backup in case I need to sound or silence the siren manually. Belkin hasn’t documented the TCP commands that control the switch, but helpful hackers have deduced them and posted Arduino sketches that can turn the device on or off via Ethernet.

All I needed to do was adapt that code to work with the Wi-Fi shield, and then use it as a function inside a larger program that monitored the frequency, intensity, and duration of the sounds picked up by the microphone board. Within a couple of hours, I had the chirp-detection algorithm built.

To calibrate it, I put the microphone right next to the Scout hub and triggered the alarm. The critics were right: Its cry for help is truly feeble—quieter than a phone ringing or the alarm on my clock radio. So quiet, in fact, that I wasn’t convinced the sensor could distinguish it from background noise. Removing the hub cover revealed the problem: The piezo speaker is mounted so that sound is aimed directly into the thick plastic side of the device. I drilled a hole a little over a centimeter wide to expose the speaker to the air, and immediately the volume doubled—still not loud enough to deter an intruder, but sufficient to activate my chirp detector.

Then I hit the 2-kilobyte problem: My program demanded more RAM than the Uno offers, mainly due to the lengthy data packet it had to assemble and send to activate the WeMo. Savvy developers pointed me to a function that forces the compiler to store data in the much more expansive flash memory (intended for storing programs) rather than in the Uno’s RAM. But that came at a heavy cost in speed: The Arduino took about 30 seconds to toggle the switch, when it worked at all.

Through trial and many errors, I finally worked out a way to keep the crucial data packets in RAM while stuffing most everything else into the flash. The final program loaded with memory to spare. Connecting all the pieces, I loaded up the Scout app and hit the “siren” button. Chirp, chirp, chirp…WHOOP, WHOOP, WHOOP. The big siren came on so loud and suddenly, I almost wet myself. I’m sure the neighbors heard it. And that’s the point.

This article originally appeared in print as “DIY Home Security.”