The KY-038 Sound Sensor Module is a compact and sensitive module designed for detecting sound levels in the environment. It is equipped with a microphone and an onboard amplifier circuit, making it capable of converting acoustic sound into an electrical signal. This module is commonly used in noise detection, voice-activated systems, and simple audio monitoring applications.
Pin | Description |
---|---|
VCC | Connect to 3.3V to 5V power supply |
GND | Connect to ground |
AO | Analog output, provides a real-time output voltage signal of the microphone |
DO | Digital output, outputs high and low signals based on the threshold set by the onboard potentiometer |
// KY-038 Sound Sensor example with Arduino UNO
const int analogPin = A0; // Analog output from the KY-038
const int digitalPin = 2; // Digital output from the KY-038
void setup() {
Serial.begin(9600);
pinMode(digitalPin, INPUT);
}
void loop() {
int analogValue = analogRead(analogPin); // Read the analog value
int digitalValue = digitalRead(digitalPin); // Read the digital value
// Print the results to the Serial Monitor
Serial.print("Analog Value: ");
Serial.print(analogValue);
Serial.print(" | Digital Value: ");
Serial.println(digitalValue);
delay(100); // Delay for a short period to avoid overwhelming the Serial Monitor
}
Q: Can the KY-038 detect the direction of sound? A: No, the KY-038 can only detect the presence and intensity of sound, not its direction.
Q: What is the difference between AO and DO? A: AO provides a continuous analog signal based on the sound intensity, while DO provides a digital signal when the sound intensity exceeds a certain threshold.
Q: How do I adjust the sensitivity of the module? A: Turn the onboard potentiometer clockwise to increase sensitivity and counterclockwise to decrease it.
Q: Can the KY-038 be used with a 3.3V system? A: Yes, the KY-038 can operate at 3.3V, making it compatible with both 5V and 3.3V microcontrollers.