How to Build an ESP32 Classroom Noise Monitoring Display for Student and Final Year Projects in Lahore, Pakistan

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.

ESP32 Classroom Noise Monitoring Display Circuit diagram

How the Noise Monitoring System Works

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.

System Architecture

The system has four parts:

  • Input: sound sensor (KY-038 / MAX4466)
  • Processing: ESP32 microcontroller
  • Display: 16×2 LCD with I2C + green, yellow and red LEDs
  • Communication: Wi-Fi (optional — for an IoT dashboard later)

The modular design makes it easy to expand later with Firebase, Blynk or ThingSpeak.

Hardware Used

  • ESP32 Dev Module
  • Sound sensor (KY-038 / MAX4466)
  • 16×2 LCD with I2C module (address 0x27)
  • LEDs — green, yellow, red (optional, but they are the point of the display)

Pin Connections

ComponentESP32 Pin
Sound sensor OUTGPIO 34
LCD SDAGPIO 21
LCD SCLGPIO 22
Green LEDGPIO 27
Yellow LEDGPIO 26
Red LEDGPIO 25
ComponentPrice / link
ESP32 Dev ModuleESP32 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.

Arduino Code

/*************************************************
 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);
}

What the LCD Shows

  • Line 1: Noise: XX dB (the approximate noise score)
  • Line 2: Status: Quiet (green LED) / Status: Normal (yellow LED) / Status: Noisy! (red LED)

Testing the Display

  1. Test the LCD first. Upload the sketch. The LCD should show "Noise Monitor" then "Noise: XX dB". If it stays blank, check SDA → GPIO 21, SCL → GPIO 22, and the I2C address — most LCD backpacks use 0x27, some use 0x3F.
  2. Test in a quiet room. With no sound, the reading should be low and the green LED should be on.
  3. Test with a clap. Clap once near the sensor — the number should jump and the LED should change to yellow or red for a moment, then settle back.
  4. Adjust the thresholds. If the red LED is on all the time, or never comes on, change the 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.

Troubleshooting

  • LCD shows nothing: check SDA → GPIO 21, SCL → GPIO 22, and try I2C address 0x3F if 0x27 shows nothing.
  • Reading stuck at 30 or 100: the sensor is not connected, or its output pin is not on GPIO 34. Check the sensor's AO (analog out) pin — the DO (digital out) pin will not work for this code.
  • Red LED on all the time: the thresholds are too low for your room. Raise LOW_NOISE and MEDIUM_NOISE and test again.
  • Reading jumps wildly: the sensor picks up electrical noise. Keep its wires short, away from the ESP32's Wi-Fi antenna area, and add a small delay or average a few readings if needed.

Applications

  • School discipline system — a visible noise indicator for classrooms
  • Student and final year projects — a complete sensor + microcontroller + display system
  • Smart campus solutions — one display per classroom
  • Final year project base — add Wi-Fi upload to ThingSpeak, a buzzer alert, or daily noise logs

Where to Buy the Components

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.

Still Stuck?

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

FAQs

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.

Conclusion

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.