Documentation

KY-037 Sound Sensor Module with Analog
Documentation / KY-037 Sound Sensor Module with Analog

KY-037 Sound Sensor Module with Analog

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

Voltage
3.3V - 5V
Outputs
Analog + Digital
Mic Type
Electret condenser
Digital Comparator
LM393
Threshold
Pot-adjustable
Pins
4 (AO, GND, VCC, DO)

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

KY-037 Sound Sensor 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)
Tip: Turn the potentiometer so the trigger LED is OFF in a quiet room, then back off slightly until a clap or clap reliably flips it on.

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
Warning: Avoid ADC2 pins (GPIO 0, 2, 4, 12–15, 25–27) if you're using Wi-Fi — ADC2 conflicts with the Wi-Fi radio.

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)
Info: If you only need threshold-triggered sound detection (claps, knocks), the digital output alone works fine — no ADC needed.

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

ky037_sound.ino
// 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

ky037_esp32.ino
// 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

ky037_digital.py
# 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)

ky037_pico.py
# 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)

Frequently Asked Questions

Can the KY-037 record audio?
Not really — the analog output is an amplified envelope of the mic signal, not a raw audio waveform suitable for recording. For audio capture, use an I2S mic like the INMP441 or SPH0645.
Why is the digital output LOW when there's sound (not HIGH)?
The LM393 comparator pulls the digital pin LOW when the mic level exceeds the threshold (and HIGH when quiet). Your code should treat LOW as "sound detected."
How do I set the threshold potentiometer?
In a quiet room, slowly turn the pot until the trigger LED just turns OFF. Then back off a hair more to give yourself some margin. For clap detection, turn it slightly higher so only loud sounds trigger it.
The analog output is noisy — how do I clean it up?
Take multiple samples and average them, or compute a moving RMS over a short window. For clap detection, filter out readings within ~200 ms of the last trigger to avoid double-counting a single event.
Can I measure decibels with this module?
Not accurately. The KY-037 gives a relative loudness reading that depends on gain, mic orientation, and supply voltage. It's fine for "louder/quieter than X" decisions, but not calibrated dB measurements.
Can I run it at 3.3V without losing sensitivity?
Yes — the module works at 3.3V. The analog output range just scales down (0 to 3.3V instead of 0 to 5V). Readjust the threshold pot after switching voltages.

Related Tutorials