Sound Sensor -- Digital

In a previous exercise, we learned how to make an analog sound sensor. That is, it was device which extracted the amplitude envelope from sounds in a continuous fashion. But there are many times when all you care about is simply whether a sound has occurred or not. Things like the phone ringing, a baby crying, your dog barking and so forth. In these cases and many others, this digital sound sensor is just a ticket, especially because its power supply requirements are so much simpler than what we saw in the analog rendition.

The circuit is a straightforward transistor affair:

As a quick overview, an electret microphone is buffered and amplified by Q1 and then again by Q2, boosting the weak signal by 1000 or so. Then the waveform is rectified by D1/D2 and smoothed by C5. The resulting DC is buffered by Q3, and finally Q4 acts as a comparator, snapping from 0V to +5V when a sound is detected.

I wrote this circuit up fully in the article, "Detecting Sounds with the Sonic Sensor," Nuts & Volts Magazine, September 2013, pp. 34-38. You can find it online, along with the download package which contains files for the printed circuit artwork.

I was using the Great Cow Basic compiler in those days, and so you'll find the source code in that language in the download package. But a much better approach is given here with PIC Micro Pascal.

My prototype looks like this, close-up:

Now there are actually two exercises using this. In the first (Exercise 053), we'll simply count handclaps and display the binary number of the count on the LEDs. Hence, we can clap from 1 to 15 times and see the result. The method used is straightforward: Timer0 of the PIC16F88 is configured through software to act as event counter. Here's a short video demonstrating it in action:

The second demo (Exercise 054) shows something a little more practical. Here the PIC detects how many claps have occurred, and shows the final result only. This might be good for lazy oaf command execution devices. Say you're lounging on your sofa. One clap turns the television on, two claps turns it off. Three claps turns the stereo on, four claps turns it off, etc. You get the idea. Anyway, let's see it in action too:

Click to get the source code.
Click to get the schematic PDF.

Next Project: Slotted Opto Switch

No comments:

Post a Comment