Arduino UNO Sound Sensor
In this short tutorial I will share with you the circuit diagrams, code and a sample video.
Expected Results:
Components
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
Now its time to code..
Compile and deploy the code below
Expected Results:
Components
- 1*Arduino Uno board
- 1*USB data cable
- 1*High-Sensitive voice sensor module
- Several jumper wires
- LED
- 220K Ohms or 1K Ohms Resistor (Otherwise your LED will blow)
- 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
Give me a tutorial for an arduino based geo-tracker ..I can exchange it for a cash
ReplyDeleteHi Maingi,
DeleteLemme get back to you here once I do this.