This post shows how to use the microphone sound sensor with the Arduino board.
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.
Both sensor modules have a built-in potentiometer to adjust the sensitivity of the digital output pin.
You can go to Maker Advisor and find the sensor’s best price.
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.
In this example, a microphone sensor will detect the sound intensity of your surroundings and will light up an LED if the sound intensity is above a certain threshold.
For this example you’ll need the following components:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Assemble all the parts by following the schematics below:

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); } void loop (){ val =digitalRead(sensorPin); Serial.println (val); // when the sensor detects a signal above the threshold value, LED flashes if (val==HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }
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.
Add more LEDs for a more spectacular effect!
Copyright ©2025. All Rights Reserved Emblab THE RAVE INNOVATION