0% found this document useful (0 votes)
100 views5 pages

Sound Sensor Module

The document discusses two common microphone sound sensors - the KY-038 and LM393. It provides instructions on wiring the sensors to an Arduino board and includes an example code to light an LED when sound levels exceed a threshold based on readings from the microphone sensor. Diagrams show the circuit schematic and code is included to flash an LED when sound is detected by the sensor.

Uploaded by

Refpo Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views5 pages

Sound Sensor Module

The document discusses two common microphone sound sensors - the KY-038 and LM393. It provides instructions on wiring the sensors to an Arduino board and includes an example code to light an LED when sound levels exceed a threshold based on readings from the microphone sensor. Diagrams show the circuit schematic and code is included to flash an LED when sound is detected by the sensor.

Uploaded by

Refpo Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

The Microphone Sound Sensor

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.

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.

Example: Sound Sensitive Lights


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.

Parts required
For this example you’ll need the following components:

 1x Microphone sound sensor


 Arduino UNO – read Best Arduino Starter Kits
 1x Breadboard
 1x LED
 1x 220 Ohm resistor
 Jumper wires
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!

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);
}

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);
}
}
View raw code

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.

Add more LEDs for a more spectacular effect!

You might also like