Pages: [1] 2 3 ... 5   Go Down
Author Topic: Impact location, using four sound sensors.  (Read 27996 times)
0 Members and 1 Guest are viewing this topic.
South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27357
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* triangulation.jpg (26.35 KB, 960x720 - viewed 96 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-eek-blue
Logged

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27357
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 142
jayduino rox
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Juergen

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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 smiley

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

Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 142
jayduino rox
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-cool, (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.
Logged

Juergen

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 221
Posts: 13853
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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 ....
« Last Edit: February 18, 2011, 10:25:57 am by robtillaart » Logged

Rob Tillaart

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

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-cool, (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.
Logged

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

South africa
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Honesty, i have lost you at the first part already........ smiley-cry
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 -   smiley-sad

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

Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: