Objective: Detect sound using the Sound sensor.
Things required for this project:
- Sound sensor
- Jumpers wires
- Arduino Uno
Let’s begin!
In this unit, we will detect sound using a sound sensor. The sound sensor gives a digital output. If the sound detected by the sensor exceeds a threshold value, the output goes HIGH.
This threshold is set using an onboard potentiometer and an LM393 OpAmp IC.
First, you need to plug in the sound sensor into your breadboard. Connect the ground pin of the sensor to a GND terminal of the Arduino. Now, connect the Vin pin to the 5V bus of the Arduino, and the output pin to digital pin 2 of the Arduino.
Circuit
Code
void setup(){
pinMode(2,INPUT);
Serial.begin(9600);
}
void loop(){
if (digitalRead(2)==HIGH)
{
Serial.println("Sound Detected!");
}
else
{
Serial.println("No Sound");
}
}
There you go!
No comments:
Post a Comment