Sound Detection Module(KY-037)
The Sound Detection Module (KY-037) is a compact and versatile sensor designed for detecting sound levels in the environment. It's commonly used in projects that require noise or sound detection capabilities, such as voice-activated systems, security alarms, or environmental sound monitoring.
Specifications
- Operating Voltage: 3.3V ~ 5V
- Output Type: Digital, Analog
Connection
The circuit utilized in the example code below.
An LED can be replaced with another module or omitted entirely.
Resistor | Sound Detection Module | LED | Arduino | |||
VCC | 5V | |||||
GND | - | GND | ||||
Connection | + | |||||
DO | D8 | |||||
Connection | D7 |
Example Code
// Code that lights up the LED when the module detects sound.
#define led_pin 7
#define sound_pin 8
float state = 0;
void setup() {
pinMode(led_pin, OUTPUT);
digitalWrite(led_pin, LOW);
pinMode(sound_pin, INPUT);
}
void loop() {
state = digitalRead(sound_pin);
if (state == 1) {
digitalWrite(led_pin, HIGH);
delay(500);
} else digitalWrite(led_pin, LOW);
}