Raspberry Pi Clapper

By Lucy Hattersley. Posted

Your wishes fulfilled at the clap of your hands? Nicola King applauds a very clever creator

Ash Puckett thought her life could do with a little simplifying, so she came up with a thunderclap of an idea, as she recalls: “I rolled out of bed one morning, clapped my hands, and remembered I don’t have clap-powered lighting.

This project first appeared in The MagPi issue 80. Sign up to our newsletter to get a free digital edition every month, or subscribe to The MagPi and we'll deliver it direct to your door.

What better way to remedy Ash's situation than to create my own Raspberry Pi Clapper?”

What better way indeed? Ash then took a Raspberry Pi, along with a USB microphone, and created something elegantly simple, but useful at the same time. Amazingly, the entire project was conceptualised and completed in one day, then made into an online tutorial.

“The challenge is in creating a guide with flexibility,” she reveals. “I wanted to create a starting point for anyone with a similar project in mind. Whether you want clap-powered music or a clap-powered garage door, there’s a common foundation they all share, and I wanted to provide that.”

 The Clapper device before a clap

 The Clapper after a clap

The Clapper: quick facts

  • Claps are detected using Nikz Jon’s pi‑clap script.
  • You can follow Ash’s howchoo tutorial here.
  • The PyAudio library is used to detect sound from a USB mic
  • You could trigger many different items with a clap – use your imagination!
  • Ash’s other Pi projects include a smart alarm clock and a music-streaming device

Your clap is my command

So, how does it work exactly? “The Raspberry Pi is programmed to listen for claps using a USB microphone,” explains Ash. “You can use this to trigger custom events. Pretty much anything you can control with Python can be manipulated using the power of clapping.”

The possibilities, in terms of what you can control, are vast. “I’ve been able to control an LED, initiate some funky tunes, and run a few custom scripts. The proof of concept has been demonstrated – from here it’s a matter of imagination,” says Ash. “If you can control it with a Pi, you can control it with claps. This includes home automation using relays, controlling smart kitchen appliances, and lighting.”

Ash used the Raspberry Pi for her make because, “I knew from experience the Pi was more than capable. You can really take advantage of the GPIO pins to create some awesome projects. I wanted to use something that could handle a complex project, if desired. […] The Raspberry Pi is perfect for this kind of creative endeavour.”

Inspired yet? Ash has received some very positive feedback from the Pi community: “I’ve also seen people come forward with their own Clapper project ideas – which I adore. Plenty of people have proposed their own modifications, recommended specific hardware, and provided new avenues for Clapper projects to take root.”

She adds:

“Many people have sound-activated technology on their minds. It’s not surprising – almost everyone has a voice-activated assistant in their pocket. As people realise they can use audio-based control for their Pi projects, we’ll see a surge in those ideas. The Clapper project is just a small component of that movement.”

Handy… crafter

As to the future, Ash has plans aplenty in terms of what she hopes to develop.

“I’ve got a whole list of Raspberry Pi projects ready to go – from home security systems to an automated greenhouse. These projects will use the Raspberry Pi as a centralized control system that can be remotely accessed and controlled. You can follow me on howchoo to keep up with my latest Pi projects. And you better believe that if I can power them with claps, I will.”

The simplicity of the Clapper arguably makes it a very appealing project. Give it a go yourself, or see what other clapping-connected ideas you can come up with! Send us your projects @TheMagPi on Twitter or email magpi@raspberrypi.org.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.