Detecting moment of impact of sound waves

Discussion in 'The Projects Forum' started by aqpham1, Oct 28, 2009.

  1. aqpham1

    Thread Starter New Member

    Oct 28, 2009
    I'm trying to build a project that detects a sound source's location with three transducers/microphones and multilateration. I need to find a way to know the exact time the microphones detects the sound source.

    How I've done the project so far is, i've connected the microphone to a bandass, then to an op amp that outputs a square wave(358), then the signal is fed to an MCU that triggers an interrupts through input capture and stores the value of the counter(time stamps).

    The problem is, the time stamps are very inaccurate. After connecting an oscilloscope to each of my microphone and looking at the signals through labview, i noticed that the sound signals gets distorted from 1 microphone to the other so it doesn't trigger the 2nd interrupt at the right time.

    I thought about just making a bridge rectifier to get rid of this problem, but i can't get it to work =(. Any suggestions?
  2. davebee

    Well-Known Member

    Oct 22, 2008
    So are like three different timestamps from three different receivers collected and compared?

    Are the multiple receivers using the same clock for the timestamp? Or if not, how is the initial time synchronization done?

    It may be that you just need to track down the worst sources of timing uncertainty one by one and fix them until you've arrived at an accuracy you're satisfied with.
  3. someonesdad

    Senior Member

    Jul 7, 2009
    Sounds like an interesting project. What are the characteristics of the sound source(s)? It sounds like you're trying to detect the leading edge of a transient noise rather than e.g. measure the amplitude and phase of a continuous signal. What about background noises?

    If the sound source is something like an impact, then perhaps the input electronics can simply be something that takes the absolute value and sends this to a comparator. You adjust the threshold to detect the signals of interest. I'd imagine how well this would work would depend on what range of amplitudes you want to detect and how much background noise there is.

    Let's do some back of the envelope numbers. The velocity of sound in air is about 330 m/s or 33,000 cm/s. Take the inverse of that to get 30 μs/cm. Thus, excluding triangulation errors, you need to be able to locate the sound's arrival in time to about 30 μs to locate something within 1 cm. Now, the inverse of 30 μs is about 33 kHz, so your microphone needs to be able to respond at least that quickly to get this resolution. That may be a problem. You'll certainly want to first characterize the microphone's response to see if it's capable of such resolution. On the surface, this should be pretty easy to do by just hitting a speaker with a pulse, then looking for the pulse on the microphone's output. But it's complicated by the fact that you're in the ultrasonic region, so you'll need to be careful about what speaker you use.

    I'll assume you've done your due diligence and constructed some theoretical models of such a measurement scheme and used that to guide your design. I'd appreciate seeing the numbers you've come up with and your basic design goals. There's no doubt an enormous body of work on this type of thing in the literature (sonar, GPS), so you certainly want to leverage the knowledge of others.

    Sound measurements can get complex in the real world -- sometimes you have to worry about reflections, dispersion, resonances, etc. Send us some more details and perhaps we can help some more -- I'm interested in learning more about what you wind up doing.
  4. SgtWookie


    Jul 17, 2007
    I'm afraid that by using an LM358 opamp in open loop (maximum gain), you're shooting yourself in the proverbial foot. Even at unity gain, their bandwidth is only 0.7MHz, and slew rate at unity gain is 0.3v/uS.

    You'd be better off using a high-speed comparator. They're designed to be operated open loop.
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    An alternative is to use the first detection to start a clock which makes a count at the other mic circuits. When each of them in turn hears the sound, the local count is frozen. This identifies the mic to respond first, and can give a much finer time granularity to the delay in the sound reaching the other two mics (no interrupt routines to service).

    Reading in the counters lets you know the geometry of the sound arrival. The counter equal to zero is the first, and the others can be determined by the respective magnitudes of the values in their counters.
  6. aqpham1

    Thread Starter New Member

    Oct 28, 2009
    Yes three different receivers are used and each receiver is connected to an op amp which is then connected to a corresponding pin on the MCU.

    Each pin, when it detects a rising edge, will trigger an interrupt and timestamp the signal. After three interrupts have occured from 3 different receivers, the time difference of arrive is calculated by taking the difference in clock counter multiplied by the time it takes the MCU to increment once. This will give me the time difference to a degree if error.

    The degree of resolution i have is 125[ns] so it's well above 30[us]. The thing is, i just need to know the exact moment the receivers detects the slightest voltage. I thought about cascade amplifying the signal so i get a square wave, driving the op amps to saturation when it sees say 10[mV] and anything greater.

    The problem I'm having is, I placed each receiver in a traingle and a magnitude of 60[cm] apart so when i'm directly in front of two receivers, it should only take the sound source around .60/343(speed of sound we're using) = 1.75[ms] to get from 1 receiver to the 2nd. However, according to my time stamps in the MCU, it takes it about 2.2[ms] to 5[ms] and somtimes it's dead on at 1.75[ms]. That's when I knew it was my analog circuits thats causing this problem.

    This is the ONLY hurdle i have to get over because i have already programmed the Multilateration equations and the newton raphson equations to solve for the time difference, and it works provided that my time stamps are more accurate.

    As for the characteristics of the sound source, I'm debating between a whistle or a hand clap.

    I do have a lot of research and models for this project but it's going to be a bit much. My ultimate goal is to be able to detect a sound source up to 5 meters away from the device(made of 3 receivers). This 5 meters can be upgraded but due to time constraint, i've settled for 5 meters for now. I'm in the process of testing, but I will be back to give more information.
  7. beenthere

    Retired Moderator

    Apr 20, 2004
    As to -
    - see #5.

    That gets you around the problem -