Sound Level Indicator Using 12 LEDs
This project is a great way to combine electronics with visual effects. It uses 12 individual LEDs that light up progressively based on the sound intensity captured by a microphone module.
As the surrounding sound gets louder, more LEDs turn on, creating an effect similar to an audio equalizer. The sensitivity can be easily adjusted using a potentiometer, making the project suitable for different environments.
Required components
Arduino Uno (or compatible microcontroller)
Microphone module (analog output)
Potentiometer (recommended 10kΩ)
12 LEDs
12 × 220Ω resistors
Jumper wires
Breadboard
Connections
Microphone module
VCC → Arduino 5V
GND → Arduino GND
OUT → A0
Potentiometer
One outer pin → 5V
Other outer pin → GND
Middle pin → A1
LEDs
The 12 LEDs are connected to digital pins 2–13, each through a 220Ω resistor to GND.
How it works
The Arduino reads the analog signal from the microphone and filters it to reduce noise. The resulting value is compared with the threshold set by the potentiometer and mapped to a range from 0 to 12.
Based on this level, the LEDs turn on or off progressively, creating a smooth visual effect.
This project is a solid starting point for learning how to work with analog signals and digital outputs, and it can be easily expanded with new ideas and features.
Code:
#define MIC_PIN A0
#define POT_PIN A1
int greenLeds[3] = {2, 3, 4};
int yellowLeds[3] = {5, 6, 7};
int redLeds[3] = {8, 9, 10};
int blueLeds[3] = {11, 12, 13};
int micValue, potValue;
int currentLevel = 0;
void setup() {
Serial.begin(9600);
for (int i = 0; i < 3; i++) {
pinMode(greenLeds[i], OUTPUT);
pinMode(yellowLeds[i], OUTPUT);
pinMode(redLeds[i], OUTPUT);
pinMode(blueLeds[i], OUTPUT);
}
}
int readMicFiltered() {
long sum = 0;
for (int i = 0; i < 100; i++) {
sum += analogRead(MIC_PIN);
}
return sum / 100;
}
void setBarGraph(int targetLevel) {
int leds[12] = {2,3,4,5,6,7,8,9,10,11,12,13};
while (currentLevel < targetLevel) {
digitalWrite(leds[currentLevel], HIGH);
currentLevel++;
delay(50);
}
while (currentLevel > targetLevel) {
currentLevel--;
digitalWrite(leds[currentLevel], LOW);
delay(50);
}
}
void loop() {
micValue = readMicFiltered();
potValue = analogRead(POT_PIN);
int level = map(micValue, 0, potValue, 0, 12);
level = constrain(level, 0, 12);
setBarGraph(level);
}
