MoloWorks account

Welcome back.

Sign in to continue where you left off.

Forgot password?

New to MoloWorks?

EQ-16 · Sound sensor

Trigger on a sound change

Use the onboard microphone for relative sound readings or to trigger an event when sound crosses an adjustable threshold.

KY-037 sound detection module

How to use it

You’ll need: ESP32-S3, KY-037, USB data cable, jumpers, and a small screwdriver for the trimmer.

Connections

This example uses one part at a time on the MoloWorks ESP32-S3. If a course uses different GPIO pins, follow that course’s wiring and code together. Disconnect USB and any external power before changing wires.

On the partConnect to
Module +ESP32 3V3
Module GESP32 GND
Module DOESP32 GPIO5 (digital input)
Module AO (optional)ESP32 GPIO4 (ADC1)
  1. Power the KY-037 at 3.3 V and check the signal levels before connecting. Begin with DO for a simple threshold test.
  2. Run the example and tap the desk near the microphone or clap once at a comfortable distance. Adjust the threshold in small increments and watch for a digital change. Use the observed idle level to interpret the output.
  3. If you need relative peak readings, use AO and sample several times per window. The module is a sound detector; it does not report calibrated decibels or send digital audio.

MicroPython example

Run this on the board with your MicroPython editor. Set up the ESP32-S3 first if you don’t have a working connection.

from machine import Pin
from time import sleep_ms

sound = Pin(5, Pin.IN)
idle = sound.value()
for _ in range(60):
    changed = False
    for _ in range(100):
        if sound.value() != idle:
            changed = True
        sleep_ms(1)
    if changed:
        print("threshold crossed")

What to look for: A nearby tap causes a threshold message while a quiet room usually does not. If nothing changes, check the trimmer, DO pin, and idle level.

AI prompt

Copy the prompt and replace any brackets with details from your kit. Check the suggested wiring against the labels on your parts before applying power.

Trigger on a sound change

I have a 3.3 V KY-037 on a MicroPython ESP32-S3, with DO on GPIO5 and optional AO on ADC1 GPIO4. Help me measure the idle state, adjust the trimmer, and catch short DO pulses during a tap test. If using AO, compare quiet and tap peaks within a sample window. Do not report decibels or treat this as an I²S microphone.

Contact QR code

Open contact