Electronics-Related.com
Forums

Sound localization with Raspberry pi

Started by Unknown August 14, 2014
I want to use the RPI to process the incoming data from five crystal microphones in order to obtain the direction of arrival of sound so that i can steer a camera mounted on two servos to that direction.

 
Since there is no audio inputs to the RPI i think of using a two-channel analog to digital converter, one channel is connected to a refrence mic and the other channel is connected to the output of a 4-1 analog multiplexer connected to the other four mics.

 
Is it the right way to do my project? if not then how do i do it ?
is there a recommended 2channel ADC and 4-1 analog mux compatible with the RPI? 
On 8/14/2014 1:49 PM, tareqmatarr@gmail.com wrote:
> I want to use the RPI to process the incoming data from five crystal > microphones in order to obtain the direction of arrival of sound so > that i can steer a camera mounted on two servos to that direction. > > Since there is no audio inputs to the RPI i think of using a > two-channel analog to digital converter, one channel is connected to > a refrence mic and the other channel is connected to the output of a > 4-1 analog multiplexer connected to the other four mics. > > Is it the right way to do my project? if not then how do i do it ? is > there a recommended 2channel ADC and 4-1 analog mux compatible with > the RPI?
What sort of accuracy are you looking for? What sort of budget do you have? Is this a "one off" design? Or, something that you want to reproduce? Commercialize? Might I suggest, instead, using USB microphones? And, instead of requiring calibrated units, instead adopt a procedure whereby *you* calibrate them (perhaps in the same instrument). Note that the calibration need not be as isolated, individual microphones. Rather, you could locate them in their intended positions. Then, position a sound source in a known location and *observe* the responses from each microphone. Move the sound source -- or, change the character of the source as different frequencies will react with the environment in different ways (e.g., multipath) -- and repeat.
On Friday, 15 August 2014 01:40:36 UTC+3, Don Y  wrote:
> On 8/14/2014 1:49 PM, tareqmatarr@gmail.com wrote: > > > I want to use the RPI to process the incoming data from five crystal > > > microphones in order to obtain the direction of arrival of sound so > > > that i can steer a camera mounted on two servos to that direction. > > > > > > Since there is no audio inputs to the RPI i think of using a > > > two-channel analog to digital converter, one channel is connected to > > > a refrence mic and the other channel is connected to the output of a > > > 4-1 analog multiplexer connected to the other four mics. > > > > > > Is it the right way to do my project? if not then how do i do it ? is > > > there a recommended 2channel ADC and 4-1 analog mux compatible with > > > the RPI? > > > > What sort of accuracy are you looking for? What sort of budget > > do you have? Is this a "one off" design? Or, something that > > you want to reproduce? Commercialize? > > > > Might I suggest, instead, using USB microphones? And, instead of > > requiring calibrated units, instead adopt a procedure whereby *you* > > calibrate them (perhaps in the same instrument). > > > > Note that the calibration need not be as isolated, individual > > microphones. Rather, you could locate them in their intended > > positions. Then, position a sound source in a known location > > and *observe* the responses from each microphone. Move the > > sound source -- or, change the character of the source as different > > frequencies will react with the environment in different ways > > (e.g., multipath) -- and repeat.
i want it to be accurate of course but as cheap as possible, the RPI has only two usb ports so i will have to use a usb hub and i have already bought the crystal mics. i dont understand how calibrating the mics would help, i want to be able to do a synchronized sampling for a pair of mics (the refrence mic and a mic from the other four). if i use usb mics thier outputs will be availabe simultaneously and i guess that the RPI would not tolerate that amount of processing (4 pairs of mics and controlling the servos)
On 8/14/2014 11:22 PM, tareqmatarr@gmail.com wrote:
> On Friday, 15 August 2014 01:40:36 UTC+3, Don Y wrote: >> On 8/14/2014 1:49 PM, tareqmatarr@gmail.com wrote: >> >>> I want to use the RPI to process the incoming data from five crystal >> >>> microphones in order to obtain the direction of arrival of sound so >> >>> that i can steer a camera mounted on two servos to that direction. >> >>> >> >>> Since there is no audio inputs to the RPI i think of using a >> >>> two-channel analog to digital converter, one channel is connected to >> >>> a refrence mic and the other channel is connected to the output of a >> >>> 4-1 analog multiplexer connected to the other four mics. >> >>> >> >>> Is it the right way to do my project? if not then how do i do it ? is >> >>> there a recommended 2channel ADC and 4-1 analog mux compatible with >> >>> the RPI? >> >> >> >> What sort of accuracy are you looking for? What sort of budget >> >> do you have? Is this a "one off" design? Or, something that >> >> you want to reproduce? Commercialize? >> >> >> >> Might I suggest, instead, using USB microphones? And, instead of >> >> requiring calibrated units, instead adopt a procedure whereby *you* >> >> calibrate them (perhaps in the same instrument). >> >> >> >> Note that the calibration need not be as isolated, individual >> >> microphones. Rather, you could locate them in their intended >> >> positions. Then, position a sound source in a known location >> >> and *observe* the responses from each microphone. Move the >> >> sound source -- or, change the character of the source as different >> >> frequencies will react with the environment in different ways >> >> (e.g., multipath) -- and repeat. > > i want it to be accurate of course but as cheap as possible, the RPI has only two usb ports so i will have to use a usb hub and i have already bought the crystal mics. > > i dont understand how calibrating the mics would help, i want to be able to do a synchronized sampling for a pair of mics (the refrence mic and a mic from the other four). > > if i use usb mics thier outputs will be availabe simultaneously and i guess that the RPI would not tolerate that amount of processing (4 pairs of mics and controlling the servos)
I'm not sure USB microphones are a good recommendation. You seem to understand the need for synchronous sampling, which will be hard if not impossible to do with USB ADCs. So you are on the right track when you say you would use a 2 channel ADC. So I would look for an ADC card for the rPi with at least two ADC inputs not multiplexed to one ADC. Then you will want some amount of amplification to match the output level of the mics to the input range of the ADC. Ideally this would be part of the daughter card for the rPi. How do you plan to control the servos? I assume that will be another daughter card for the rPi. Can you stack cards on the rPi? You may need to find a servo card with a pair of ADC inputs. Are you happy with AC coupled inputs? I expect you won't need DC coupling to do the correlation you are talking about. -- Rick
On 8/14/2014 8:22 PM, tareqmatarr@gmail.com wrote:

