# Impact location, using four sound sensors.

I am not sure where this topic belongs, it is also posted in Science and Measurement...

Hi, i am quite new to the arduino and micro controller world, i have picked myself an project which is driving me through the roof, and that is the Math around this.

The basics are an impact detection system using three 4 sound sensors and an Arduino Uno. My problem and honestly i might be over complicating this is as follow.

while drawing a possible scenario i realized that there is a few things i did not take into consideration while doing my programming.. The problem i see, once i get an input on my first sensor (right Bottom ) Sensor 0, that sets the base for the rest of the calculations to happen. but at the moment the sensor is triggered there is already a set distance covered, meaning that the distance i calculate for sensor 1,2,3 will not be from the impact area, but rather from A-1 B-2 and C-3 which leaves a big hole in my calculations.... smiley-cry

i have been looking at crating triangles from example 3-1-A to determine the XY Coordinate for A, the same for B and C....

Then using Equation of a Circle from 3 Points to determine the center point of the circle..

My problem is angels, i do not have any incoming angels to determine the XY of ABC...

Could anyone offer me a fresh approach to this, either better mathematical approach, or a different way i should be looking at this problem..

Thank you for your time... Marcel

it is also posted in Science and Measurement...

Do not do this, it is called cross posting and makes people here cross. Go and delete one of them.

You need a minimum of 3 readings to determine the source, 4 increases your confidence.
Typically you have a circle of uncertainty around each point, and where those circles intersect is the origin point.

How are you determining the distance from ABC to an impact point?
With things like earthquakes, they work backwards using time.
An event is known to have occurred.
They know the time that each sensor first felt it.
They know the time of the impact.
They know (more or less) the speed of the wavefront thru water, rock etc.
So (sensor_time - impact_time)/speed of propagation = distance away. There’s your circle of uncertainty.
Then do the math to find the intersection point.

Apologies, i have removed the post in "Science and Measurement"...

Was not sure where it belonged... but seems sensors is the better place..

Thanks for the warning :fearful:

I have a Temp Sensor to calculate the correct speed of sound,
then i calculate the distance by using the time traveled with a formula
to distance…

Does that make sense to you ?

You need a minimum of 3 readings to determine the source, 4 increases your confidence.
Typically you have a circle of uncertainty around each point, and where those circles intersect is the origin point.

How are you determining the distance from ABC to an impact point?
With things like earthquakes, they work backwards using time.
An event is known to have occurred.
They know the time that each sensor first felt it.
They know the time of the impact.
They know (more or less) the speed of the wavefront thru water, rock etc.
So (sensor_time - impact_time)/speed of propagation = distance away. There’s your circle of uncertainty.
Then do the math to find the intersection point.

So you can determine 3 distances then. All you need is the math to find the intersection point. Should be a google-able topic.

I don’t think he got an impact time.
The first signal that triggers is then defined as t=0. The others are delta values (so called TDOA) to the first dtn=tn - t etc. So, when you put up your equation of the circles, your radii of 3 circles will have an unknown delta in common for which you have also to resolve (resolve for x,y, and r). BTW, this problem is actually called multilateration http://en.wikipedia.org/wiki/Multilateration.

Based on timing and the speed of sound you have the length of line segments A1, B2 and C3. You want to find the point of impact in the center of the circle. Call the radius of that circle R. The distance of the impact from the four corners is 0:R, 1:A1+R, 2:B2+R, 3:C3+R. Write out the four equations and solve for the three unknowns: R, Xi and Yi (the coordinates of impact).

For example: SQRT((Xi-X0)2+(Yi-Y0)2) = SQRT((Xi-X1)2+(Yi-Y1)2) - AI = SQRT((Xi-X2)2+(Yi-Y2)2) - B2 = SQRT((Xi-X3)2+(Yi-Y3)2) - C3 = R

You can probably just drop out the R and solve for (Xi,Yi).

scjurgen: I don't think he got an impact time. The first signal that triggers is then defined as t=0. The others are delta values (so called TDOA) to the first dtn=tn - t etc. So, when you put up your equation of the circles, your radii of 3 circles will have an unknown delta in common for which you have also to resolve (resolve for x,y, and r). BTW, this problem is actually called multilateration http://en.wikipedia.org/wiki/Multilateration.

