KY-037 microphone sensitivity

The key to the analog output is to make the sensor value a FLOAT then scale that value to get the sensitivity you want. I found looking at the Serial Plotter helped the most. You will notice that the analog signal will oscillate when it detects noise, that is because the solenoid it moving in and out with the sound vibrations giving you a high and low value. Changing the potentiometer simply changed the baseline reading thus allowing you to tune the digital output. By the way, when tuning the digital output, turn the potentiometer until LED2 oscillates between on and off. *In my opinion this is a terrible microphone and should not be used for anything important.

**** Analog & Digital Outputs ****

int AnalogOutput = A0; // Connect to sensors analog output (sensor AO pin > Arduino pin A0)
int DigitalOutput = 3; // Connect to sensors Digital output (sensor DO pin > Arduino pin 3)
int ledPin = 13; // Connect to LED (Arduino pin 13)
float AnalogValue = 0; // Store analog value
int DigitalValue = 0; // Store digital value

void setup(){
Serial.begin(9600);
pinMode(ledPin,OUTPUT); // set led pin as OUTPUT
pinMode (DigitalOutput, INPUT) ; // Sets pin 3 to INPUT
}

void loop(){
//Analog data
AnalogValue = analogRead(AnalogOutput)/22.0; //<--22.0 is my scaler, change this to scale the analog signal.
Serial.println(AnalogValue);

//Digial data
DigitalValue=digitalRead(DigitalOutput);
digitalWrite(ledPin,DigitalValue);
}