[much elided due to silly double-spacing of news client?]

> i want it to be accurate of course but as cheap as possible, the RPI > has only two usb ports so i will have to use a usb hub and i have > already bought the crystal mics. > > i dont understand how calibrating the mics would help, i want to be > able to do a synchronized sampling for a pair of mics (the refrence > mic and a mic from the other four).
Then you are hoping you can accurately measure the phase difference between the received signals at the two mics. What are you using to excite the system?
> if i use usb mics thier outputs will be availabe simultaneously and i > guess that the RPI would not tolerate that amount of processing (4 > pairs of mics and controlling the servos)
I was assuming you would look for difference in SPL between the mics and the referent. As such, you need to understand the gain/atten of each mic at <whatever> frequency. Receiving a signal OF UNKNOWN CHARACTERISTICS (e.g., a *duck* quacking in the distance), you could measure the magnitude of the response from each mic. Then, look at the characteristics of the signal (i.e., record it) and, from that, determine what the incident magnitude of the signal at each microphone would have been (inverse transform of the calibration). This removes the real-time aspects of the processing (beyond just capturing the "signals" from each microphone -- potentially skewed by an unknown amount through the data acquisition system. If, OTOH, you can control the excitation signal and its waveform (and envelope), then you can sample each input (in any REPEATABLE fashion) and, having *observed* (through calibration) the relative phase difference through that REPEATABLE processing/sampling, can determine the actual phase/time difference between the incident signals. Again, you haven't specified accuracy, excitation, cost, the acoustical characteristics of the environment (e.g., will you see reflections before primary signal incidence at ALL mics), etc.
On a sunny day (Thu, 14 Aug 2014 20:22:03 -0700 (PDT)) it happened
tareqmatarr@gmail.com wrote in
<e117b1a1-f31e-42c4-9d53-fed7f42d1626@googlegroups.com>:

>i want it to be accurate of course but as cheap as possible, the RPI has only two usb ports so i will have to use a usb hub and >i have already bought the crystal mics. > >i dont understand how calibrating the mics would help, i want to be able to do a synchronized sampling for a pair of mics (the >reference mic and a mic from the other four). > >if i use usb mics thier outputs will be availabe simultaneously and i guess that the RPI would not tolerate that amount of >processing (4 pairs of mics and controlling the servos)
Yes, USB on raspi has severe throughput limitations (to the point of dropping keyboard characters on an USB keyboard). That rules out USB sound cards (I have tested that). CRYSTAL mikes????? Now that is old age! Those have severe limitations (frequency spectrum related for example). You probably want electrets. What is the maximum frequency? the OLD I2C PCF8591 has 4 channels and you could do the I2C a bit faster, IIRC (been 20 years or more) I tried that for low frequency sampling 8 bit audio... Else there are many real 'audio 16 bit chips'. But for DIRECTION you want phase information, and that could perhaps be simpler done with a simple analog phase comparator between the 2 mike signals?? I once worked on a chopper detector interceptor, but the frequencies were much lower, phase based, top secret of course, like everything else here, use electrets. Not seen a black heli since. :-) mm come to think of it, that one last night could have been black, but OK. And raspi has limited processing power.
<tareqmatarr@gmail.com> wrote:

