HELLO THERE!!!
How are you guys? I hope everyone is fine and good always. This week I would like share with you guys an experiment on arduino and big sound sensor (also known as sound sensor). The objective of this experiment to control a LED brightness by using the sound sensor. So, without any delays, let's jump in to the experiment!!!!
HARDWARE:
1.Arduino UNO
How are you guys? I hope everyone is fine and good always. This week I would like share with you guys an experiment on arduino and big sound sensor (also known as sound sensor). The objective of this experiment to control a LED brightness by using the sound sensor. So, without any delays, let's jump in to the experiment!!!!
HARDWARE:
1.Arduino UNO
2. LED(you can also use the LED in Arduino itself)
3.Big Sound Sensor
SOFTWARE:
1.Arduino IDE
CIRCUIT ASSEMBLY
1. Connect the LED to the Arduino. The long leg(+ve) to the pin 13(or any other digital pin) and the short leg(-ve) to GND
2. For the big sound let's refer to the image below:
From the image shown, there are 4 pins, A0(analog pin), D0(digital pin), +(+ve pin), G(GND pin). So, we are going to use the analog pin in this experiment, the assembly is as follows:
SENSOR ARDUINO
A0 --------> A0(analog input)
+ --------> 5V
G ----------> GND
CODING THE ARDUINO:
the code is shown as below:
int led = 13;//initializing variables. led is on pin 13(change according to your pin)
int spk = A0;//The big sound sensor is connected to analog pin A0(change according to your pin)
int val;// A variable to hold data
void setup() {
Serial.begin(9600);// serial communication at 9600 bps
pinMode(led,OUTPUT);//initializing the LED as an output
}
void loop() {
val = analogRead(spk);//read the value of the sensor and keep it in the val variable
Serial.println(val);//print the sensor value
analogWrite(led,val);//lights up the led according to the sensor value
}
Upload the code to your Arduino. Speak into the big sound sensor( shout,whisper :D) to see the led's response to the sound. You can also adjust the sensitivity of the sensor by adjusting the potentiometer on the sensor(the blue module on the sensor).
Well, that's all from me for this week guys. I hope to see you guys next week. Till then, HAPPY TINKERING!!!!
Comments
Post a Comment