That is correct, i do not have the impact time, i only have the first trigger on sensor 0, which is already and x distance from the impact point..

Also as to my initial line of thought, i do not have the incoming signal angle, which would help to solve the problem with triangle formulas.. so the next option :)

Thank you for the link, i will do some reading and see if i understand the principals of the multilateration

Also as to my initial line of thought, i do not have the incoming signal angle, which would help to solve the problem with triangle formulas..

Just some food for thought 8), (not a solution for your current problem which has been addressed quite well by the previous post of johnwasser):

There is a technique to get an angle from an impact with 2 sensors using an... tada: artificial head. The mics are mounted in the ears. As the sound arrives at two different times, while one of them impacts directly you will have a slight phase shift from which you can determine a rough determination of angle (as long as you don't have sine sounds, which makes it complicate with high tones. Humans are quite good in this technique. the phase shift determination is done using autocorrelation functions, and this technique works also quite well in a noisy ambient.

–update –
Sorry, my first reasoning was far too simplified ==> removed; a retry.

You need the distance between the microphones and the two delta T arrival times of the shockwave to do the math.

If you have three points A, B and C.
arrival times of soundwave (in order)
A - T0
B - T1
C - T2

The fact that the soundwave arrived at A first defines an area(1) of all points P: d.PA < d.PB and d.PA < d.PC (d.PA = distance PA)

The delta-time AB = T1 - T0 defines a distance d1 = (T1 - T0) /so (so = speed Sound)
The delta-time AC = T2 - T0 defines a distance d2 = (T2 - T0) /so

define the curve of all points Q: d.QA - d.QB = d1 (.QA = distance QA)
define the curve of all points R: d.RA - d.RC = d2

These two curves cross each other in area (1) => the point of impact ==> Q == R.

– update –
if you knew the time of impact the d.QA, dQB and d.QC would be known, making the math faaaaar simpler as these curves are not trivial - quadratic asymptotic beasts with sqrts in it -

Think it is easier to write an approximating algorithm that searches the point.
The fact that point A heard the soundwave first => d.QA < d.QB

– update 2 –

A hyperbola is a set of all points P such that the difference between the distances from P to the foci, F1 and F2, are a constant K

so my “quadratic asymptotic beasts with sqrts in it” can be rewritten as hyperbola with A and B (A & C) as foci.

using the drawing of the webpage above:
Assume A = (0,-c) and B = (0,c) and the constant K = d1 = (T1 - T0) /so. The point (0,-a) where the hyperbola crosses the Y-axis is (0, -d1/2)

To determine the foci one uses a^2 + b^2 = c^2 => b^2 = c^2 - a^2 = (d.AB/2)^2 - (d1/2)^2

The formula of the hyperbola becomes : y^2 / (-d1/2)^2 - x^2 / (d.AB/2)^2 - (-d1/2)^2 = 1

Same trick for the points A & C (hint: it is easier to use another reference framework to determine the formula and do a translation afterwards: X → X-xdelta Y → Y-ydelta)

TODO: determine intersection points of the two hyperbolas and then your close…

– update 3 –

intersection points
http://www.analyzemath.com/HyperbolaProblems/hyperbola_intersection.html

Difference with the location problem is that the hyperbola defined by points AB and the one defined by points AC are ‘orthogonal’ - think of it as the red in the drawing rotated 90 degrees (make a drawing!!) There will be two intersection points and because the soundwave arrived first at A it becomes obvious which one to choose.

The code is left as an exercise …

Thank you guys for all the information, i have allot of thinking to do now, i am not the sharpest pencil in the pack when it comes to math..

I will be playing with these options and update you guys on the results.

Thank you all again....

If you have any other suggestion please let me know, i would deeply appreciate it..

This sounds interesting, i will play with this at some stage, i think i have an application where that would be helpful..

Thanks for the Info..

scjurgen:

Also as to my initial line of thought, i do not have the incoming signal angle, which would help to solve the problem with triangle formulas..

Just some food for thought 8), (not a solution for your current problem which has been addressed quite well by the previous post of johnwasser):

