This guide shows you how to build an ESP32 classroom noise monitoring display that listens to the room, shows an approximate noise level on an LCD, and lights a green, yellow or red LED so everyone can see at a glance whether the class is quiet, normal or noisy. It is a student and final year project — a working demo you can set up in a real classroom.
One honest note first: the number on the screen is an approximate noise score, not a true decibel measurement. Real decibels are logarithmic and need a calibrated sound meter. The KY-038 sound sensor is not calibrated — it gives an analog signal that the code maps to a 30–100 scale that behaves like decibels. For a classroom demo that is enough, but do not present it as a certified sound measurement.

The system continuously captures ambient sound with the sound sensor module. The ESP32 reads the analog signal, converts it into a decibel-like score, and updates the value on the LCD in real time. When noise passes a set limit, the LEDs change colour — green for quiet, yellow for normal, red for noisy — encouraging discipline without anyone having to say a word.
The system has four parts:
The modular design makes it easy to expand later with Firebase, Blynk or ThingSpeak.
0x27)| Component | ESP32 Pin |
|---|---|
| Sound sensor OUT | GPIO 34 |
| LCD SDA | GPIO 21 |
| LCD SCL | GPIO 22 |
| Green LED | GPIO 27 |
| Yellow LED | GPIO 26 |
| Red LED | GPIO 25 |
| Component | Price / link |
|---|---|
| ESP32 Dev Module | ESP32 30-Pin Wi-Fi Bluetooth Development Board — Rs 1,100 |
| 5mm LEDs (green, yellow, red) | 5mm Diffused LED — Rs 6 each |
The KY-038 / MAX4466 sound sensor and the 16×2 LCD do not have individual listings in the QKZEE shop — they are available at the Hall Road shop on request.
/*************************************************
ESP32 Classroom Noise Monitoring Display
With 16x2 I2C LCD
**************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
/* -------- LCD Configuration -------- */
LiquidCrystal_I2C lcd(0x27, 16, 2);
/* -------- Pin Definitions -------- */
#define SOUND_SENSOR_PIN 34
#define GREEN_LED 27
#define YELLOW_LED 26
#define RED_LED 25
/* -------- Noise Thresholds -------- */
int LOW_NOISE = 40;
int MEDIUM_NOISE = 65;
int HIGH_NOISE = 85;
void setup() {
Serial.begin(115200);
pinMode(GREEN_LED, OUTPUT);
pinMode(YELLOW_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Noise Monitor");
lcd.setCursor(0, 1);
lcd.print("Initializing");
delay(2000);
lcd.clear();
Serial.println("ESP32 Noise Monitoring System Started");
}
void loop() {
int soundValue = analogRead(SOUND_SENSOR_PIN);
// Convert analog value to approximate dB (not a true decibel reading)
int noiseLevel = map(soundValue, 0, 4095, 30, 100);
lcd.setCursor(0, 0);
lcd.print("Noise: ");
lcd.print(noiseLevel);
lcd.print(" dB ");
Serial.print("Noise Level: ");
Serial.print(noiseLevel);
Serial.println(" dB");
/* -------- Noise Status Logic -------- */
if (noiseLevel < LOW_NOISE) {
digitalWrite(GREEN_LED, HIGH);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, LOW);
lcd.setCursor(0, 1);
lcd.print("Status: Quiet ");
}
else if (noiseLevel >= LOW_NOISE && noiseLevel < MEDIUM_NOISE) {
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, HIGH);
digitalWrite(RED_LED, LOW);
lcd.setCursor(0, 1);
lcd.print("Status: Normal ");
}
else {
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, HIGH);
lcd.setCursor(0, 1);
lcd.print("Status: Noisy! ");
}
delay(500);
}
Noise: XX dB (the approximate noise score)Status: Quiet (green LED) / Status: Normal (yellow LED) / Status: Noisy! (red LED)LOW_NOISE, MEDIUM_NOISE and HIGH_NOISE numbers in the code to suit your classroom. There is no universal correct value — it depends on your room and your sensor.LOW_NOISE and MEDIUM_NOISE and test again.The ESP32 board and LEDs are available at QKZEE Technologies, Shop 20, 1st Floor, Al-Khalil Center, Hall Road, Lahore, and online at qkzeetech.com with delivery all over Pakistan — see the links above. The KY-038 / MAX4466 sound sensor and the 16×2 LCD are available at the Hall Road shop on request.
If the LCD stays blank, or the LEDs never change, message us — tell us what the Serial Monitor shows and which step you are on, and we will help you find the fault.
Chat on WhatsApp Watch on YouTube
Is the number on the screen a real decibel reading?
No. It is an approximate score: the code maps the sensor's analog reading (0–4095) to a 30–100 scale. It behaves like decibels for a classroom demo, but it is not a calibrated measurement. For a true dB reading you would need a calibrated sound level meter.
Can I use the KY-038's digital output (DO) instead?
No. The DO pin only gives HIGH/LOW above a threshold set by the onboard potentiometer — it cannot give a noise level. This code needs the analog output (AO) pin on GPIO 34.
Why is the red LED on all the time?
The thresholds are too low for your room. Raise LOW_NOISE and MEDIUM_NOISE in the code and test again — the right values depend on your classroom and your sensor.
Do I need the LEDs?
They are optional, but they are the point of the project — the whole idea is a display everyone in the room can read at a glance. Without them you only have the LCD number.
Can I upload the readings to the cloud?
Yes. The ESP32 has Wi-Fi built in — the same ThingSpeak pattern used in our other IoT project guides works here: send the noise level every 20 seconds and watch it on a web dashboard.
Where can I buy the parts in Pakistan?
From QKZEE Technologies on Hall Road, Lahore, or online at qkzeetech.com with Cash on Delivery across Pakistan — see the component links above.
Building an ESP32 classroom noise monitoring display with a sound sensor, an LCD and three LEDs is a clean final year project: it combines analog sensing, thresholds, and a visual display in one working system. Follow the wiring above, set the thresholds for your own classroom, and you will have a live noise display to show your teachers and judges.