Sound Decibel Multicoloured LED Indicator



Sound sensors can be used for a variety of things, for example, turning lights off or on by clapping, or driving an LED to the beat of your favourite song.

This project will be using the Sound Detector Board as to provide feedback to the user about the decibel level of a room. Whether you have a loud neighbour, crying baby, or simply want to protect your ears, this simple RGB sound level indicator will provide a visual feedback to the decibel level of the surrounding environments.

Step 1: Tools and Materials

Step 2: Connecting the Sound Detection Board to the Arduino

The envelope output allows you to easily read amplitude of sound by simply measuring the analog voltage. Gain can be adjusted with a through-hole resistor, to change the threshold of the binary (gate) output pin as well. Check the hookup guide below for more information about setting gain.

Step 3: Connecting the RGB LEDs to the Arduino

  1. Connect the envelope pin of the sound sensor to the analog pin 0 of the Arduino. This will be the indicator of the sound level as it analyzes the sound waves amplitudes.
  2. Connect the ground pin of the RGB LED (longest pin) to the GND pin of the Arduino using a jumper wire.
  3. Connect the remaining three pins to three 100Ω resistors each which then connects to the Arduino's digital pins 4, 6 and 9.
  4. Wire the power to the sound board by connecting the 3.3V pin and GND pin from he Arduino to the sound detector board. Note that the Arduino have multiple ground pins and they are all common to each other.

Step 4: Coding

//pin variables
const int redPin = 4;
const int greenPin = 6;
const int bluePin = 9;
const int soundPin = 0;
//variables for storing raw sound and scaled value
int sound;
int scale;
void setup()
 //start the serial port a@ 9600bps
 //set RGB pins to OUTPUT
 pinMode(redPin, OUTPUT);
 pinMode(greenPin, OUTPUT);
 pinMode(bluePin, OUTPUT);
void loop()
 //read and store the audio from Envelope pin
 sound = analogRead(soundPin);
 //map sound which in a quiet room a clap is 300
 //from 0 to 3 to be used with switch case
 scale = map(sound, 0, 300, 0, 3);
 //print values over the serial port for debugging
 Serial.print("   ");
 //switch case on scaled value
switch (scale)
//if 0 RGB = Blue
case 0:
   digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, HIGH);
//if 1 RGB = Green  
case 1:
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
//if 2 RGB = Yellow  
case 2:
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, LOW);
//if 3 RGB = Red
case 3:
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
//default off
  digitalWrite(redPin, LOW);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW); 

Step 5: Sound Level Demonstration

My room was very quiet at the time that this picture was taken, so the LED colour that was shown in blue. The louder it gets, such as music playing in the background or clapping changes the colour to green.



    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019