hi guys, i m trying to build an Arduino based sound localizer using two microphones. I'm trying to figure out a way to start the project. As i was reading about direction of arrival calculation using audio samples, it is impossible to do with Arduino due to lack of sampling capabilities. what are my options in order to continue this project with Arduino. any useful advice in this matter greatly is appreciated.
thank you!
The Arduinos have only 1 ADC module and sound localization requires you to sample 2 inputs very rapidly.
Considering also the 8 bit processor and slow clock speed, this is not very feasible.
You might be able to do it for very distinct and loud percussive sounds, using multiple Arduinos, one per microphone.
The ATmega 32U4 on the Arduino Leonardo has Capture registers on Timer1 and Timer3. If your sound has a sharp enough attack time that you can detect the leading edge with hardware (microphone/amplifier/comparator module) you can use the capture registers to time them down to a single clock cycle (62.5 nanoseconds).
I'm not sure how hard it will be to synchronize the two timers. I'm guessing you can set TCNT1 to 0 and then set TCNT3 to however many clock cycles it takes to do the setting. You can use the PWM feature and a oscilloscope to see if you have them synchronized correctly.
It seems to be nearly impossible task calculating the delay using audio samples. do you guys suggest any other approach that i should look into. i found this inserting project that someone else has done long ago to solve the same problem. but the code is too complicated for me to understand since I'm not a pro at this. if any body can explain the code please refer to the ino file attached.
thank you
Localizator_final.ino (24.7 KB)
deasapriya:
please refer to the ino file attached.
You forgot to attach the file.
here i attached the file
Localizator_final.ino (24.7 KB)
johnwasser:
You forgot to attach the file.
previously uploaded the wrong file. my bad. I fixed it now
That program identifies the direction of a constant signal, a pure tone source, by calculating the phase difference between two microphones using FFT transformations.
It won't work for arbitrary sounds.
The author used to participate in this forum but deleted his/her web pages describing the project.
This project looks like what you are looking for: