Arduino Sound Sensor



Introduction:
The Sound sensor module for the Arduino shown in the image above has the ability to detect different sizes of sound. This sensor can be used to for a variety of uses from industrial to simple hobby or playing around. 
In this tutorial, we are going to connect the Arduino sound sensor module to the LED so that the LED will light up every time the sensor detects sound. 


Technical Details:
Working Voltage: 5V
Borad PCB Size : 34 x 16mm/ 1.3" x 0.6" (L*W);
Hole Size : 3mm/ 0.12"


Similar Modules:
There are similar sound sensor modules for the Arduino such as ones that use smaller sound detectors. However they are using the same parts but just designed in a different shape or position so there is no need for extra resistors.



Example of Use:

Materials:
  • Sound Sensor Module
  • 1 - Jumper Wire (short)
  • 4 - Jumper Wire (long)
  • 3 - 220 ohm resistors (red-red-brown-gold)
  • 1 - Bread board
  • 1 - LED light
Wiring Instructions:

   Wire the LED light to to the middle of the Arduino Breadboard so each pin is on a different side. Insert the 220 ohm resistor in pin 13 and next to the left hole of the LED light. Insert a Jumper wire (short) next to the right side of the LED light and connect the other side to the GND hole. Next, attach the 4 long jumper wires to the Sound sensor module and connect the opposite end according to the cable type. The wire thats connected to the one that saids A0 connects to the ANALOG 0 pin. The wire that is connected to the one that saids G connects to the GND pin. The wire that is connected to the one that saids + connects to the 5V pin.  Attach the wire that saids DO next to the hole horizontal to the resistor. 
    If there are only 3 wire attachments on the sound sensor, attach the three wires to the GND, 5V and A0 only. 
    If the places that the wires need to be attached to are NOT labeled on the Arduino Sound sensor module, insert the wires into the 3 or 4 selected pin points randomly until it works.



Sketch Instructions:
    After copying and uploading this code your LED light should light up when it senses sound. If the light does not sense very well, try changing the threshold value or use a different resistor.

Sketch Code

/*
This is the code to make a LED blink with sound.
You have to set the threshold so it' sensible enough to make the led blink.
 
You connect an LED to PIN13 and the Sound Sensor to Analog Pin 0
 */
 
int led = 13;
int threshold = 22; //Change This
int volume;
 
void setup() {                
  Serial.begin(9600); // For debugging
  pinMode(led, OUTPUT);     
}
 
void loop() {
  
  volume = analogRead(A0); // Reads the value from the Analog PIN A0
  /*
    //Debug mode
    Serial.println(volume);
    delay(100);
  */
  
  if(volume>=threshold){
    digitalWrite(led, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led, LOW); // Turn OFF Led
  }
 
}

Try More:
    You can try more by adding more LED light sensors on the Breadboard so that it makes one giant light that blinks to the sound.
    This is the code I used when I added 12 LED lights on to my Arduino. 

Sound sensor Code (12 LED lights)

/*
This is the code to make a LED blink with sound.
You have to set the threshold so it' sensible enough to make the led blink.
 
You connect an LED to PIN13 and the Sound Sensor to Analog Pin 0
 */
 
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int led6 = 8;
int led7 = 7;
int led8 = 6;
int led9 = 5;
int led10 = 4;
int led11 = 3;
int led12 = 2;


int volume;
 
void setup() {                
  Serial.begin(9600); // For debugging
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);  
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(led8, OUTPUT);
  pinMode(led9, OUTPUT);
  pinMode(led10, OUTPUT);
  pinMode(led11, OUTPUT);
  pinMode(led12, OUTPUT);
 
}
 
void loop() {
  
  volume = analogRead(A0); // Reads the value from the Analog PIN A0
  /*
    //Debug mode
    Serial.println(volume);
    delay(100);
  */
  
  if(volume>=22){
    digitalWrite(led1, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led1, LOW); // Turn OFF Led
  }
  if(volume>=23){
    digitalWrite(led2, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led2, LOW); // Turn OFF Led
  }
  if(volume>=24){
    digitalWrite(led3, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led3, LOW); // Turn OFF Led
  }
  if(volume>=25){
    digitalWrite(led4, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led4, LOW); // Turn OFF Led
  }
  if(volume>=26){
    digitalWrite(led5, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led5, LOW); // Turn OFF Led
  }
  if(volume>=27){
    digitalWrite(led6, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led6, LOW); // Turn OFF Led
  }if(volume>=28){
    digitalWrite(led7, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led7, LOW); // Turn OFF Led
  }if(volume>=29){
    digitalWrite(led8, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led8, LOW); // Turn OFF Led
  }if(volume>=30){
    digitalWrite(led9, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led9, LOW); // Turn OFF Led
  }if(volume>=31){
    digitalWrite(led10, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led10, LOW); // Turn OFF Led
  }if(volume>=32){
    digitalWrite(led11, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led11, LOW); // Turn OFF Led
  }
  if(volume>=33){
    digitalWrite(led12, HIGH); //Turn ON Led
  }  
  else{
    digitalWrite(led12, LOW); // Turn OFF Led
  }
 
 
}




Fun Stuff:
    This Arduino can be fun in parties. Just position this next to the speakers that project music so that it blinks every time the music hits.

Resources & Related Links:
  • http://www.danielandrade.net/2011/04/09/arduino-sound-sensor/
  • http://i01.i.aliimg.com/wsphoto/v0/980965017/10pcs-lot-Sound-Sensor-Module-Voice-microphone-sound-detection-module-LM393-Chipset-Smart-car-accessories-for.jpg
  • http://www.youtube.com/watch?v=fOlStxYiVqs\

Author: Hayato Nakamura

Please feel free to leave any comments or questions you may have about this module.

Comments