Overview
The KY-037 is a sound detection module that turns audio from a high-sensitivity electret microphone into both analog and digital signals. The analog output lets you read continuous sound levels (useful for VU meters, noise logging, or clap-pattern detection), while the digital output toggles when the sound crosses a threshold you set with the onboard potentiometer — perfect for triggering actions with a hand clap, a knock, or a bark.
Because it has both outputs, the KY-037 is more flexible than most sound modules. Pair the digital output with a microcontroller like the Arduino for simple "did it hear something?" logic, or use the analog output with an ADC to measure relative loudness. The board also has two LEDs: one for power and one that lights when the digital threshold fires.
This manual covers specifications, the pinout, wiring for Arduino, ESP32, Raspberry Pi, and the Pico, a "hello world" example per platform, and FAQs about tuning the threshold and cleaning up noisy readings.
At a Glance
Specifications
| Parameter | Value |
| Microphone | Electret condenser (high sensitivity) |
| Comparator IC | LM393 |
| Operating Voltage | 3.3V - 5V |
| Analog Output | 0V to VCC (follows amplified mic envelope) |
| Digital Output | 0V / VCC (LOW when sound > threshold) |
| Threshold | Adjustable via onboard potentiometer |
| Indicators | Power LED + trigger LED |
| Current Draw | ~4 - 8 mA |
| Board Format | 4-pin header (male pins) |
| Pin Count | 4 (AO, GND, VCC, DO) |
Pinout Diagram
Wiring Guide
Arduino Wiring
Wire the analog output to an analog input for loudness readings, and the digital output to any digital pin for threshold triggers.
| Module Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| AO (Analog) | A0 |
| DO (Digital) | D2 (or any digital pin) |
ESP32 Wiring
Power from 3.3V. Use any ADC1 pin (GPIO 32–39) for the analog output.
| Module Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| AO (Analog) | GPIO 34 (ADC1_CH6) |
| DO (Digital) | GPIO 4 |
Raspberry Pi Wiring
The Pi has no analog input, so the analog pin needs an external ADC (like an ADS1115) to read loudness. The digital output can connect directly to a GPIO.
| Module Pin | Raspberry Pi Pin |
|---|---|
| VCC | 3.3V (Pin 1) |
| GND | GND (Pin 6) |
| AO (Analog) | ADC channel (e.g., ADS1115 A0) |
| DO (Digital) | GPIO 17 (Pin 11) |
Raspberry Pi Pico Wiring
The Pico has three ADC-capable pins (GP26, GP27, GP28). Connect the KY-037 analog output to any of them.
| Module Pin | Pico Pin |
|---|---|
| VCC | 3.3V (Pin 36) |
| GND | GND (Pin 38) |
| AO (Analog) | GP26 (ADC0, Pin 31) |
| DO (Digital) | GP15 (Pin 20) |
Code Examples
Arduino
// KY-037 Sound Sensor - read analog level and digital trigger
const int analogPin = A0;
const int digitalPin = 2;
const int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(digitalPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int level = analogRead(analogPin);
int trig = digitalRead(digitalPin);
Serial.print("Level: ");
Serial.print(level);
Serial.print("\tTrigger: ");
Serial.println(trig == LOW ? "SOUND!" : "quiet");
digitalWrite(ledPin, trig == LOW ? HIGH : LOW);
delay(50);
}
ESP32
// KY-037 on ESP32 - analog + digital read
const int analogPin = 34;
const int digitalPin = 4;
void setup() {
Serial.begin(115200);
pinMode(digitalPin, INPUT);
}
void loop() {
int level = analogRead(analogPin); // 0..4095
int trig = digitalRead(digitalPin);
Serial.printf("Level: %4d Trigger: %s\n",
level, trig == LOW ? "SOUND!" : "quiet");
delay(50);
}
Raspberry Pi
# KY-037 digital trigger on Raspberry Pi
# Install: pip install gpiozero
from gpiozero import DigitalInputDevice
from time import sleep
sound = DigitalInputDevice(17) # DO pin
print("Listening for sound... (Ctrl+C to quit)")
while True:
if not sound.value: # LOW = above threshold on KY-037
print("Sound detected!")
sleep(0.2) # debounce
sleep(0.01)
Raspberry Pi Pico (MicroPython)
# KY-037 on Pico - analog loudness + digital threshold
from machine import ADC, Pin
import time
analog = ADC(Pin(26)) # GP26 = ADC0
digital = Pin(15, Pin.IN)
led = Pin(25, Pin.OUT) # onboard LED
while True:
level = analog.read_u16() # 0..65535
trig = digital.value()
print("Level: {:5d} Trigger: {}".format(
level, "SOUND!" if trig == 0 else "quiet"))
led.value(0 if trig == 0 else 1)
time.sleep_ms(50)