With the Sonic Sensor taking care of providing a gate
or rising edge to fire a CMOS flip-flop or counter, the sky
is the limit on what you can come up with.
For the most versatile approach possible, consider
connecting it up to a microcontroller. The firmware can
then do all sorts of things like count pulses, take averages,
monitor intervals between bursts, check the clock times
the sounds occur, route the results to buzzers, relays,
motors … you name it.
Just as one offhand example, suppose you own a
summer cabin but don’t expect to be there for several
months. You could come up with a circuit that turns on
floodlights whenever any crashing sound is heard
(breaking glass, forced entry through a door, etc.).
Back to handclaps. I’ve provided two PIC12F683
programs written in the free and open-source Great Cow
Basic language that are really pretty interesting; get them
at the download link for this article. The first simply bumps
a counter for each clap of the hands, showing the current
count on some LEDs in binary.
The second program is even fancier and will start
counting as soon as you start clapping, then stop the
count when you stop. With this, you could control a large
number of devices. For example, clap once and a lamp
turns on. Clap twice and it turns off. Clap three times and
the radio turns on; clap four times and it turns off again.
You can keep going like this almost indefinitely (limited
only by the port pins of your microcontroller).
Unlike those commercial units of yesteryear, you now
have the ability to put a large number of appliances under
sonic control. The sample programs are heavily
commented and also give any hookup instructions to the
LEDs and so forth. Note too that the programs utilize one
of the PIC timers in case you’ve ever wanted to learn
more about them.
When testing my unit, I found I could get it to reliably
count handclaps at a distance of up to 30 feet with the
sensitivity set on max. Plus, it shouldn’t really be any great
hurdle to port the sample programs over to an Arduino
should that be your weapon of choice.
One final thing before I turn you loose to whip up
you own applications. Controlling AC devices like lamps,
radios, televisions, etc., is serious business. So, be safe!
Use properly implemented opto-couplers and relays to
isolate the Sonic Sensor from any 110 VAC apparatus.
Now, what cool application can you come up with?
38 September 2013
■ FIGURE 5.