IntroductionThis is part of my trilateration project.
I have spent a few days working with the electret microphone circuit connected to an Arduino to be able to listen to a specific frequency. In my code I count the number of times the input wave crosses over the zero line. This way I can identify that a specific frequency is played from the robot but there is still a long way from reliable results. With current circuit and code it takes too long to detect. Every millisecond gives a large error in distance.
Other issues is that sound waves are really long if you do not go to high frequencies.
"The wavelengths of sound frequencies audible to the human ear (20 Hz–20 kHz) are thus between approximately 17 m and 17 mm" - http://en.wikipedia.org/wiki/WavelengthThis means if I use 20KHz I can theoretical get a distance precision of one single wave detection of 1.7cm. That also means I have to detect the time of the first wave that hits the microphone. In my experiments really load noises like clapping or whistling close to the microphone gives really large outputs that can be easily detected but the tone of a buzzer a few meters away is way harder to detect.
The sampling frequency I get is around 10Khz. I have seen others get higher frequencies by neat tricks. Another thing to consider is that it looks like the tone library´s limit is around 30Khz .
|10KHz sampling rate showing the tone wave from the robot.|
The Goertzel LibraryThe Goertzel Library is the thing that looks most promising
it is based on the Goertzel algorithm and can detect frequencies.
Another library to detect frequencies
The XR-2567 dual monolithic tone decoder
The 2567 IC also looks most interesting and is made to detect specific frequencies and outputs an logic output. so I will order myself one of those. This might enable me to go to much higher frequencies than the Arduino can handle by itself.
The 2567 Datasheet, I hate those bad scans!http://www.electrokit.com/productFile/download/918
Here is a similar circuit showing a similar IC to get a feel for typical values for the capacitors and resistors.
I decided to order some parts from electrokit .
- Various Capacitors and Resistors for the audio detection circuits
- 10K Trimpot for the audio detection circuits
- XR2567CP-DIP 16 Dual tone decoder
- ATTiny13V and ATTiny25 just for fun. I have not tried the ATTiny13V before.
- A couple of zener diods to be able to do some experiments on voltage regulation
- A Digital potentiometer 256 steps also for experiments