Home automation isn’t all that new. It is just more evolved. Many years ago, a TV product appeared called the Clapper. If you haven’t heard of it, it was basically a sound-operated AC switch. You plug, say, a lamp into the device and the clapper into the wall and you can then turn the lamp on or off by clapping. If you somehow missed these — and you can still get them, apparently — have a look at the 1984 commercial in the video below. [Ash] decided to forego ordering one on Amazon and instead built her own using a Raspberry Pi.
[Ash’s] prototype uses an LED and could — in theory — drive anything. If you wanted to make a real Clapper replacement you’d need a relay or some other kind of AC switch suitable for the load. The actual clap detection software is from [nikhiljohn10] and simply waits for two loud noises. No fancy machine learning to differentiate between a clap and a cat knocking over a vase. Just a threshold and some timing.
Of course, the Pi can’t hear anything unless you add a microphone. However, it is easy enough to add a USB microphone since the Linux kernel will handle that easily. The
pyaudio library gives you an interface between code and the microphone.
We were thinking since the whole thing is a script, it would be easy to also provide some audio feedback. For that matter, you could monitor the state with an e-mail. It might be interesting to provide some other interface — like a web page — that could also switch the load on and off. Or perhaps do different actions in response to two claps, three claps, or four claps. There’s a lot of possibilities.