Arduino Sound Sensor Tutorial | Arduino Clap Sensor Tutorial
by Utsource in Circuits > Arduino
866 Views, 0 Favorites, 0 Comments
Arduino Sound Sensor Tutorial | Arduino Clap Sensor Tutorial
Hi guys in this instructables we will learn how to use sound sensor with Arduino and basically sound sensor is used to detect sounds and read the sound using Arduino and we can use sound inputs with Arduino using sound sensor.
Things You Need
For this instructables we will need following things :
Arduino uno
Sound sensor
Jumper wires
Breadboard
LED
Resistor 220ohm
Connections
Please follow the shown schmatics and connect everything According to it.
Pin - Wiring to Arduino
D0 - Digital pins
GND - GND
VCC - 5V
Pin - Wiring to Arduino
D0 - Digital pins
GND - GND
VCC - 5V
Code
Please copy the following code and upload it to the arduino Board :
int ledPin=13;
int sensorPin=7;
boolean val =0;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin (9600);
}
void loop (){
val =digitalRead(sensorPin);
Serial.println (val);
// when the sensor detects a signal above the threshold value, LED flashes
if (val==HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
int ledPin=13;
int sensorPin=7;
boolean val =0;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin (9600);
}
void loop (){
val =digitalRead(sensorPin);
Serial.println (val);
// when the sensor detects a signal above the threshold value, LED flashes
if (val==HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
Output
After uploading the code, you can clap next to the sensor. If the LED is not lighting up, you need to change the sensor sensitivity by rotating the potentiometer.
You can also adjust the sensitivity so that the LED follows the beat of a certain music.
Add more LEDs for a more spectacular effect!
You can also adjust the sensitivity so that the LED follows the beat of a certain music.
Add more LEDs for a more spectacular effect!