> I want to use the RPI to process the incoming data from five crystal > microphones in order to obtain the direction of arrival of sound so that i > can steer a camera mounted on two servos to that direction. > > > Since there is no audio inputs to the RPI i think of using a two-channel > analog to digital converter, one channel is connected to a refrence mic > and the other channel is connected to the output of a 4-1 analog > multiplexer connected to the other four mics. > > > Is it the right way to do my project? if not then how do i do it ? is > there a recommended 2channel ADC and 4-1 analog mux compatible with the > RPI?
How do you propose distinguishing the initial signal from any echoes? If it is a pulse signal (gunshot), you can use the first arrival as your timing point; but if it is extended beyond a few milliseconds (speech), you will have to do some very complex correlation calculations. -- ~ Adrian Tuddenham ~ (Remove the ".invalid"s and add ".co.uk" to reply) www.poppyrecords.co.uk
On Friday, 15 August 2014 08:13:15 UTC+3, rickman  wrote:
> On 8/14/2014 11:22 PM, tareqmatarr@gmail.com wrote: >=20 > > On Friday, 15 August 2014 01:40:36 UTC+3, Don Y wrote: >=20 > >> On 8/14/2014 1:49 PM, tareqmatarr@gmail.com wrote: >=20 > >> >=20 > >>> I want to use the RPI to process the incoming data from five crystal >=20 > >> >=20 > >>> microphones in order to obtain the direction of arrival of sound so >=20 > >> >=20 > >>> that i can steer a camera mounted on two servos to that direction. >=20 > >> >=20 > >>> >=20 > >> >=20 > >>> Since there is no audio inputs to the RPI i think of using a >=20 > >> >=20 > >>> two-channel analog to digital converter, one channel is connected to >=20 > >> >=20 > >>> a refrence mic and the other channel is connected to the output of a >=20 > >> >=20 > >>> 4-1 analog multiplexer connected to the other four mics. >=20 > >> >=20 > >>> >=20 > >> >=20 > >>> Is it the right way to do my project? if not then how do i do it ? is >=20 > >> >=20 > >>> there a recommended 2channel ADC and 4-1 analog mux compatible with >=20 > >> >=20 > >>> the RPI? >=20 > >> >=20 > >> >=20 > >> >=20 > >> What sort of accuracy are you looking for? What sort of budget >=20 > >> >=20 > >> do you have? Is this a "one off" design? Or, something that >=20 > >> >=20 > >> you want to reproduce? Commercialize? >=20 > >> >=20 > >> >=20 > >> >=20 > >> Might I suggest, instead, using USB microphones? And, instead of >=20 > >> >=20 > >> requiring calibrated units, instead adopt a procedure whereby *you* >=20 > >> >=20 > >> calibrate them (perhaps in the same instrument). >=20 > >> >=20 > >> >=20 > >> >=20 > >> Note that the calibration need not be as isolated, individual >=20 > >> >=20 > >> microphones. Rather, you could locate them in their intended >=20 > >> >=20 > >> positions. Then, position a sound source in a known location >=20 > >> >=20 > >> and *observe* the responses from each microphone. Move the >=20 > >> >=20 > >> sound source -- or, change the character of the source as different >=20 > >> >=20 > >> frequencies will react with the environment in different ways >=20 > >> >=20 > >> (e.g., multipath) -- and repeat. >=20 > > >=20 > > i want it to be accurate of course but as cheap as possible, the RPI ha=
s only two usb ports so i will have to use a usb hub and i have already bou= ght the crystal mics.
>=20 > > >=20 > > i dont understand how calibrating the mics would help, i want to be abl=
e to do a synchronized sampling for a pair of mics (the refrence mic and a = mic from the other four).
>=20 > > >=20 > > if i use usb mics thier outputs will be availabe simultaneously and i g=
uess that the RPI would not tolerate that amount of processing (4 pairs of = mics and controlling the servos)
>=20 >=20 >=20 > I'm not sure USB microphones are a good recommendation. You seem to=20 >=20 > understand the need for synchronous sampling, which will be hard if not=
=20
>=20 > impossible to do with USB ADCs. So you are on the right track when you=
=20
>=20 > say you would use a 2 channel ADC. >=20 >=20 >=20 > So I would look for an ADC card for the rPi with at least two ADC inputs=
=20
>=20 > not multiplexed to one ADC. Then you will want some amount of=20 >=20 > amplification to match the output level of the mics to the input range=20 >=20 > of the ADC. Ideally this would be part of the daughter card for the rPi. >=20 >=20 >=20 > How do you plan to control the servos? I assume that will be another=20 >=20 > daughter card for the rPi. Can you stack cards on the rPi? You may=20 >=20 > need to find a servo card with a pair of ADC inputs. Are you happy with=
=20
>=20 > AC coupled inputs? I expect you won't need DC coupling to do the=20 >=20 > correlation you are talking about. >=20 >=20 >=20 > --=20 >=20 >=20 >=20 > Rick
im not planning to use any card to control the servos, i've seen a video of= a similar project in which two servos were controlled using the raspberry = pi alone and i dont THINK i need a card for that, im using micro servos so = im not supposed to face any power problems.=20 Best Regards, Tareq
On Friday, 15 August 2014 08:39:33 UTC+3, Don Y  wrote:
> On 8/14/2014 8:22 PM, tareqmatarr@gmail.com wrote: > > > > [much elided due to silly double-spacing of news client?] > > > > > i want it to be accurate of course but as cheap as possible, the RPI > > > has only two usb ports so i will have to use a usb hub and i have > > > already bought the crystal mics. > > > > > > i dont understand how calibrating the mics would help, i want to be > > > able to do a synchronized sampling for a pair of mics (the refrence > > > mic and a mic from the other four). > > > > Then you are hoping you can accurately measure the phase difference > > between the received signals at the two mics. What are you using > > to excite the system? > > > > if i use usb mics thier outputs will be availabe simultaneously and i > > > guess that the RPI would not tolerate that amount of processing (4 > > > pairs of mics and controlling the servos) > > > > I was assuming you would look for difference in SPL between the mics > > and the referent. As such, you need to understand the gain/atten > > of each mic at <whatever> frequency. Receiving a signal OF UNKNOWN > > CHARACTERISTICS (e.g., a *duck* quacking in the distance), you could > > measure the magnitude of the response from each mic. Then, look > > at the characteristics of the signal (i.e., record it) and, from that, > > determine what the incident magnitude of the signal at each microphone > > would have been (inverse transform of the calibration). > > > > This removes the real-time aspects of the processing (beyond just > > capturing the "signals" from each microphone -- potentially skewed > > by an unknown amount through the data acquisition system. > > > > If, OTOH, you can control the excitation signal and its waveform > > (and envelope), then you can sample each input (in any REPEATABLE > > fashion) and, having *observed* (through calibration) the relative > > phase difference through that REPEATABLE processing/sampling, can > > determine the actual phase/time difference between the incident > > signals. > > > > Again, you haven't specified accuracy, excitation, cost, the > > acoustical characteristics of the environment (e.g., will you > > see reflections before primary signal incidence at ALL mics), etc.
i want to utilize my project in real time so it must be accurate, its excited by typical voice signals (300-3400Hz), im using the steered response power - phat transform (SRP-PHAT) algorithm so im not worried about reverberation. Best Regards, Tareq Matar
On 2014-08-15, tareqmatarr@gmail.com <tareqmatarr@gmail.com> wrote:
> On Friday, 15 August 2014 08:13:15 UTC+3, rickman wrote: > > im not planning to use any card to control the servos, i've seen a > video of a similar project in which two servos were controlled using > the raspberry pi alone and i dont THINK i need a card for that, im > using micro servos so im not supposed to face any power problems.
yeah R.C. model servos need only a PWM signal, and the Raspberry pi can provide that. -- umop apisdn --- news://freenews.netfront.net/ - complaints: news@netfront.net ---