A real-time noise monitor that displays sound levels as a traffic light using RGB LEDs.
- Real-time noise detection via I2S MEMS microphone
- 3-color traffic light display:
- π’ GREEN β Noise is low (quieter than threshold)
- π‘ YELLOW β Noise is moderate (within range)
- π΄ RED β Noise is high (exceeded threshold)
- 12 NeoPixel RGB LED strip for bright, visible feedback
- A-weighted sound level measurement (dBA) for realistic perception
- Configurable thresholds via persistent storage
| Component | Pin | Color | Description |
|---|---|---|---|
| WS2812 LED Data | GPIO 2 | - | NeoPixel strip (12 LEDs) |
| I2S L/R Select | GPIO 4 | Green | Microphone channel select (set HIGH = RIGHT channel) |
| I2S Word Select | GPIO 5 | Blue | Microphone L/R clock |
| I2S Serial Clock | GPIO 6 | White | Microphone bit clock |
| I2S Serial Data | GPIO 7 | Yellow | Microphone audio data |
| Power (5V) | 5V | - | USB power supply |
| GND | GND | - | Ground |
ESP32 I2S Microphone (e.g., INMP441)
βββββββ ββββββββββββββββββ
GPIO 4 (green, HIGH)ββββββββββββ L/R (channel select = RIGHT)
GPIO 5 (blue) ββββββββββββββββββ WS (L/R Clock)
GPIO 6 (white) ββββββββββββββββββ SCK (Bit Clock)
GPIO 7 (yellow)ββββββββββββββββββ SD (Serial Data)
GND ββββββββββββββββββββββββββββ GND
3V3 ββββββββββββββββββββββββββββ VDD (if 3.3V version)
ESP32 NeoPixel Strip (WS2812)
βββββββ ββββββββββββββββββ
GPIO 2 βββββββββββββββββββββββββ DI (Data In)
5V βββββββββββββββββββββββββββββ 5V
GND ββββββββββββββββββββββββββββ GND
-
I2S Sampling (48 kHz, 32-bit)
- Captures continuous audio from the microphone
- High-precision digital sampling
-
IIR Filtering
- Equalizer filter (INMP441): Flattens microphone frequency response
- A-weighting filter: Mimics human ear sensitivity (emphasizes mid-frequencies)
-
Sound Level Calculation
- Converts filtered samples to dB (decibels)
- Uses microphone calibration: 94 dB SPL reference
- LEQ (Equivalent Continuous Sound Level) over 0.15 second blocks
-
Decision Logic
if (Leq < dB_min) β GREEN (quiet) if (dB_min β€ Leq < dB_max) β YELLOW (moderate) if (Leq β₯ dB_max) β RED (loud)
dB_min_default = 40 // Below 40 dB β GREEN
dB_max_default = 60 // Above 60 dB β RED| Environment | dB_min | dB_max | Notes |
|---|---|---|---|
| Library/Silent | 30 | 50 | Very quiet spaces |
| Classroom | 40 | 60 | Normal teaching |
| Active classroom | 45 | 70 | Group work sessions |
| Workshop | 60 | 80 | Tolerate machinery |
The device operates as a WiFi Access Point (AP) that you can connect to:
- SSID (Network Name):
NoiseLight - Password:
12345678 - IP Address:
192.168.4.1 - Port:
80(HTTP)
-
Connect to the device's WiFi:
- Open your device's WiFi settings (phone, tablet, laptop)
- Select network
NoiseLight - Enter password:
12345678
-
Open the configuration page:
- Open browser and go to:
http://192.168.4.1 - The web interface will load automatically
- Open browser and go to:
-
Configure settings in real-time:
- Live dB level display updates every 200ms
- All sliders update preview instantly
- Press Save Configuration to persist settings to device storage
Display Mode
- Traffic Light: All LEDs show single color (GREEN/YELLOW/RED)
- VU Meter: LEDs create gradient bar showing sound intensity
LED Settings
- Brightness: 0β255 (default: 57)
- Color Selection: Choose custom colors for each noise level
Switchover Points (dB)
- Floor Level: Noise floor baseline (default: 37 dB)
- GreenβYellow: Transition threshold (default: 52 dB)
- YellowβRed: Alert threshold (default: 62 dB)
- Color Preview: Visual bar shows LED colors across dB range
Response Timing
- Decay Time: How long to hold current color after sound stops (0β3000 ms, default: 2400 ms)
- Response Time: Minimum update interval between LED changes (0β500 ms, default: 50 ms)
All configuration changes are automatically saved to ESP32's NVS (Non-Volatile Storage):
- Settings survive power loss
- Load automatically on device startup
- Accessible via
/api/configendpoint
- PlatformIO (VS Code extension or CLI)
- Arduino IDE (optional, for direct compilation)
# Using PlatformIO
platformio run -e esp32-s3-devkitc1-n4r2
# Or in VS Code: Ctrl+Shift+B β Build# Using PlatformIO
platformio run -t upload -e esp32-s3-devkitc1-n4r2
# Or in VS Code: Ctrl+Shift+B β UploadThe device outputs dB measurements to the serial monitor (115200 baud):
Leq: 45.3 dB | Min: 40 | Max: 60 | GREEN
Leq: 62.1 dB | Min: 40 | Max: 60 | RED
Leq: 55.2 dB | Min: 40 | Max: 60 | YELLOW
If readings are consistently off:
- Measure known sound level (e.g., using phone app)
- Compare with serial output
- Adjust MIC_OFFSET_DB in
main.cpp:#define MIC_OFFSET_DB 3.0103 // Increase/decrease calibration offset
- Mount microphone in center of room
- Avoid placing near walls or corners (reflections)
- Keep away from vibration sources
- Ensure clear air path (not covered)
| Issue | Cause | Solution |
|---|---|---|
| Always GREEN | Microphone not connected | Check I2S pins (GPIO 4,6,7) |
| Always RED | Calibration off | Adjust MIC_OFFSET_DB |
| No serial output | Wrong baud rate | Set to 115200 |
| No LED response | Wrong LED pin | Verify GPIO 2 connection |
| Microphone noise floor high | Electrical noise | Shield data lines, check power supply |
- Original deciLight Project: https://github.com/bbbenji/deciLight
- FastLED Documentation: http://fastled.io/
- ESP-IDF I2S API: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2s.html
- A-weighting Filter: https://en.wikipedia.org/wiki/A-weighting
This project is adapted from deciLight (GPL-3.0). Licensed under GNU General Public License v3.0.
- IR remote control for threshold adjustment
- MQTT integration for remote monitoring
- WiFi display (web dashboard)
- Multiple noise zones (classroom network)
- Adjustable color mapping
- Sound event logging
