DIY sound localization sensor

sound_localization_sensor

Sound localization is very popular in law enforcement circles due to its accuracy and ability to quickly separate gunshots from other similar noises. These systems don’t come cheap, and after trying to build one himself, [Fileark] knows why.

He thought it would be neat to build a sound localization sensor based on how the human ear determines a sound’s source. Once he got started however, he realized just how hard it was to do localization just right.

He used an LM324N op-amp as a volume comparator, which he says works decently enough though he figures there are ICs out there that can do a better job. [Fileark] reports that the sound detector works well when the source is within about a foot of the sensors, but performance deteriorates at greater distances. He may consider using an ARM Cortex-M3 as his sound processor if he builds a second version, since the Arudino he used just doesn’t have enough power to sample and run calculations within the 10-50 microsecond window he requires.

Keep reading to see a video of his sound localization sensor in action.

Comments

  1. Ib says:

    Nice Idea!
    I loled when he started shouting in the sensor.
    “Hellooo”

  2. lwatcdr says:

    “He may consider using an ARM Cortex-M3 as his sound processor if he builds a second version, since the Arudino he used just doesn’t have enough power to sample and run calculations within the 10-50 microsecond window he requires.”

    Why not a PC? Lots of processing power there and odds are he has one.

  3. ZeroCool42 says:

    lwatcdr: My guess, he wants to put it on a robot…

  4. lwatcdr says:

    @ZeroCool42. Ahh good point. I would still prototype it on a PC for ease of development but that is just me.

  5. fm says:

    Doesn’t the Kinect have a bunch of microphones built in for a similar purpose?

  6. obsoehollerith says:

    Those cheap fet mics have a fairly consistent omni response, that would seem reasonable if you’re trying to mimic the human localization scheme, but how about using tight hypercardioid dynamics that have a response peak in the part of the spectrum that you want to localize, and then measure the phase relationship to determine your direction? Sure it’d be expensive-but think of the bragging rights! lol

  7. Fileark says:

    @lwatcdr, I agree that prototyping sound localization should probably be done on a PC first before moving to a microcontroller.

    @fm, Wow, thanks for the Kinect tip, it looks like Microsoft included the microphones to eventually possibly use for sound localization but have not realy implemented it yet. I am looking and can’t find any hackers that have done it yet either. I always wanted an Xbox…

  8. D_ says:

    I wonder if one could duplicate the human outer ear well enough, this could be done with just 2 microphones? Maybe duplicating the ears of another of Earth’s creatures would better easier? I wonder if time difference of arrival techniques are easily achievable at audio? Probably not not as easy it is are RF. An entertaining application would be a robotic head at the side of the roadway, that would focus on vehicles as they approach, following them as they pass by.

  9. Retro says:

    I think HaD has put an arduino in my brain. I can’t tell you how often I have started some new project or gotten some new wierd hardware, and then suddenly a few days later, HaD has a story on it.

    Example: Last week, a friend gave me a tranz380 credit card terminal to play with, and then *poof* a story about hacking a tranz330.

    And just today I was reverse engineering a phase detector circuit at work to troubleshoot it and started realizing that I could use it to build a sound locater. Drew some schematics on a napkin and everything. I come home (my work thinks HaD is about hacking and banned it. :( )and get on here, and *poof* there is a story about a sound localizer.

    Very odd…

  10. Quin says:

    @D_ on one hand, audio should be easier than RF, because the speed of sound through air is shorter. Using just peaks, like a gunshot, and ignoring echos, you need about a foot of separation and the ability to measure under 1ms difference.

    The problem with determining direction by phase is that A above middle C has a wave length of about 1.2 feet, so depending on how close or far apart your two sensors are you could get some bad data. And, since the peak of the phase moves at the same speed as above, with just 1 foot separating the mics, you will need a fast response time.

    If you treat the Arduino like just another AVR proto-board, and program low level, the interrupts might be fast enough to trigger under 100us. The Arduino language wrapper, though, will be too slow I think.

  11. Terry says:

    The sound pickup device needs to remain stationary. Eliminate the center pickup. Four microphones, one on each corner, are needed for surround sensing. Place the microphones in PVC tubing for greater directionality. Add some foam to reduce wind noise.

    Much of your problem is from overwhelming the sensor with noise from the servo. You might want to consider increasing the gain on the preamp just a tad. What good is it if you need to scream into it’s ears as if at a loud concert. Heh? What’d you say?! Can’t hear you over the music.

    Implement a sample/hold circuit by adding another op-amp to the circuit between the preamp and uP. This will solve the 10-50uS timing issue by latching the analog signal until the uP has time to service it.

  12. zool says:

    pretty cool

  13. Marks says:

    Analog devices Blackfin DSPs 400Mhz – 4 dollars

  14. Justin Case says:

    Have you listened through head phones to what your mics hear?
    I wonder if the servo makes too much common noise.

    If the two mic signals are summed then used as cancellation feedback into each channel, perhaps that would help.
    Then when the sound is equal on both mics, there is no signal so the unit need not move.-?
    Perhaps high-pass filtering, as high freq is more directional as one decision input.
    Then low pass as the other decision input.
    Phase and echo may be misleading as data depending on the rule set.
    It’s strange how we can also tell above left/right or below left/right as I listen to snoring to my lower-right.
    Perhaps in-phase delay could be used for triangulation as the delay is the vector in the hypotenuse of a triangle???(+ve) is left, (-ve) is right?
    For those who know FFT (not me), would that help here??

  15. monster says:

    wonder if he thought about moving the ears further apart. that way he’d have a larger timeframe to sample

  16. DudeGuy says:

    Combine this with the Portal Sentry. Unbelievable amazingness will ensue.

  17. Hackius says:

    I’m pretty sure this is a job for a DSP

  18. bacchus says:

    I’m not sure that comparisons with gunshot locaters are helpful.

    Vehicle mounted ones appear to use at least 5 microphones, and they’re dealing with distinctive sounds, so are presumably optimized for this purpose. On top of this, I’ll bet they throw some hefty processing power at the problem, justified given these things are about saving lives.

    Interesting project though – I suspect Hackius is right about using a DSP, particularly if the end product needs to be reasonably small.

  19. Mike says:

    I once built a sound localization program in C# – it actually worked pretty well. All you need is 2 (decent) microphones, cross-correlate the two signals and then make a few simple calculations.

  20. Fileark says:

    @Mike, Do you still have the C# program? It would be more helpful than just saying “make a few simple calculations” I would LOVE any kind of code samples from anyone as all you can find on the web are just detail-less demonstrations of university projects. You can always contact me on my website http://filear.com/index.php/contact

  21. poslathian says:

    Ive fooled around with sound triangulation (via timing) before with a Maple (cortex m3) board. The build was an X,Y tap sensitive wall. Turns out, with a fast enough proc, the timing resolution was easy. What was hard, was tuning the amplifier on the piezo sensors so that they would spike from a tap (potentially far away), but not from random talking and movement in the room.

    Seemed like an easy problem, but really took me a long time to get right!

  22. Justin Case says:

    I see lots of people making audio spectrum anaylzers out of all sorts of microcontrollers/LCD display combinations.
    Nice ones too!!
    Can’t be that hard to learn…

    I would like to learn to program FFT for monkeying with audio signals.
    Online suggestions???

  23. ThePostman says:
  24. Travis says:

    Here’s a sound locating van I developed, used for tracking birds:

    Microphone Array

  25. shahidali says:

    hi all,
    m doing a project on design and development of 3D audio in which i should be able to localize (finding location of sound source ) sound using headphones.i need this project in detail.its code,implementation of code on hrdware,hrdware/pc etc
    any help in this will be highly appreciated
    thanks

  26. hans says:

    @shahidali, can you be more specific? What will it be used for?

  27. shahidali says:

    hi buddies….
    it serves many purposes….ths can be used in collision avoidance in aircrafts (localizing th warning tone)etc…but my scope is crude as i have to make a GUI in which i should take a tone and give sme phase shift to localize the tone…m thinking of using visual studio wth XNA games studio to produce th 2D or 3D effect……..kindly suggest a suitable software wth xamples,code etc to produce the effects….

  28. sunwukong says:

    There is an audio spectrum analysis program for ham operators that features a DSP type setup to do RDF. It would probably be feasable to re work the program to solve this problem. Its called SpecLab by Wolfgang Buescher, see link at

    http://www.qsl.net/dl4yhf/spectra1.html

  29. Sunwukong says:

    I’ve gotten good results by taking a stereo harness and hooking up two mics (one mic reversed from the other) with small caps across the mic leads. I record a sound and move around while recording then when I play it back I can “hear” the movement.

    Its interesting to play a single tone over computer speakers then slowly move around between the two speakers you can “hear” where the nodes are as the sound gets stronger at a node, then fades.

  30. goosenoose says:

    i could see this being used in wartime applications.. say, soldiers carry a portable tripod with something like this attached to the top.

    it would be used in defensive applications.. posted in a visible spot to soldiers and, if ambushed. set down.

    soldiers would have to train to be silent to allow it to detect where shots are coming from..

    i would invest in research for this ha..

  31. JB says:

    could see this being used in wartime applications.. say, soldiers carry a portable tripod with something like this attached to the top.
    it would be used in defensive applications.. posted in a visible spot to soldiers and, if ambushed. set down.
    soldiers would have to train to be silent to allow it to detect where shots are coming from..
    i would invest in research for this ha..

    THIS HAS ALREADY BEEN DONE AND IS ALREADY IN USE…. HOWEVER IT WOULD STILL BE NICE TO GET A DIRECTIONAL FIX ON A RANGE OF SOUND FREQUENCIES AND OR SPECIFIC FREQUENCIES

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,704 other followers