Audio
Interfacing Sound Sensor Audio with Arduino Uno
What is the Sound Sensor?
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.
Setting Up Sound Sensor with Arduino Uno
Library
None — built-in analogRead/digitalRead by —
No library needed; uses core Arduino functions only.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | |
| GND | GND | |
| AO | A0 | Analog envelope of the mic signal — read continuously. |
| DO | D2 | Digital threshold output, set by the onboard potentiometer. |
Swipe sideways to see every column →
- Turn the onboard potentiometer to set the DO trigger threshold — it does not affect the AO reading.
- AO is noisy and has no fixed units; treat it as a relative loudness level, not a calibrated dB value.
- For actual clap/sound-detection projects, debounce DO in software — a single loud sound can trigger multiple pulses.
Related Components
A3144
Digital Hall-effect switch for contactless magnetic detection
ACS712
Measure AC or DC current with an analog Hall-effect sensor
ADXL345
Low-power 3-axis accelerometer with tap/double-tap and freefall detection for wearables.
AHT10
A tiny I2C sensor that packs temperature and humidity sensing into the smallest footprint possible.
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.