A sound-activated device that gives you more freedom than any store-bought clapper could wish for
Posted 06.15.2012 at 12:15 pm
Clap On, Clap Off
One night, I was trying to draw a circuit on a chalkboard, but it became too dark to see. The next day I bought a new lamp, only to find that the board gave off too much glare. I needed a light I could easily adjust. I could have just installed a dimmer, but where’s the fun in that? As an engineer, I like to do projects that use a little electronics, a bit of mechanics and some software.
My friends and I had been talking about those old ’80s commercials for the Clapper, and it occurred to me that I could make a circuit that would dim the lights when I clapped my hands. The one I made is relatively inexpensive and a lot more functional than the original—it’s even got a Party mode that can pulse the light along with the beats of the music from my stereo.
Pretty much any lamp will do, but a DC-powered LED one works best. Direct-current lamps run at around 12 volts, one tenth the power of regular AC lights, which also require different circuitry and carry the risk of a nasty shock.
Close-Up on the Clapper Circuit: Be sure to wear safety goggles while building the circuit. When working with solder, avoid inhaling fumes and wash hands thoroughly afterward. Greg Maxson
THE CIRCUIT BOARD
- A Darlington transistor manages brightness by switching the light off and on an imperceptible 40,000 times a second. The longer the “on” duration, the brighter it looks.
- An Electret condenser microphone, like the one in a cellphone, picks up the claps you intend—and the clangs, bangs and crashes you don’t. Note: You’ll need to ground the mic’s negative lead and connect the positive one to the operational amplifier input. If the leads aren’t labeled (+) and (–), check the product manual to see which one is which.
- The sound is amplified up to 100 times in the first stage of the op-amp, filtered to weed out highfrequency noises like a vacuum cleaner, and sent to the comparator stage, which distinguishes claps from non-claps by comparing the volume and pitch with a preset threshold.
- The wheel on the potentiometer controls the gain, or amount of amplification. Turn it down if the device is too sensitive.
- The signal moves from the op-amp to the microcontroller, the brains that run the clapper software. Once a clap is registered, the microcontroller listens for its next cue. A second clap within 1.2 seconds toggles the lamp on or off. Three claps start the lamp ramping up to maximum brightness and then back down to its dimmest point, until a fourth clap locks the light level in place. Four consecutive claps puts the device in Party mode, modulating the lamp’s brightness to the beats from your speakers. (To stop Party mode, you’ll need to flip a switch on the circuit board or the wall switch.)
Download WinAVR for Windows or AVRDude for Mac, both of which are free, to get the clapper software from your computer to the programmer, which sends it to the microcontroller via a six-pin ISP connector.
Time: 5 hours
Difficulty: 3 out of 5
For a full list of illustrated instructions, click through to the next page.