Go Down

### Topic: Impact location, using four sound sensors. (Read 61707 times)previous topic - next topic

#### MarcelDv ##### Feb 17, 2011, 02:47 pm
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

#### Grumpy_Mike #1
##### Feb 17, 2011, 03:14 pm
Quote
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. #2
##### Feb 17, 2011, 03:19 pm
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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### MarcelDv #3
##### Feb 17, 2011, 03:21 pm
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 #### MarcelDv #4
##### Feb 17, 2011, 03:32 pm
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. #5
##### Feb 17, 2011, 03:46 pm
So you can determine 3 distances then. All you need is the math to find the intersection point. Should be a google-able topic.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### scjurgen #6
##### Feb 17, 2011, 03:52 pm

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.

#### johnwasser #7
##### Feb 17, 2011, 04:00 pm
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).
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

#### MarcelDv #8
##### Feb 17, 2011, 04:02 pm

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

#### scjurgen #9
##### Feb 17, 2011, 04:21 pm
Quote
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 , (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.

#### robtillaart #10
##### Feb 17, 2011, 04:22 pmLast Edit: Feb 18, 2011, 04:25 pm by robtillaart Reason: 1
--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 --

from: - http://www.mathwarehouse.com/hyperbola/graph-equation-of-a-hyperbola.php
Quote
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)

-->  http://www.mathwarehouse.com/hyperbola/focus-of-hyperbola.php

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 ....
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### MarcelDv #11
##### Feb 17, 2011, 06:05 pm
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..

#### MarcelDv #12
##### Feb 17, 2011, 06:11 pm
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..

Quote
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 , (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.

#### MarcelDv #13
##### Feb 18, 2011, 02:46 pm
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 ?

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).

#### MarcelDv #14
##### Feb 18, 2011, 10:23 pm
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..

--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 --

from: - http://www.mathwarehouse.com/hyperbola/graph-equation-of-a-hyperbola.php
Quote
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)

-->  http://www.mathwarehouse.com/hyperbola/focus-of-hyperbola.php

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 ....

Go Up