You probably saw a bit more of the project I am currently working on, the robot flower. I have completed the second prototype and it works as expected. Now, I want to give the robot the ability to interact autonomously with the environment. Not just be controlled has with the Wii Nunchuk.
I want the robot to interact with many things, but first, I wish it to detect which direction the sound come from around it. Then the flower could orient itself this way.
Sound detection technique
In think using three microphones and measure which one receive more sound will permit to know the sound direction. I saw some complex project in which they also acquire the distance by triangulation. This is too complex for what I want. The direction is enough.
Then I start digging the web for some schematics. I found many electret microphone amplifier build around an operational amplifier (Op-Amp) chip. So I check for cheap and preassembled ones on eBay. I bough different models before I get one that works as expected. Almost all the microphones breakout boards I found only detect impacted sounds, like hand clapping. I need one enough sensible to capture voice.
The advantage I found with these microphones is that it possible to connect them directly to an analog to digital converter. Then the signal can be interpreted by a microcontroller.
Testing the microphones
To find the best one for me, I first check with my DSO Nano oscilloscope what is going on at the microphone circuit output. But the real test has been to hook the microphone to my Arduino ADC input. Then with Processing, I plotted the value of the analog input on my screen. This way I really saw how they reacted to sounds and what can I get from it.
Multiplexed analog to digital converter
Then came the time I tried with two. I quickly faced the fact that the Arduino ADC reads only one input at once. It cycled to read all entries. The delay to switch from one to another take a few milliseconds. Because my idea is to get the highest microphone input at precisely the same time, using this method is useless. This delay broke all my expectation of simplicity.
After some thinking and Googling, I saw a way to use the Arduino’s ADC as a comparator. This idea may be interesting for testing purpose, but it only works with two inputs. I continued my research and look for other microcontrollers, circuits or chips. I saw some very expensive professional devices, no microcontrollers that can do that, and finally a bunch of ICs (AD7865) specialized for that task. However, I did not found any breakout boards for theses simultaneous-sampling ADC ICs and build one is a project by itself. So I slept on that.
Compare analog inputs
The next day I imagine another way. Not tested yet. I will need to put some parts and wires together first. My idea is to compare each input with an Op-Amp, then send the digital logic output to the Arduino.
The microcontroller will be able to understand which microphone is the highly stimulated. I think it will be possible to sample the data over a short period of time, then average the result to know which direction the sound come from. So the next step is to put all this on my proto board and test my theory!