Translate

Arduino Sound Detection Sensor with LED: 

hi..
Sound Sensor


Description:

         The sound sensor module provides an easy way to detect sound and is generally used for detecting sound intensity. This module can be used for security, switch, and monitoring applications.           Its accuracy can be easily adjusted for the convenience of usage. It uses a microphone which supplies the input to an amplifier, peak detector and buffer. When the sensor detects a sound, it processes an output signal voltage which is sent to a microcontroller then performs necessary processing.
       The sound sensor has a built-in capacitive electret microphone which is highly sensitive to sound. Sound waves cause the thin film of the electret to vibrate and then the capacitance changes, thus producing the corresponding changed voltage. Since the voltage change is extremely weak, it needs to be amplified. So it is converted into a voltage ranging from 0 to 5V, which is received by data acquisition unit after A/D adapter conversion and then sent to an MCU.

Specifications:
  • Operating voltage 3.3V-5V 
  • Output model: digital switch outputs (0 and 1, high or low level) 
  • With a mounting screw hole 
  • PCB size: 3.4cm * 1.6cm 

Schematic Diagram:






Pin Configuration:






Digital output signal : 

Wiring Diagram:









Code Arduino: 


Click here to download the code

//Sound Sensor with arduino
// by mohammed.H
//arduino projects
//digital output signal

int Led=13;//define LED port
int buttonpin=3; //define switch port
;int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define LED as a output port
pinMode(buttonpin,INPUT);//define switch as a output port
}
void loop()

{ val=digitalRead(buttonpin);//read the value of the digital interface 3 assigned to val
if(val==HIGH)//when the switch sensor have signal, LED blink
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}

}

We can use this code with delay for high LED:

Click here to download the code

//Sound Sensor with arduino
// by mohammed.H
//arduino projects


int Led=13;//define LED port
int buttonpin=3; //define switch port
;int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define LED as a output port
pinMode(buttonpin,INPUT);//define switch as a output port
}
void loop()

{ val=digitalRead(buttonpin);//read the value of the digital interface 3 assigned to val
if(val==HIGH)//when the switch sensor have signal, LED blink
{
digitalWrite(Led,HIGH);
delay(2000);
}
else
{
digitalWrite(Led,LOW);
}

}



How to test:

The components to be used are:

  • Arduino UNO
  • Sound sensor module
  • LED 
  • Breadboard 
  • USB cable
1. Connect the components based on the figure shown in the wiring diagram using a M-M pin connector. VCC pin is connected to the 3.3V or 5V power supply, GND pin is connected to the GND, DO pin is connected to a digital I/O pin (pin 3 ). Pin number will be based on the actual program code.

2. After hardware connection, insert the sample sketch into the Arduino IDE.

3. Using a USB cable, connect the ports from the Arduino the computer.

4. Upload the program.

5. See the results in the Video below.


In this video you can learn more about code, sound sensor and how to install:

Arduino Sound Sensor with LED










Analog output signal : 

Wiring Diagram:







you can control the on/off LED with this code

Code Arduino: 

Click here to download the code


//Sound Sensor with arduino
// by mohammed.H
//arduino projects
//analog output signal


int soundSensor = 2;
int LED = 7;
bool isLEDOn = false;
void setup()
{
  Serial.begin(9600);
  pinMode (soundSensor, INPUT);
  pinMode (LED, OUTPUT);
  digitalWrite( LED,LOW);
}
void loop()
{
  int statusSensor = digitalRead (soundSensor);
  if (statusSensor == 1)
  {
       Serial.println("ON");
       if( isLEDOn == false){
          isLEDOn = true;
          digitalWrite(LED, HIGH);
       }else{
          isLEDOn = false;
          digitalWrite(LED, LOW);
       } 
  }
   else
  {
    Serial.println("zzz");
  }
}


See the results and how to connect with Arduino in the Video below :

https://www.youtube.com/watch?v=4r8hg7A1sSU

Aucun commentaire:

Enregistrer un commentaire