Triangulation of Sound - Using Microphones as Directional Sensors


This report documents the use of three microphones as directional sensors. Triangulation is the process by which the location of a sound can be determined by measuring the distance or direction of the received signal from 3 different points. Triangulation is used for many purposes, including surveying, navigation, metrology, astrometry (interplanetary triangulation), binocular vision and gun direction of weapons. Using three Super Snooper Big Ear Audio Amplifiers placed in 3 separate locations on an object, I will try to determine the location of a sound emitting from somewhere in a room.


Process

The first step was to assemble the SuperSnoopers. I assembled the parts into piles and labeled them with their part numbers so I could assemble them quickly without having to look up the reference numbers.

The soldering went smoothly until it was time to add the microphones. It was difficult to strip the casing from the wires without cutting the wires, and a couple times the wires came unattached to the microphone. I had to re-solder the wires to the mics. Fortunately, I had an extra SuperSnooper in case of mistakes. If one of the Snoopers doesn't work, I have a backup.

I started with one snooper to see if I could read the incoming data. I hooked up the speaker out wires, scratched the surface of the mic, and heard the response through the a speaker from an answering machine. I used the oscilloscope to check the signal as well.

The values were jumping all over the place, so I added a smoothing function to the code and a 10k resistor, and then the values smoothed out a bit, and jumped nicely when a sound was made. Room noise may still be a problem.

When I tested all four of the snoopers, one stopped working, and the other three had two completely different volume input levels. Then one of the three I had left stopped working as well, I think I soldered too close to the microphone head. The problem turned out to be a bad battery, so I still had three snoopers to work with, even with the one casualty.

The plan was to place the snoopers in a triangle two feet from each other, hit the claves in the center, then use the incoming data to determine the exact position of the noise.

I taped out the area in my living room, and had a friend stand in the middle of the triangle and strike the claves once, count to 5, strike again, etc. I used Tom Igoe's Datalogger Multi code to view the incoming data, and all three of the readings from the snoopers looked the same, even with the smoothing value function I had added to the Arduino code. The snoopers were unable to pick up the clave noise, and had too much noise in general to be effective, and an accurate distance to signal ratio is necessary to triangulate. The three different colors in the diagram each represent a unique snooper signal, but they did not read unique data. I suggest swapping the snooper mics for a higher quality microphone to effectively complete the experiment.

The appropriate process for triangulation of sound would be:

1. Find the average of the readings made by the clave sound

2. In the event that the snoopers are reading adequate data, you can use the distance formula to triangulate the sound emitted and subsequently find its location

3. Diagram triangulation scenario

(R0_x, R0_y) = coordinates of snooper 1
(R1_x, R1_y) = coordinates of snooper 2
(R2_x, R2_y) = coordinates of snooper 3
D0 = distance of sound source to snooper 1
D1 = distance of sound source to snooper 2
D2 = distance of sound source to snooper 3
S = location of clave sound

4. Use distance formula to create 3 equations:

KEY: ^2 = to the 2nd power

P = S (average of clave reading)

 A: (Px  R0_x)^2 + (Py  R0_y)^2 = D0^2
 B: (Px  R1_x)^2 + (Py  R1_y)^2 = D1^2
 C: (Px  R2_x)^2 + (Py  R2_y)^2 = D2^2

5. Then reduce to two equations where a, b, c, d, e are constants:

 A  B: a*Px + b*Py = e
 B - C: c*Px + d*Py = f

6. Use Cramer's Rule to solve the two equations

7. Px and Py will give you the location of the clave sound, and triangulation of sound is accomplished.


Arduino Code For Triangulation Report

int superSnooper = 0; // select the input pin for the Super Snooper
int superSnooper2 = 1;
int superSnooper3 = 2;
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
int val2 = 0;
int val3 = 0;
/*long smoothValue = 0;// to smoothen out analog value
 long smoothValue2 = 0;
 long smoothValue3 = 0;
 */

void setup() {
  pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
  pinMode(superSnooper, INPUT); // reads analog value for speaker
  pinMode(superSnooper2, INPUT);
  pinMode(superSnooper3, INPUT);
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
  digitalWrite(ledPin, HIGH); // sets the LED off
  val = analogRead(superSnooper/4); // read the value from the sensor
  val2 = analogRead(superSnooper2/4);
  val3 = analogRead(superSnooper3/4);
  Serial.print("A\t"); //
  Serial.print(val, DEC); // print as an ASCII-encoded decimal
  Serial.print(10, BYTE);// terminating character
  Serial.print("B\t");
  Serial.print(val2, DEC);
  Serial.print(10, BYTE);
  Serial.print("C\t");
  Serial.print(val3, DEC);
  Serial.print(10, BYTE);
  //delay(20);
  delay(10);
  smoothValue = 0;
  for(int i = 0; i < 10; i++){
    smoothValue += analogRead(superSnooper);
    //delayMillisecond()
  }
  smoothValue2 = 0;
  for(int i = 0; i < 10; i++){
    smoothValue2 += analogRead(superSnooper2);
    //delayMillisecond()
  }
  smoothValue3 = 0;
  for(int i = 0; i < 10; i++){
    smoothValue3 += analogRead(superSnooper3);
    //delayMillisecond()
  }
  smoothValue = smoothValue/10;
  smoothValue2 = smoothValue2/10;
  smoothValue3 = smoothValue3/10;
}
 

Processing Code

Distance Formula Calculator

Triangulation Equation adapted from this Bluetooth Triangulation report: (pdf)

Successful sound triangulation reports: 3D Acoustic Source Localization and Sound Triangulation (pdf)