Hello readers!
It’s been a long time since my last blog post. I was a bit busy and wasn’t getting time for blogging. Anyway, I did something cool and thought you people would like it. I’ve been working mostly with webcams over the last couple of months. I wanted to do something different for a little change and found sound a very interesting way of communicating with robots/computers. I created a sound sensor for my Microbric Viper Robot to give it the ability to respond to claps and whistles. I had to work extra hard on this project as things weren’t getting done as quickly as they usually do. The basic idea was that the sensor would send the PIC a logic 1 if the loudness of the sound coming in to the microphone exceeds a certain threshold and 0 otherwise. So, the sensor compares the microphone voltage to a reference voltage, and sends a logic 1 if the microphone output is higher (however, my signal is inverted because of the way I set up the op-amp as a comparator in my circuit). I had to experiment a lot on a breadboard before I had the circuit working perfectly. Here’s the final circuit I ended up with:
Since I didn’t have an oscilloscope at home, I turned my computer into an oscilloscope by using PC-Oscilloscope by Christian Zeitnitz. This software works with a sound card. It doesn’t have a fast sampling rate, but it’s good enough for testing this circuit. Parallel port based oscilloscopes are probably a little faster, but I didn’t have time to make one. In the oscilloscope, the signal from the sensor is a nice series of sharp spikes.
In the video, you’ll notice that I clap several times to control the robot. The first clap I make is only for initializing the clap counting algorithm in the program. After the first clap, the robot counts the number of times I clap my hands during an interval of 2-3 seconds. For example, if I clap once (after the initializing clap), the robot either moves forward or stops, depending on its state. If I clap twice, the robot turns left. Three claps make it turn right. Sometimes, the sensor also gets triggered from motor noise. So, I have to adjust the preset in the circuit to get things working perfectly. For extra reliability, the robot moves forward slowly to keep motor noise as low as possible. I think that programmatically distinguishing between a clap and motor noise or electronically filtering it out could also be worth a try.
This was a fairly simple project, but it took much longer than usual. Well, I have some more cool ideas for sound sensors. ;) Keep visiting!