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

Screenshot_20191120-091316__01.jpg
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

images(112).jpg
Km5Zu-2RIncAUweU7uG7IhyWPySZ0SqIgAI0-vk9w7767_IkthCPCcsirj2GGmXF4IdQDg8UVpHVLVM6CXnzFsG1hnAdSkK7BIhIOtEldXoZiDsvzsPo-6o0rD6Mda7UyOE=w456-h323-nc.png

For this instructables we will need following things :

Arduino uno

Sound sensor

Jumper wires

Breadboard

LED

Resistor 220ohm

Connections

20191120_092022.jpg
Please follow the shown schmatics and connect everything According to it.

Pin - Wiring to Arduino
D0 - Digital pins
GND - GND
VCC - 5V

Code

images(110).jpg
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);
}
}

Output

Screenshot_20191120-091316__01.jpg
Screenshot_20191120-091311__01.jpg
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!