Sound Sensor Module
Sound Sensor Module
The microphone sound sensor, as the name says, detects sound. It gives a
measurement of how loud a sound is.
There are a wide variety of these sensors. In the figure below you can see
the most common used with the Arduino.
At the leftmost side, you can see the KY-038 and at the right the LM393
microphone sound sensor.
Where to buy?
You can go to Maker Advisor and find the sensor’s best price.
Sound sensor
Pin wiring
Wiring your sensor to the Arduino is pretty straightforward:
Pin Wiring to Arduino
A0 Analog pins
D0 Digital pins
GND GND
VCC 5V
If you’re using the LM393 module, you should connect the OUT pin to an
Arduino digital pin.
Parts required
For this example you’ll need the following components:
Schematics
Assemble all the parts by following the schematics below:
Code
Upload the following code to your Arduino board.
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*/
int ledPin=13;
int sensorPin=7;
boolean val =0;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin (9600);
}
Demonstration
After uploading the code, you can clap next to the sensor. If the LED is not
lighting up, you need to change the sensor sensitivity by rotating the
potentiometer.
You can also adjust the sensitivity so that the LED follows the beat of a
certain music.