Acoustic Positioning System

by darthrappers in Circuits > Sensors

68 Views, 3 Favorites, 0 Comments

Acoustic Positioning System

image14.png

Our goal is to revolutionize underwater exploration by developing a high-speed communication system that uses light to transmit data, enabling real-time access to sensor data. This innovative solution allows researchers to capture and transmit underwater images, such as those of coral reefs, with unprecedented speed and efficiency. By relying exclusively on light for data transmission, our system ensures rapid, reliable communication in underwater environments.

But, light needs line of sight! We have developed a sound based alignment system that helps the sender (light transmitter) and receiver align for the best signal. Please refer to the instructable https://www.instructables.com/Visible-Light-Communication-System/ for the first part of our solution.

We hope this instructable provides clear instructions for anyone to build a sound based alignment device. There are many comments in the code, which will help you change any parameters to suit your needs.

Supplies

sound_bb.png
  1. Arduino Uno R4 - 1
  2. Microphone sound sensors - 1 (need 4, the link is for a 5 piece set)
  3. Breadboard - as needed
  4. Dupont wires - as needed
  5. PC/Laptop - 1

Analog Pin Connections

image3.jpg
image8.jpg
  1. Connect the Sound sensor 1 Analog pin to A0 on the Arduino
  2. Connect the Sound sensor 2 Analog pin to A1 on the Arduino
  3. Connect the Sound sensor 3 Analog pin to A2 on the Arduino
  4. Connect the Sound sensor 4 Analog pin to A3 on the Arduino

Ground & VCC Pin Connections, Through Breadboard

image16.jpg
image15.jpg
image1.jpg
image9.jpg
image5.jpg
  1. Ground Connections
  2. Connect Ground pin of Sensor 1 to a slot on the Breadboard
  3. Connect Ground pin of Sensor 2 to a slot on the Breadboard, adjacent to Sensor 1 connection, on the same row.
  4. Connect Ground pin of Sensor 3 to a slot on the Breadboard, adjacent to Sensor 2 connection, on the same row.
  5. Connect Ground pin of Sensor 4 to a slot on the Breadboard, adjacent to Sensor 3 connection, on the same row.
  6. Connect another slot on the same row to GND pin on the Arduino.
  7. Power connections
  8. Connect Power (+) pin of Sensor 1 to a slot on the Breadboard
  9. Connect Power (+) pin of Sensor 2 to a slot on the Breadboard, adjacent to Sensor 1 connection, on the same row.
  10. Connect Power pin (+) of Sensor 3 to a slot on the Breadboard, adjacent to Sensor 2 connection, on the same row.
  11. Connect Power pin (+) of Sensor 4 to a slot on the Breadboard, adjacent to Sensor 3 connection, on the same row.
  12. Connect another slot on the same row to 5v pin on the Arduino.

Connect USB-c Cable on Arduino to PC/laptop

image4.jpg

Software Environment

  1. Install Arduino IDE on PC
  2. Install Arduino UNO R4 package

Acoustic Alignment Code

This Arduino sketch demonstrates how to detect the direction of the loudest sound using four analog sound sensors and provide directional movement instructions for a drone. The code includes the following functionalities:

  1. Pin Configuration: Assigns analog pins A0 to A3 to four sound sensors for input.
  2. Threshold Setting: Defines a sound intensity threshold to filter out low-level noise.
  3. Setup Function: Initializes the serial communication at 115200 baud and sets the pins as inputs.
  4. Main Loop:
  5. Reads the analog values from the four sound sensors.
  6. Compares the sensor readings to determine the direction of the loudest sound (left, right, up, or down).
  7. Prints the corresponding movement command for the drone (e.g., "Move Drone: Toward Sensor 2 (Left)").
  8. Outputs the sensor readings for debugging purposes.
  9. Includes a short delay to stabilize the sensor readings.

This code is designed to help you integrate sound-based directional control into any receiver, offering a simple yet effective way to make your receiver responsive to sound cues.

// Pin Definitions for Sound Sensors
const int sensor1Pin = A0;
const int sensor2Pin = A1;
const int sensor3Pin = A2;
const int sensor4Pin = A3;

// Threshold for sound detection
const int threshold = 100;

void setup() {
Serial.begin(115200); // Start serial communication
pinMode(sensor1Pin, INPUT);
pinMode(sensor2Pin, INPUT);
pinMode(sensor3Pin, INPUT);
pinMode(sensor4Pin, INPUT);
}

int printed = false;

void loop() {
// Read analog values from sound sensors
int sound1 = analogRead(sensor1Pin);
int sound2 = analogRead(sensor2Pin);
int sound3 = analogRead(sensor3Pin);
int sound4 = analogRead(sensor4Pin);


// Determine the loudest sensor
if (!printed && sound1 > threshold && sound1 > sound2) {
Serial.println("Move Drone: Toward Sensor 2 (Left)");
printed = true;
} else if (!printed && sound2 > threshold && sound2 > sound1) {
Serial.println("Move Drone: Toward Sensor 1 (Right)");
printed = true;
}

if (!printed && sound3 > threshold && sound3 > sound4) {
Serial.println("Move Drone: Toward Sensor 3 (Down)");
printed = true;
} else if (!printed && sound4 > threshold && sound4 > sound3) {
Serial.println("Move Drone: Toward Sensor 3 (Up)");
printed = true;
}
// Print sensor values for debugging
if (printed) {
Serial.print("Sensor 1: "); Serial.print(sound1);
Serial.print(" | Sensor 2: "); Serial.print(sound2);
Serial.print(" | Sensor 3: "); Serial.println(sound3);
Serial.print(" | Sensor 4: "); Serial.println(sound4);
printed = false;
}
delay(100); // Short delay to stabilize readings
}

Testing

image10.jpg
image13.jpg

Arrange the microphones similar to the image and generate sound (like a clap) and check the serial monitor for instructions. Move around and generate the sound to see the instructions change!

Output will be seen on the Serial monitor in the Arduino IDE.