Sound Detection Sensor(LM393)
This sensor utilizes a microphone to detect ambient sound.
Specifications
- Operating Voltage: 4V ~ 6V
- Digital output
- Sensitivity adjustable via a variable resistor
Example Required Hardware
- Arduino board
- Jumper cables
- Sound detection module
- LED
- 330 ohm resistor
Connection
Arduino | Sound Detection Module | LED | Resistor |
5V | 5V | ||
GND | GND | K | |
A2 | OUT | ||
D2 | connected | ||
A | connected |
Example Code
This example toggles an LED ON/OFF when sound is detected.
const int soundPin = A2;
const int LED = 2;
void setup() {
pinMode(LED, OUTPUT);
pinMode(soundPin, INPUT);
digitalWrite(LED, LOW);
}
void loop() {
if (digitalRead(soundPin) == HIGH) {
digitalWrite(LED, !(digitalRead(LED)));
delay(100);
}
}
Execution Result
Please check the provided link for the operation video.