As far as I know only digital signal can trigger IRQs so you need to make electronics that makes a square wave of the analog signal when a threshold (soundlevel) is reached.

The Arduino 328/UNO has only two direct IRQ lines but also has a collective IRQ on the other pins. So you need to determinew which pin was triggered. See - http://www.arduino.cc/playground/Main/PinChangeInt

Artem_F

if you have 4 known locations (x1,y1, x2,y2, x3,y3, and x4,y4),3 times after the trigger event, and you want to determine x0,y0 that is the locationof the sound source then you have 7 equations and 6 variables that means that the task issolvable.the equations are:(x_i-x0)^2 + (y_i-y0)^2 = R_i^2 for i=1..4+ 3 equations of type:R_i-R_earliest = v_sound*(t_i-t_earliest)=v_sound*t_i since t_earliest=0 as it syncs everything.R_earliest is one of R_i, each time it's a different one but it doesn't change anything

rewrite this system to express x0 and y0 and you're done.

scjurgen

funny that many come out on how to solve this (oh yeah, it's trivial, search wiki) problem, without actually presenting a working solution! In the end I got really annoyed, and here is a a solution to calculate the positions (mathemetica, matlab did not help much so I did it by hand) and you can find here the algo for this particular problem: http://www.schwietering.com/jayduino/#newtonmethod (in 4 iterations you get a 1E-09 result).

funny that many come out on how to solve this (oh yeah, it's trivial, search wiki) problem, without actually presenting a working solution! In the end I got really annoyed, and here is a a solution to calculate the positions (mathemetica, matlab did not help much so I did it by hand) and you can find here the algo for this particular problem: http://www.schwietering.com/jayduino/#newtonmethod (in 4 iterations you get a 1E-09 result).

Just found this contest - https://gw.innocentive.com/ar/challenge/overview/9932699 - related to this subject. The difficulty is that there are (at least) 3 dimensions iso 2 changing the number of micros to 8? -think cubistic - and the math will be squared too

Think the solution is a mesh-networked-zigbee-arduino-with-rtc-combination at every corner of the cube or so.

Real problem is how to detect the shot/impact in the first place, distinguish it from other noise and as it is a soundWAVE which point to take.

scjurgen

I wrote some code to get faster digital reads.You will initialize the drbit and drport arrays using initDigitalRead() in setup. Then, when calling digitalRead2() you can get 265Khz max sample rate (instead of 166Khz).

Marcel, I had some questions that I asked a while back trying to make a sound localization sensor. I am delighted to find this thread as it is good reading for me. I will be paying close attention to your progress as I am still thinking about my next step in making a better sensor.http://arduino.cc/forum/index.php/topic,55578.0.html

I made a prototype sensor that did sound localization using some LM324N op amps first as amplifiers then as comparitors. I have a video and also schematic diagram that may help you build your own circuits.http://filear.com/index.php/arduino/90-diy-sound-localization-sensor

I am doing very similar product like you - sound localization based on impact of metal BB pellet on metal target (square).

Long story short, so I am not boring - most probably, math won't be your biggest problem, in fact, it is/was the simplest problem of my setup.

So you have four sensors like in your image

From your input, you get 4 values. In example on picture, let's say that they were:

0: 0000 1: 1200 (A..1)2: 2000 (B..2)3: 2500 (C..3)(the unit is not important for now.. in this case, it could be CPU cycles or whatever)

my default, most simple algorithm did this:

Imagine four circles, with their center in microphones. Lets call those circles M0, M1, M2, M3.

You know delta times.. so let's do this:

M0 radius = 0000M1 radius = 1200M2 radius = 2000M3 radius = 2500

Now you have four imaginary circles (one is in fact point - zero radius) and they are touching big circle on your picture.

What you have to do is start adding number one to each of those circle radii.

M0 = 1, M1 = 1201, M2 = 2001, M3 = 2501..

Four imaginary circles are now a bit bigger and closer to impact zone.

After each addition, you have to calculate intersections of neighbour circles. In ideal case, they will all end up in the same point - point of impact. In real world, there will be some error.. then you have to calculate when where all intersection closest and pick a point between them.

Also - this is a solution for 2D, not for 3D. If you want to minimize error, mic's should be as close to edges of measured plane as possible. If they are not, then you have to use 3D coordinates for microphones, edges of target and do lots of triangle math in 3D.

I hope it was understandable - English is not my native language

And in real world, there will be many problems, as I have said, math is nothing. Problem is with intensity of signals at microphones - it goes down with distance squared, also with precise measuring the difference between signal arrival at microphones. Don't even think about using piezoelectric disks clamped onto surface of the target. Speed of sound in steel is nearly 6000 m/s, there will be various reflections and therefore it is virtually impossible to calculate with cross-corelation, because the signal from each sensor is different. A lot! It is possible to try triggering with first sine wave coming from sensor, but it is about milivolt levels, very picky on environment and if you are shooting, it will register shooting sound before impact sound - not good.