Site icon Circuit Ideas for You

Sound Sensor Direction Circuit using Arduino

Sound is everywhere.

Sometimes we want to know from which side sound comes.

Example in robot or in security.

With Arduino and some sound sensor we can find sound direction.

In this circuit we used four sound sensors and one OLED display with Arduino.

OLED show which side sound comes.

This project for Sound Sensor Direction Circuit using Arduino is simple and good for Arduino beginner.

Circuit Coding:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

int rightSensor = 8;
int topSensor = 9;
int leftSensor = 10;
int bottomSensor = 11;

void setup() {
pinMode(rightSensor, INPUT);
pinMode(topSensor, INPUT);
pinMode(leftSensor, INPUT);
pinMode(bottomSensor, INPUT);

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
for(;;);
}
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
}

void loop() {
int r = digitalRead(rightSensor);
int t = digitalRead(topSensor);
int l = digitalRead(leftSensor);
int b = digitalRead(bottomSensor);

display.clearDisplay();
display.setCursor(10,20);

if(r == 1) {
display.print("RIGHT");
}
else if(t == 1) {
display.print("TOP");
}
else if(l == 1) {
display.print("LEFT");
}
else if(b == 1) {
display.print("BOTTOM");
}
else {
display.print("NO SOUND");
}

display.display();
delay(100);
}

Code Explanation:

Circuit Working:

Parts List:

ComponentQuantity
Arduino UNO R4 WiFi1
MAX4466 Microphone Amplifier Module4
0.96 OLED Display (128 x 64 px)1

In the above circuit diagram when sound comes one sensor will sense it first.

Arduino will check which sensor gave signal.

If right sensor hears sound first then Arduino decides sound came from right side.

If left sensor hears first then it is from left.

Same for top and bottom.

Arduino will then show direction on OLED screen.

Formula:

Below the only simple logic formula for Sound Sensor Direction Circuit using Arduino:

Time difference between sensors tells the direction.

For example T1 is time when sensor 1 detects sound and T2 is time for sensor 2 then whichever is smaller means that side sound came from.

Direction = sensor with minimum detection time.

When sound comes it reaches one sensor first.

Every sensor gives signal at a different small time.

The one that gets sound first has minimum detection time.

So direction = that sensor side.

How to Build:

To build a Sound Sensor Direction Circuit using Arduino follow the below steps for connections:

Connections of MAX4466 Microphone Amplifier Module:

Connection of OLED Display:

Testing:

Conclusion:

This Sound Sensor Direction Circuit using Arduino shows how easily we can detect direction of sound with Arduino using four sensors.

It is a good starting project to learn sound sensors, OLED display and Arduino programming.

We can improve it by using more sensors, better calculation or adding motors to rotate toward sound.

References:

Locating the Sound Source by using 3 Sound sensors in 2D

Exit mobile version