Back to Basic Projects

🎙️ Sound Level Meter

Visualize ambient noise with a 10-LED VU meter driven by a microphone module — your first audio electronics project.

📋 Overview

Sound is pressure waves that a microphone converts into electrical voltage. An electret microphone module outputs an analog voltage proportional to sound pressure. Arduino samples this and drives a visual LED bar graph — like a professional VU (Volume Unit) meter.

Technical Insight: The KY-038 microphone module uses an electret capsule paired with an LM393 comparator. The analog output swings around 2.5V at silence, going higher with loud sounds. We sample this signal multiple times per loop, find the peak deviation from the baseline, and map it to 0–10 LEDs.

In simple terms: The microphone 'sneezes' a tiny voltage when it hears sound. We repeatedly check that voltage, find how far it jumped, and light up more LEDs the louder it gets.

What you'll learn: Electret microphone interfacing, peak-detection sampling over a time window, analog value mapping, multi-LED array control, and audio signal basics.

Estimated time: 40-55 minutes. Difficulty: ⭐⭐ Easy.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
KY-038 Microphone ModuleElectret with LM3931Analog output type
LEDs (assorted colors)5mm, Red/Yellow/Green105G + 3Y + 2R for VU effect
Resistors220Ω10One per LED
Breadboard + WiresFull-size1

🗺️ Component Pin Mapping

Sound Level Meter Component Pin Mapping Infographic

📖 Step-by-Step Tutorial

1

Wire the Microphone

KY-038: VCC → 5V, GND → GND, AO (Analog Out) → Arduino A0. Adjust the blue potentiometer on the module for sensitivity.
2

Set Up LED Array

Insert 10 LEDs in a row on the breadboard. Wire each anode through a 220Ω resistor to Arduino pins 2–11. All cathodes to GND.
3

Upload the Code

Upload the sketch. Clap near the microphone — LEDs will light up from left to right based on volume.
4

Calibrate Sensitivity

If too many or too few LEDs light up in a quiet room, adjust the potentiometer on the KY-038 module with a small screwdriver.
5

Color Code Your LEDs

Use green for LEDs 1–5, yellow for 6–8, and red for 9–10. This mimics professional studio VU meter color coding.
💡
The microphone signal is very noisy at audio frequencies. The code uses peak detection over a 50ms window to find the loudest moment rather than a single instant sample — this gives a much more accurate and satisfying visual response.

💻 Arduino Code

sound_level_meter.ino
INO
// Sound Level Meter (VU Meter) — Volt X
// KY-038 mic on A0, 10 LEDs on pins 2-11

const int MIC_PIN    = A0;
const int NUM_LEDS   = 10;
const int LED_PINS[] = {2,3,4,5,6,7,8,9,10,11};
const int SAMPLE_MS  = 50;  // Sampling window in ms
const int BASELINE   = 512; // Mid-point for 5V supply

void setup() {
  for (int i = 0; i < NUM_LEDS; i++)
    pinMode(LED_PINS[i], OUTPUT);
  Serial.begin(9600);
}

int samplePeak() {
  unsigned long start = millis();
  int peak = 0;
  while (millis() - start < SAMPLE_MS) {
    int val = abs(analogRead(MIC_PIN) - BASELINE);
    if (val > peak) peak = val;
  }
  return peak;
}

Reviews & Ratings

0 reviews
5★
0
4★
0
3★
0
2★
0
1★
0
...

Loading reviews...