Unit Arduino

Arduino Project : Sound Volume Meter

DSC_1188

This is an Arduino project called the sound volume meter. It receives sound signal and turns into led light output.
There are two functions :
One function is that it reacts to the music that the user is playing, giving the user a visual feedback from the music. A more enjoyable experince than just plain music, with both visual and aural sensation.
Another function is to show the user volume of the music or sound. a separate led indicator will turn on if the volume is too high. The user should then turn down the volume, so user do not causing any problems or disturbance to neighbours.

 

 

IMG_0356.JPG

Build

Components:

  • Arduino UNO
  • Bread Board
  • RGB LEDs
  • Resistors
  • Mic-sensor
  • Jumper Wires (male to male, female to female)
IMG_0355.JPGThe mic-sensor used in this project has three pins that will be connected to the Arduino board.
                   [Mic-senor]  – [Arduino board]
       [ VCC]  – [5V]
            [GND] – [GND]
         [OUT] – [A0]
The RGB LEDs has four pins (Red, Green, Blue and GND) one side of resistor connects to LED GND pin and the other side to negative (-) row on Breadboard to prevent LEDs from burning out.
Jumper wire connects to one LED pin, depending which colour want to be displayed while turned on and the end connects to slot on Arduino board.

Program

Below is the Arduino code. Don’t expect  it to work instantly after uploading the code to  Arduino board. It needs some calibration first, play music for few minutes and adjust threshold values if necessary, due to different Mics and manufacturing qualities.

CODE:

—————————————————————————

int sensorPin = A0;
int sensorvalue = 0;
int threshold1 = 250;
int threshold2 = 260;
int threshold3 = 270;
int threshold4 = 280;
int threshold5 = 300;
int threshold6 = 320;
int threshold7 = 450;
int ledPin1 = 12;
int ledPin2 = 10;
int ledPin3 = 8;
int ledPin4 = 6;
int ledPin5 = 4;
int ledPin6 = 2;
int ledPin7 = 0;

void setup() {

pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(ledPin6, OUTPUT);
pinMode(ledPin7, OUTPUT);

}
void loop() {
sensorvalue = analogRead(sensorPin);if (sensorvalue >= threshold1) {

digitalWrite(ledPin1, HIGH);
}

if (sensorvalue >= threshold2) {

digitalWrite(ledPin2, HIGH);
}

if (sensorvalue >= threshold3) {

digitalWrite(ledPin3, HIGH);
}

if (sensorvalue >= threshold4) {

digitalWrite(ledPin4, HIGH);
}

if (sensorvalue >= threshold5) {

digitalWrite(ledPin5, HIGH);
}

     if (sensorvalue >= threshold6) {

digitalWrite(ledPin6, HIGH);
}

if (sensorvalue >= threshold7) {

digitalWrite(ledPin7, HIGH);
}

 else {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);}
}

—————————————————————————
User identify variables , there are three sets of variables.
First is analogue input A0, an analogue input slot on Arduino board connected to mic-sensor, it receives signal from mic-sensor and user sets starting sensorvalue to 0.
Second are threshold values, user have to input threshold values, values can be different due to different mics and manufacturing qualities.
Third, digital output slots on board which are connected to the led pins
Use if statement to turn on the LEDs each set of LEDs are given a threshold valve, when value from mic sensor exceeds threshold value the LEDs turns on. There are 7 sets of threshold value and 7sets of LEDs.
Otherwise the LEDs turns off, when sensor value falls below given threshold value.
————–Now play some music enjoy the LEDs blink with the beat————–
Link to YouTube Video about the Arduino Project