"Smart Light Detection System with OLED, Buzzer, and ESP32"


 


Intelligent Light Detection System with Buzzer, OLED, and ESP32:


Introduction:
Greetings and welcome to Sadeem's Wire World, my very first project post!
I'll demonstrate a straightforward yet effective system I constructed with an OLED display, a buzzer, a photoresistor (LDR), and an ESP32 microcontroller in this blog.
I learned the basics of real-time data presentation, sensor interface, and simple alert systems from this project. Let's get started! 

Project Synopsis this light-sensitive warning system is intended to:
Determine the amount of ambient light.
Use an OLED screen to display feedback.
Set a buzzer to sound when it becomes too dark.

It is useful for:
Systems for nighttime security
Triggers for automatic landscape lighting
Make your own smart desk lighting.
Or just as an introduction to ESP32 + sensors for beginners.

Components Needed Component Quantity Objective:
1) The project's brain, the ESP32 Dev Board 1N
2) An LDR (light sensor). 1N. 
3) To measure the intensity of light, use a 10kΩ resistor 1N. 
4) For the LDR 0.96" OLED display (I2C) voltage divider 1N. 
5) To show the light status buzzer (passive or active) 1N. 
6) When darkness is detected, an audio alert Buzzer 1N.
7) Wires for jumpers and breadboards As required USB cable and Arduino IDE to connect everything without soldering 1N. To power and program the ESP32

Diagram of the Circuit:
I'll publish a tidy circuit diagram shortly.
 
However, to put it briefly:
A voltage divider made up of an LDR and a resistor is attached to the ESP32 ADC pin.
I2C is used to link the OLED to SDA (GPIO 21) and SCL (GPIO 22).
The buzzer is attached to a digital output (GPIO 5, for example).

Code For ESP32

#define LDR_PIN 34
#define BUZZER_PIN 5

void setup() {
  Serial.begin(115200);
  pinMode(BUZZER_PIN, OUTPUT);
  // Initialize OLED display
}

void loop() {
  int ldrValue = analogRead(LDR_PIN);
  Serial.println(ldrValue);

  if (ldrValue < 1000) {
    // Show message on OLED
    digitalWrite(BUZZER_PIN, HIGH); // Turn buzzer ON
  } else {
    digitalWrite(BUZZER_PIN, LOW); // Turn buzzer OFF
  }

  delay(500);
}

Learning Results:
Building this project taught me:
Connecting sensors to the ESP32,
Analog input handling (ADC),
Using I2C to display messages on an OLED &
Developing alert-based systems using straightforward reasoning

Enhancements You Could Include If you want to grow this project:
For precision, swap out the LDR for a digital light sensor like the TSL2561 or BH1750.
Connect Wi-Fi to your phone to receive alerts.
Use Blynk or MQTT to monitor remotely.
For time-based control, include a real-time clock (RTC).

Concluding Remarks:

My journey with embedded systems is only getting started!
Here on Sadeem's Wire World, I'll be posting more practical projects like this one that are easy to do, imaginative, and accessible to beginners.

Signing off:
Comment below or feel free to reach me out any time regarding any query related to it.

Setup of Project:




Comments

Popular Posts