There is a technique to get an angle from an impact with 2 sensors using an... tada: artificial head. The mics are mounted in the ears. As the sound arrives at two different times, while one of them impacts directly you will have a slight phase shift from which you can determine a rough determination of angle (as long as you don't have sine sounds, which makes it complicate with high tones. Humans are quite good in this technique. the phase shift determination is done using autocorrelation functions, and this technique works also quite well in a noisy ambient.

I might be missing something in this formula, the problem i see is that Xi and Yi is unknown to me, thus i cannot manipulate the formula to give me the results Yi or Xi,

or am i just not understanding what you are trying to show me ?

johnwasser: Based on timing and the speed of sound you have the length of line segments A1, B2 and C3. You want to find the point of impact in the center of the circle. Call the radius of that circle R. The distance of the impact from the four corners is 0:R, 1:A1+R, 2:B2+R, 3:C3+R. Write out the four equations and solve for the three unknowns: R, Xi and Yi (the coordinates of impact).

For example: SQRT((Xi-X0)2+(Yi-Y0)2) = SQRT((Xi-X1)2+(Yi-Y1)2) - AI = SQRT((Xi-X2)2+(Yi-Y2)2) - B2 = SQRT((Xi-X3)2+(Yi-Y3)2) - C3 = R

You can probably just drop out the R and solve for (Xi,Yi).

Honesty, i have lost you at the first part already… =(
But i will spend some time on this and see if i can get some
understanding of how this all fits together…

Thank you for the effort you put in it is appreciated…

robtillaart:
–update –
Sorry, my first reasoning was far too simplified ==> removed; a retry.

You need the distance between the microphones and the two delta T arrival times of the shockwave to do the math.

If you have three points A, B and C.
arrival times of soundwave (in order)
A - T0
B - T1
C - T2

The fact that the soundwave arrived at A first defines an area(1) of all points P: d.PA < d.PB and d.PA < d.PC (d.PA = distance PA)

The delta-time AB = T1 - T0 defines a distance d1 = (T1 - T0) /so (so = speed Sound)
The delta-time AC = T2 - T0 defines a distance d2 = (T2 - T0) /so

define the curve of all points Q: d.QA - d.QB = d1 (.QA = distance QA)
define the curve of all points R: d.RA - d.RC = d2

These two curves cross each other in area (1) => the point of impact ==> Q == R.

– update –
if you knew the time of impact the d.QA, dQB and d.QC would be known, making the math faaaaar simpler as these curves are not trivial - quadratic asymptotic beasts with sqrts in it -

Think it is easier to write an approximating algorithm that searches the point.
The fact that point A heard the soundwave first => d.QA < d.QB

– update 2 –

A hyperbola is a set of all points P such that the difference between the distances from P to the foci, F1 and F2, are a constant K

so my “quadratic asymptotic beasts with sqrts in it” can be rewritten as hyperbola with A and B (A & C) as foci.

using the drawing of the webpage above:
Assume A = (0,-c) and B = (0,c) and the constant K = d1 = (T1 - T0) /so. The point (0,-a) where the hyperbola crosses the Y-axis is (0, -d1/2)

To determine the foci one uses a^2 + b^2 = c^2 => b^2 = c^2 - a^2 = (d.AB/2)^2 - (d1/2)^2

The formula of the hyperbola becomes : y^2 / (-d1/2)^2 - x^2 / (d.AB/2)^2 - (-d1/2)^2 = 1

Same trick for the points A & C (hint: it is easier to use another reference framework to determine the formula and do a translation afterwards: X → X-xdelta Y → Y-ydelta)

TODO: determine intersection points of the two hyperbolas and then your close…

– update 3 –

intersection points
http://www.analyzemath.com/HyperbolaProblems/hyperbola_intersection.html

Difference with the location problem is that the hyperbola defined by points AB and the one defined by points AC are ‘orthogonal’ - think of it as the red in the drawing rotated 90 degrees (make a drawing!!) There will be two intersection points and because the soundwave arrived first at A it becomes obvious which one to choose.

The code is left as an exercise …

Another line of thought. When the soundwaves arrive the soundwave has a definite form which will be slightly different at the three points ABC. The essence is that the peakvolume of the soundwave is proportional (linear, quadratic or otherwise) with the distance. The farther away the weaker the sound. As one could calibrate the micro's with a signalstrength/distance table the math would become simpler again.

Don't know if the differences are within the noise-level of the signals/ micro's/arduino ADC but a simple test could reveal this. Furthermore soundwaves can be deformed by obstacles in the open field etc. Still it has some potential worth investigating.

Question: How big is ABCD in square meters? smaller/bigger?

Some additional hyperbola math: - http://www.codecogs.com/reference/maths/geometry/coordinate/hyperbola.php

Hi Rob,

i have been working on the method you sent me most of the day, but something
just caught my attention…
Using the Hyperbola will give me a XY coordinate on the Hyperbola’s Dimensions A-B, not on the the larger
grid…
I still have no Idea mathematically where on the target area A-B is located, so those coordinates
results in another set of unusable data…

Does this make any sense to you ?
Or am i missing something here ?

robtillaart:
–update –
Sorry, my first reasoning was far too simplified ==> removed; a retry.

You need the distance between the microphones and the two delta T arrival times of the shockwave to do the math.

If you have three points A, B and C.
arrival times of soundwave (in order)
A - T0
B - T1
C - T2

The fact that the soundwave arrived at A first defines an area(1) of all points P: d.PA < d.PB and d.PA < d.PC (d.PA = distance PA)

The delta-time AB = T1 - T0 defines a distance d1 = (T1 - T0) /so (so = speed Sound)
The delta-time AC = T2 - T0 defines a distance d2 = (T2 - T0) /so

define the curve of all points Q: d.QA - d.QB = d1 (.QA = distance QA)
define the curve of all points R: d.RA - d.RC = d2

These two curves cross each other in area (1) => the point of impact ==> Q == R.

– update –
if you knew the time of impact the d.QA, dQB and d.QC would be known, making the math faaaaar simpler as these curves are not trivial - quadratic asymptotic beasts with sqrts in it -

Think it is easier to write an approximating algorithm that searches the point.
The fact that point A heard the soundwave first => d.QA < d.QB

– update 2 –

A hyperbola is a set of all points P such that the difference between the distances from P to the foci, F1 and F2, are a constant K

so my “quadratic asymptotic beasts with sqrts in it” can be rewritten as hyperbola with A and B (A & C) as foci.

using the drawing of the webpage above:
Assume A = (0,-c) and B = (0,c) and the constant K = d1 = (T1 - T0) /so. The point (0,-a) where the hyperbola crosses the Y-axis is (0, -d1/2)

To determine the foci one uses a^2 + b^2 = c^2 => b^2 = c^2 - a^2 = (d.AB/2)^2 - (d1/2)^2

The formula of the hyperbola becomes : y^2 / (-d1/2)^2 - x^2 / (d.AB/2)^2 - (-d1/2)^2 = 1

Same trick for the points A & C (hint: it is easier to use another reference framework to determine the formula and do a translation afterwards: X → X-xdelta Y → Y-ydelta)

TODO: determine intersection points of the two hyperbolas and then your close…

– update 3 –

intersection points
http://www.analyzemath.com/HyperbolaProblems/hyperbola_intersection.html

Difference with the location problem is that the hyperbola defined by points AB and the one defined by points AC are ‘orthogonal’ - think of it as the red in the drawing rotated 90 degrees (make a drawing!!) There will be two intersection points and because the soundwave arrived first at A it becomes obvious which one to choose.

The code is left as an exercise …

What kind of distance are you expecting between the receivers? Will they all be connected to the uno via wires?

Yes they will be connected via wire to the Uno,

My current test is based on 1200mm x 800mm but later on i would like to scale it up more to about 2.5m x 2m...

andywatson: What kind of distance are you expecting between the receivers? Will they all be connected to the uno via wires?

My current test is based on 1200mm x 800mm but later on i would like to scale it up

Did you make considerations about the precision you’ll obtain?
Using the standard max sample rate of the Arduino ADC (prescaled with 128) you will get these readings AFAIK:

4 sensors dividing an expected sample rate of 8.9 Khz:

``````340m/s speed of sound (22[sup]o[/sup]C)= 340000mm/s
340000/(8900/4) ~= 153 mm.
``````

This means a medium sampling distance of sound vs distance of about 15cm for a single sensor and of about 4 cm for the single fronts delta between adjacent sensors (which makes the error considerations tricky).