This article covers the basics of sound sensor and its interfacing with Arduino.
In this fully automated world, we want to operate the things through the sound for our easyness. To make this automation, we need Sound sensor. In this article, we are going to learn about the basics of sound sensor. Also, here we will learn about the interfacing sound sensor with arduino.
What is Sound Sensor?
Basically, Sound is a waveform of energy which is produced by the form of mechanical vibration. The type of sound determines its frequency. For example, a bass drum has a low-frequency sound and a cymbal has a higher frequency sound. The sound sensor is a simple device which can detect the sound. The sound sensors are very simple to use.
Pin Configuration and Components
The sound sensor consist of Microphone as a transducer, potentionmeter to adjust the intensity, LM386 low power audio amlifier, LED and other passive components like resistors and capacitors.
You can set a threshold value using a potentiometer so that when the amplitude of the sound exceeds the threshold value, the module will output LOW otherwise HIGH.
This sensor includes 3 pins and they are,
- Pin1 (VCC): 3.3V DC to 5V DC
- Pin2 (GND): This is aground pin
- Pin3 (OUT): This is an output pin. It provides high signal when there is no sound and goes LOW when sound is detected. You can connect it to any digital pin on an Arduino or directly to a 5V relay or similar device.
Working Principle of Sound Sensor
It works similar to our ears. Our Ears have a diaphragm which converts the detected the vibration and converts it in the signal. Similarly, the sound sensors convert the vibration into audio signal (voltage and current proportional) with the help of a microphone.
This microphone has an inbuilt diaphragm, made up of magnets which are coiled by metal wire. Whenever sound waves hits the diaphragm, magnets vibrate and at the same time coil induces the current.
Interfacing of Sound Sensor with Arduino Uno
Let’s hook the sound sensor with Arduino Uno. Connections are small and simple. Here we connect Vcc to 5V, Gnd to Gnd of arduino uno and connect the OUT pin to the D8 pin of Arduino. That’s it!
For output indiaction, we connect the 100k resistor and one LED to D12.
Download the Arduino IDE from the below link and use the below code.
const int ledPin = 12;
const int soundPin = 8;
int soundVal = 0;
void setup ()
{
pinMode (ledPin, OUTPUT);
pinMode (soundPin, INPUT);
Serial.begin (9600);
}
void loop ()
{
soundVal = digitalRead(soundPin);
if (soundVal == HIGH)
{
digitalWrite(ledPin, HIGH);
Serial.println("Clap detected");
delay(1000);
}
else
{
digitalWrite(ledPin,LOW);
}
}
The below GIF shows that the LED is ON, as the clap is detected.
Simultaneously, you can see the output on the serial window of Arduino IDE.
Applications of Sound Sensor
- Security system for Office or Home
- Spy Circuit
- Home Automation
- Robotics
- Smart Phones
- Ambient sound recognition
- Audio amplifier
- Sound level recognition
This blog discusses the complete overview of the sound sensor. Hope this article helps you to understand the working principle, Interfacing and Applications of sound sensor.
lovely project good to see
thankyou
lovely
Very cool explanation