How to Make Arduino UV Meter Using Sound Sensor
by Arduino Circuit in Circuits > Arduino
339 Views, 1 Favorites, 0 Comments
How to Make Arduino UV Meter Using Sound Sensor
In this project, we will explore How to make Arduino UV Meter using Sound Sensor. The idea behind this project is to use the sound sensor to detect the volume of the surrounding sound and light up a series of LEDs on the base gradually based on the sound level. This can be a fun and interactive way to visualize and measure the intensity of sound using the Arduino platform.
What You Will Need
For this project you will need the Following Components:
Arduino UNO
Sound Sensor
LEDs (3Green, 2Yellow,1Red)
Resistors 220Ω-6
Power Supply 5v
Jumper Wires
Breadboard
Circuit Diagram
Circuit Construction
The minimum value varies every time the system is activated for which a value called "base" has been defined (which can vary from 180 to 400) which must be detected and entered into the system each time.
The excursions are highlighted on a row of 6 LEDs which light up in sequence, according to the measured value:
0 LED = measured value lower than the base
1 LED = measured value between the base value and the base value + 15 points
2 led = value detected between the base value + 11 and + 30 points
3 led = value detected between the base value + 31 and + 45 points
4 led = value detected between the base value + 46 and + 60 points
5 led = detected value between the base value + 61 and + 75 points
6 led = detected value higher than the base value + 75 points
the led must be connected from Pin 7 to Pin 12
Code Upload
//For more Projects: www.arduinocircuit.com
int soundvalue = 0; // soundvalue variable, which contains the detected value
// on port 0 (the output signal from the microphone)
int i = 0; // index used for the led management routines
base int = 360; // base value, used to define the minimum switch-on threshold
// of the leds, which varies unpredictably (from 180 to 400) at each
// new use of the system.
void setup()
{
for (i = 7; i <= 12; i++) // for loop to define ports 7 to 12 as output ports
pinMode(i, OUTPUT);
Serial.begin(9600); //initialize serial monitor, for exposing debug trace
}
void loop()
{
soundvalue = analogRead(A0); // detect the value (the volume) of the sound
Serial.println (soundvalue); // debug trace
for (i = 7; i <= 12; i++)
digitalWrite(i, LOW); // turn off all the LEDs in advance
if (soundvalue >= base) // If the sound exceeds the base value
digitalWrite(12, HIGH); // turn on the first LED from the left
if (soundvalue >= base + 16) // If the sound exceeds the base value + 15
digitalWrite(11, HIGH); //turn on the second LED from the left
if (soundvalue >= base + 31) // If the sound exceeds the base value + 30
digitalWrite(10, HIGH); // turn on the third led from the left
if (soundvalue >= base + 46) // If the sound exceeds the base value + 45
digitalWrite(9, HIGH); // turn on the fourth LED from the left
if (soundvalue >= base + 61) // If the sound exceeds the base value + 60
digitalWrite(8, HIGH); // turn on the fifth led from the left
if (soundvalue >= base + 76) // If the sound exceeds the base value + 75
digitalWrite(7, HIGH); //turn on the sixth LED from the left
}