Introduction:
Sound sensor works similar to our Ears, Ears have diaphragm which convert vibrations into signals and in Sound sensor we are using Microphone, which will convert sound vibrations into Voltage or Current proportionals. It typically have a diaphragm built inside made up of magnets which are coiled by metal wire.
Whenever sound waves strikes the diaphragm, magnets vibrates and at the same time current is induced from the coils.
Usage:
The important areas where a sound sensor can be used are: Security system for Home/Office, Spy Circuit, Home Automation, Robotics, Smart Phones etc.
Application:
Project for Reference:
Code:
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(13,OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = digitalRead(2);
// print out the value you read:
Serial.println(sensorValue);
if(sensorValue<500)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
delay(1); // delay in between reads for stability
}
No comments:
Post a Comment