Arduino UNO Sound Sensor

In this short tutorial I will share with you the circuit diagrams, code and a sample video.

Expected Results:

Components
  1.  1*Arduino Uno board
  2.  1*USB data cable
  3.  1*High-Sensitive voice sensor module
  4.  Several jumper wires
  5. LED
  6. 220K Ohms or 1K Ohms Resistor (Otherwise your LED will blow)
  7. breadboard 

Connect the sound sensor to the board as shown in the diagram below
Connect the LED as shown below
Black -  connect to the blue channel of the breadboard and to GND of the UNO
RED - Connect to the Red Channel of the breadboard and to the 12 pin of the board. (If 12 seems to give you problems, try 11. Sometimes they are mismatched)

Now its time to code..

Compile and deploy the code below


/***********************************************
* name:Voice Sensor
* function: you can see the value of sound intensity on Serial Monitor.
**************************************************/

const int ledPin = 12; //pin 13 built-in led -- note this
const int soundPin = A0; //voice sensor attach to A0

void setup()
{
  pinMode(ledPin,OUTPUT); ////set pin13 as OUTPUT
  Serial.begin(9600); //initialize serial monitor
}

void loop()
{
  int value = analogRead(soundPin); //read the value of voice sensor
  Serial.println(value); //print the value
  if(value > 25) //if the value is greater than 25
  {
    digitalWrite(ledPin,HIGH); //turn on the led
    delay(200); //delay 2s
  }
  else
  {
    digitalWrite(ledPin,LOW); //turn off the led
  }
}



Now start clapping, yelling, Singing(I know most programmers sing so badly. Off key probably)
Your LED  should be lighting as you make noise.

NOTE:
Remember to check the pin number for LED. for on-board LED, use 13. In my case I have used pin 12

Comments

  1. Give me a tutorial for an arduino based geo-tracker ..I can exchange it for a cash

    ReplyDelete
    Replies
    1. Hi Maingi,
      Lemme get back to you here once I do this.

      Delete

Post a Comment

Popular posts from this blog

Arduino Temperature sensor and LCD Display

Importing a dump file in Oracle 12C