Overview

The KY-038 is an electret condenser microphone sound detection sensor module from the Keyes 37-in-1 sensor kit series. Engineered to detect acoustic sound, voice, clapping, and loud noises, it combines a high-sensitivity electret microphone capsule with an onboard LM393 differential voltage comparator and a multi-turn sensitivity potentiometer.

The module provides dual output channels:

  1. Analog Output (AO): Continuous real-time analog AC voltage waveform reflecting sound wave amplitude centered around VCC/2V_{CC} / 2.
  2. Digital Output (DO): Pulls Low (0V) when sound amplitude exceeds the threshold set by the potentiometer.

It is widely used in DIY clap-activated light switches, noise-activated alarms, and sound level indicators.

Quick reference

Operating voltage (VCC)3.3 V to 5.5 V DC (5.0 V nominal)
Microphone elementElectret Condenser Microphone (ECM)
Frequency response50 Hz to 20 kHz
OutputsDual Analog Voltage (AO) & Digital LM393 Comparator (DO)
IndicatorsPower LED (red) + Digital Sound Trigger LED (green)
Sensitivity adjustment10-turn multi-turn potentiometer on PCB
Operating current10 mA10\text{ mA} typical

Pinout

Standard 4-pin 0.1" (2.54 mm) module header:

PinNameTypeDescription
1AOAnalog OutputAnalog audio waveform output (centered around VCC/2V_{CC}/2)
2GNDPowerGround reference (0 V)
3VCC / +PowerSupply power input (+3.3 V to +5.5 V DC)
4DODigital OutputLM393 comparator digital output (Low when sound threshold exceeded)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}3.35.05.5VDC
Active CurrentICCI_{CC}1015mAVCC=5.0VV_{CC} = 5.0\text{V}
Mic SensitivitySensmicSens_{mic}-48-44-40dB1 kHz1\text{ kHz} at 1 Pa1\text{ Pa}
Frequency ResponseFreqFreq5020000HzHuman audible audio spectrum
Analog Output OffsetVoffsetV_{offset}VCC/2V_{CC}/2VQuiescent quiet room output
Digital Output SinkIsinkI_{sink}1020mAOpen-collector output

Operating Principle & Signal Behavior

  • Quiet Room: Photodiode/mic AC output is zero; AO sits at half supply voltage (2.5V\sim 2.5\text{V} on 5V supply). DO sits High (VCCV_{CC}).
  • Sound / Clap Detected: Sound pressure waves vibrate the internal electret diaphragm, producing AC voltage spikes above and below 2.5V2.5\text{V}. When negative peaks drop below the potentiometer reference, DO switches Low (0V) for the duration of the acoustic pulse, illuminating the green LED.

Wiring

KY-038 PinArduino UnoESP32Notes
VCC (+)5V / 3.3V3.3VPower rail
GNDGNDGNDSystem ground
AOAnalog Pin A0VP / GPIO36Real-time audio waveform
DODigital Pin D2 (INT0)GPIO 4Digital clap/sound trigger

Example (Arduino Clap Switch Demo)

cpp
const int soundDigitalPin = 2;
const int relayPin = 13;
bool relayState = false;

void setup() {
  Serial.begin(9600);
  pinMode(soundDigitalPin, INPUT);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, relayState);
}

void loop() {
  int digitalVal = digitalRead(soundDigitalPin);

  // Active-Low trigger on clap sound
  if (digitalVal == LOW) {
    relayState = !relayState;
    digitalWrite(relayPin, relayState);
    Serial.print("CLAP DETECTED! Relay state toggled to: ");
    Serial.println(relayState ? "ON" : "OFF");
    delay(500); // Debounce delay
  }
}

Common mistakes

  • Attempting FFT audio spectrum analysis on AO: The electret microphone on the KY-038 lacks an onboard pre-amplifier stage (such as the MAX4466 or MAX9814), resulting in weak AC peak-to-peak voltages (50 mV\sim 50\text{ mV}). It is designed for threshold clap detection rather than high-fidelity voice recording.
  • Over-sensitivity lockup: Turning the potentiometer too far counter-clockwise causes DO to lock permanently Low. Adjust the potentiometer until the green LED just turns OFF under quiet room conditions.

Notes

  • KY-038 vs MAX4466 vs MAX9814: KY-038 is a simple comparator-based sound threshold sensor; MAX4466/MAX9814 are precision audio pre-amplifiers with automatic gain control for voice recording.

Assets & downloads