KY-038 Sound Detection Sensor Module
Detects claps, knocks, and ambient noise level for reactive projects.
Wiring & code for
Sound Sensor practical reference
The KY-038 is a small electret-microphone breakout that provides both a digital and an analog output for detecting sound. The digital output flips when volume crosses an adjustable threshold set by an onboard potentiometer, ideal for simple clap-switch or knock-detector projects, while the analog output tracks the raw waveform/envelope for more nuanced sound-reactive builds like level meters or beat-triggered lighting.
Key specifications
- Sensor type: Electret condenser microphone with onboard LM393 comparator
- Operating voltage: 3.3V–5V DC
- Digital output (DO): Goes LOW when detected sound exceeds the threshold set by the onboard potentiometer, HIGH otherwise (some boards invert this)
- Analog output (AO): Continuous analog signal proportional to the microphone's raw audio envelope
- Sensitivity adjustment: Onboard trimmer potentiometer sets the digital-trigger threshold
- Detection range: Best for close-range sounds (claps, knocks, voice) within roughly 0.5-1m
- Interface: 1 digital pin (threshold trigger) + 1 analog pin (raw signal)
Pinout and connection notes
Turn the onboard potentiometer clockwise/counter-clockwise while testing with a clap to tune the digital trigger sensitivity — too sensitive and it fires on background noise, too insensitive and it misses claps. For beat-detection or volume-level projects, use the analog output instead and do the thresholding in software.
- VCC: Power, 3.3–5V DC
- GND: Ground
- DO: Digital output — threshold-triggered HIGH/LOW sound detection
- AO: Analog output — raw microphone signal, read with analogRead()
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.