Compact, high-sensitivity sound detection module (KY-037). Works with Arduino, ESP32, ESP8266 and Raspberry Pi. Use analog (AO) for level monitoring or digital (DO) for simple threshold detection. Ready code examples show how to trigger a relay/LED or send an HTTP request to WLED when a sound event is detected.
| Model | KY-037 |
| Outputs | Analog AO, Digital DO |
| Supply Voltage | 3.3V – 5V |
| Sensitivity Control | Onboard Potentiometer |
| Mounting | Breadboard / PCB Header |
| Condition | New |
| Brand | Unbranded / Generic |
| MPN | Does Not Apply |
| Type | Sound Detection Module |
| Interface | Analog & Digital |
| Compatible With | Arduino, ESP32, ESP8266, Raspberry Pi |
| Condition | New |
Typical pins on the module: VCC, GND, DO (digital, thresholded), AO (analog level). Connect as below:
Note: Use AO for raw sound level monitoring and DO if you want a simple threshold trigger (clap detection, knock sensor, etc.). For WLED integration the module can trigger an ESP32 which then sends an HTTP request to WLED — see examples below.
# ESPHome YAML — KY-037 sound sensor (ESP32) -> trigger WLED via HTTP
esphome:
name: ky037_sound_node
platform: ESP32
board: esp32dev
wifi:
ssid: "YOUR_SSID"
password: "YOUR_PASSWORD"
logger:
api:
ota:
# ADC sensor (AO) — raw analog level
sensor:
- platform: adc
pin: 35 # AO connected to ADC pin (change as required)
name: "Sound Level (Raw)"
id: sound_raw
update_interval: 1s
accuracy_decimals: 2
unit_of_measurement: "V"
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 1
# Digital threshold (DO)
binary_sensor:
- platform: gpio
pin:
number: 13 # DO pin wired here
mode: INPUT_PULLUP # adjust depending on module wiring
inverted: false
name: "Sound Threshold (DO)"
id: sound_do
on_press:
then:
- logger.log: "Sound DO triggered — toggling WLED"
# Example: send HTTP request to WLED to toggle (replace WLED_IP)
- http_request.post:
url: "http://WLED_IP/json/state"
headers:
Content-Type: "application/json"
body: '{"on":true}'
timeout: 5000
- delay: 500ms
- http_request.post:
url: "http://WLED_IP/json/state"
headers:
Content-Type: "application/json"
body: '{"on":false}'
timeout: 5000
# Optional automation: act when analog level above a threshold
script:
- id: check_sound_level
then:
- lambda: |-
if (id(sound_raw).state > 1.0) { // example threshold in volts
ESP_LOGD("sound", "Analog threshold crossed: %f", id(sound_raw).state);
// add actions here (e.g., toggle local relay or call WLED)
}
# Optional: expose sensor to Home Assistant via API (api: above) for automations
Replace WLED_IP with your WLED device IP. The example sends a quick ON then OFF; modify body JSON to set colors/effects. Using WLED JSON endpoint requires WLED to have JSON API enabled (default).
// Arduino (ESP32) — KY-037 sound sensor example
// AO -> ADC (e.g., 35), DO -> digital (e.g., 13), RELAY -> digital (e.g., 25)
// For WLED HTTP calls, uncomment WiFi / HTTP sections and add WLED IP
#include <WiFi.h> // only needed for HTTP to WLED
#include <HTTPClient.h> // only needed for HTTP to WLED
const int pinAO = 35; // analog out
const int pinDO = 13; // digital out (threshold)
const int pinRelay = 25; // relay or LED to indicate trigger
// ---- Optional WLED settings (for HTTP trigger) ----
// const char* ssid = "YOUR_SSID";
// const char* password = "YOUR_PASS";
// const char* wledIP = "http://WLED_IP/json/state";
void setup() {
Serial.begin(115200);
pinMode(pinDO, INPUT);
pinMode(pinRelay, OUTPUT);
digitalWrite(pinRelay, LOW);
// Optional: WiFi.begin(ssid, password) if using WLED HTTP
}
void loop() {
int analogRaw = analogRead(pinAO); // 0..4095 on many ESP32 cores
float voltage = analogRaw * (3.3 / 4095.0);
int doState = digitalRead(pinDO);
Serial.printf("AO raw: %d V: %.2f DO: %d\n", analogRaw, voltage, doState);
// If digital output goes HIGH (or LOW depending on module), toggle relay
if (doState == HIGH) {
digitalWrite(pinRelay, HIGH); // activate relay / indicator
delay(200); // keep it on briefly
digitalWrite(pinRelay, LOW);
}
// Optional: call WLED via HTTP to toggle or set effect
/*
if (doState == HIGH) {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(String(wledIP)); // e.g. "http://192.168.1.50/json/state"
http.addHeader("Content-Type", "application/json");
int httpCode = http.POST("{\"on\":true}");
Serial.printf("WLED HTTP POST returned %d\n", httpCode);
http.end();
}
}
*/
delay(200); // sample rate
}
Notes: adjust ADC pin and digital pin to match your board. The DO pin logic depends on the module sensitivity potentiometer and module version (test on bench first). If using WLED HTTP, enable Wi-Fi and set the WLED device IP.
Ships from UK. International shipping via Global Shipping Programme. 30-day returns accepted.