Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sound localization approach.

Status
Not open for further replies.
Northguy:

With just a pair of mics being looked at in any on line, I can't see how to correct for erroneous zero crossing samples throwing the sequence off. Thus making the calcs invalid.

Would 3 mics in two perpendicular directions as formed by 5 mics in an L shape permit this correction?
 
I don't think that it is difficult to correct. If you have the same sound and high frequencies are removed, your sequece of zero crossing should be 1-2-1-2-1-2 (1 meaning left microphone and 2 - right one). If you get something out of sequene, such as 1-2-1-1-2-1-2 or 1-2-2-1-2, you simply ignore the segments wherezero crossings came out-of-order. This should be relatively rare.

I agree with Ron that 3 microphones are as good as 4 for distant sounds.
 
I don't think that it is difficult to correct. If you have the same sound and high frequencies are removed, your sequece of zero crossing should be 1-2-1-2-1-2 (1 meaning left microphone and 2 - right one). If you get something out of sequene, such as 1-2-1-1-2-1-2 or 1-2-2-1-2, you simply ignore the segments wherezero crossings came out-of-order. This should be relatively rare.

Well, if I am using a 16 bit timer to track the zero crossings, that timer rolls over. When that happens it could make the 1,2,1,2,1,2 look like 2,1,2,1,2,1,2. Similarly upon boot up if a wave front is between the mic pair the same faulty inversion could happen.

So I was thinking of a 1,2,3,1,2,3,1,2,3 pattern as a way to distinguish direction.
 
They're automatically ordered by their reception time. You get timer readings a1, a2, a3, a4 from one microphone and b1, b2, b3, b4 from the second one. You mix these values together in the order they were received.

To compare, you calculate (b1 - a1) and compare to 0. Timer rollovers won't matter unless b1 and a1 are spaced apart by more than half a period of the timer. For example b1 = 0x0500 and a1 = 0xf300. You calculate (b1 - a1) = 0x1200 > 0. The timer rolled over, but it didn't hurt your calculations.

When you get them sorted, you get the reception order such as a1,b1,a2,b2 etc. Since high frequencies are removed, the numbers will be interleaved most of the time. You then get your triplets (b1-a1)/(a2 - a1), (b2-a2)/(a3-a1).

You roll along until you get two in a row for either a or b, say you've got

a1,b1,a2,b2,a3,b3,a4,a5,b4,a6,b5,a7,b6,a8,b7,a9

Either a4 or a5 is spurious. Now you need to re-synchronize. For that, you throw away numbers from around this anomaly. Your last good calculation was (b2-a2)/(a3-a1). Then you skip some and continue after the disturbance (b5-a6)/(a7-a6), then (b6-a7)/(a8-a7). See how the indices shifted. You now get b[n] paired with a[n+1].

Note that you cannot be sure that the next one (b7-a8)/(a9-a8) is correct until you receive b8. If, instead, you receive a10 before b8 then you've got two a-s (a9 and a10) in a row, so either a9 or a10 is spurious and needs to be excluded.

You do similar when you get two b-s in a row.
 
If you get 1kHz sine wave it has length of about a foot. If your microphones are closer than this, you're Ok. But a 10kHz sine wave has a wavelength slightly more than an inch. If your microphones are a foot apart, a number of waves will fit between them, so you will have a hard time deciding which of these waves must be synched.

I don't understand this comlicated system of detecting zero crossings etc. Why don't you just correlate the samples of two microphones to find the delay. Sampling rate defines the time-domain resolution. The higher the sampling rate and the further apart the microphones are, the better results you get.

https://www.dspguide.com/ch7/3.htm

If you noise source is a single pulse this would be a simple project.
Our "robot localization system" used well defined ultrasonic "pings" and the electronics were very simple.. and the results were pretty good. Although our microphones were 2 to 3 meters apart from each other.

I have written a paper on how to calculate crossings of two hyperbolas.. you will need that. I can find the paper for you. It was used in sound localization of a robot in a robot competition.
Found the paper:
 

Attachments

  • Hyperbolic Position Location on Eurobot table rev D.pdf
    193.3 KB · Views: 399
Last edited:
That was interesting. In this case I want to determine:
1) the quadrant of the most significant (loudest) sound in ambient conditions.

There is no sound ranging, just direction, but the sound frequency is unknown, however, the important frequencies of interest are in the sub 3Khz range. Directionality of lower freq. sound is phase based as opposed to amplitude based so the zero crossings are used as phase markers.

EDIT: I wonder if the hysteresis inherent in the digital hi/lo of the CCP inputs could be used as the default filter for the 'noise' to isolate the significant zero crossings.
 
Last edited:
I don't understand this comlicated system of detecting zero crossings etc. Why don't you just correlate the samples of two microphones to find the delay.

Detecting zero crossing is way simpler and requires much less computing power than calculating autocorrelations, and at the same time provides better precision.

It is very easy to detect a sound when you can control the shape of it. Unlike echo-location system, you cannot choose the form of the third-party sound you detect. If the sound is not a pulse but a periodic wave, it is inherently impossible to detect phase shift longer than the wavelength with any method. Locating microphones closer to each other imposes a limit on the phase shift that you can observe (but at the same time lowers accuracy :( )
 
I don't understand this comlicated system of detecting zero crossings etc. Why don't you just correlate the samples of two microphones to find the delay. Sampling rate defines the time-domain resolution. The higher the sampling rate and the further apart the microphones are, the better results you get.

https://www.dspguide.com/ch7/3.htm


Our "robot localization system" used well defined ultrasonic "pings" and the electronics were very simple.. and the results were pretty good. Although our microphones were 2 to 3 meters apart from each other.

I have written a paper on how to calculate crossings of two hyperbolas.. you will need that. I can find the paper for you. It was used in sound localization of a robot in a robot competition.
Found the paper:

Hola mosaic

Prety much in line with what misterT says, google for Laurent Kneip Baumann sound hyperbola.

There is a site where Lego bots are used to test the basics. Even the hyperbola thing is explained with its limitations.

I see that misterT went further by crossing two of them.

If by chance you run across an Elektor issue (in Spanish), translation is wrong (cheked with Laurent himself). Not sure in other languages.

Please post the outcome. Interested myself.
 
Detecting zero crossing is way simpler and requires much less computing power than calculating autocorrelations, and at the same time provides better precision.

It is very easy to detect a sound when you can control the shape of it. Unlike echo-location system, you cannot choose the form of the third-party sound you detect. If the sound is not a pulse but a periodic wave, it is inherently impossible to detect phase shift longer than the wavelength with any method. Locating microphones closer to each other imposes a limit on the phase shift that you can observe (but at the same time lowers accuracy :( )

True. Maybe I have been lazy reading all the post, but for me there is not enough info to choose wisely from all the possible solutions. What kind of sound are we detecting and how accurate and fast the system needs to be..
But seems like you are heading towards the solution (of measuring the delay). I could be more help with the math after you solve the delay-detection problem.
 
Google for Laurent Kneip Baumann sound hyperbola.

Thanks for mentioning that solution. I did not know those guys. Well.. googling "Laurent Kneip Baumann sound hyperbola" gives this thread as the first result :)
 
And after that....?
 
Atferrari: which Elektor would that be in?
I have 2004 to 2013 issues.
(by heart) maybe around 2007, 2008, 2009. There is a robot in the cover.

Anyway, they produced much more than what is in that article.

Amongst many, the most simplest a practical of what is correlation.

Lot of things in a site from a school which is located at maybe, Lichtenstein. A small country anyway. Google!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top