Sunday, June 12, 2016

KY-038 Sound Detection Module


Designed for sound detection, the KY-038 is equipped with an electret microphone. The connections of the module is straightforward. It only has four pins that include + , G, A0 (Analog), and D0 (Digital). There are two red LEDs on the module, one for power and the other will light up when sound reaches a certain value.

In the circuit below, only the analog pin connects to the Arduino. The KY-038 seems to have low sensitivity. The potentiometer on the module is utilized to adjust the sensitivity of the sensor. The default sensor value (when everything is quiet) is 500. This makes it more responsive to the incoming signals. When signal comes above 550 or below 500, the value will be displayed on the serial monitor. The second red LED on the module will also illuminate.


int sensorPin = A0;
int sensorValue = 0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(sensorPin);    
  if(sensorValue>550){
    Serial.println(sensorValue);
  }
  if(sensorValue<500){
    Serial.println(sensorValue);
  }
  //delay(100);
}


No comments:

Post a Comment