0% found this document useful (0 votes)
15 views8 pages

Dynamic Light Control System Report

The project report details the development of a dynamic light control system using an ESP32 microcontroller and an ultrasonic sensor to adjust LED brightness based on object proximity. It includes objectives, required components, circuit connections, and code implementation. The system aims to provide energy-efficient lighting solutions and has applications in automatic room lighting and interactive displays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

Dynamic Light Control System Report

The project report details the development of a dynamic light control system using an ESP32 microcontroller and an ultrasonic sensor to adjust LED brightness based on object proximity. It includes objectives, required components, circuit connections, and code implementation. The system aims to provide energy-efficient lighting solutions and has applications in automatic room lighting and interactive displays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Project Report on

DYNAMIC LIGHT CONTROL SYSTEM USING


ULTRASONIC SENSOR

Submitted by:

Group No.: 1

Group Members:

1. Adarsh T U BT24ECI021

2. Tanush Cherukuri BT24ECI007

3. Bodanki Sai Charan Ganesh BT24ECI017

4. Shravani Hermant Sonavane BT24ECI030

A report submitted for the partial fulfilment of the


requirements of the course

ECL-108 IoT Workshop - 1

Task Number # 4

Submission Date: 11/04/2025

Under the guidance of:

Dr. SAGAR MOTDHARE

Department of Electronics and Communication Engineering


Table of Contents:

Chapter No. Particular Page No.

1 Introduction 3-4

2 Objective 5

3 Components Required 6-8

4 Circuit Diagram & 9


Connections

5 Code 10-11

6 References 12
Chapter 1: Introduction

This project implements a smart lighting solution using an ESP32 microcontroller, ultrasonic

sensor, I2C-based 16x2 LCD, and a PWM-controlled LED. The system automatically adjusts

the brightness of an LED based on the distance of an object or person from the sensor.

As an object approaches the sensor, the LED becomes brighter. As it moves away, the brightness

gradually decreases. The distance and brightness percentage are displayed in real-time on the

LCD. This project mimics the functionality of energy-efficient lighting systems and provides a

hands-on application of PWM (Pulse Width Modulation) control in IoT systems.

Chapter 2: Objective

The objective of this project is to:

1. Measure the proximity of an object using an ultrasonic sensor.

2. Map the measured distance to a brightness level for an LED using PWM.

3. Display the distance and brightness information on a 16x2 I2C LCD.

4. Demonstrate smooth, real-time control of lighting based on object presence.


Applications include:

- Automatic room lighting

- Interactive displays

- Smart hallway lighting

Chapter 3: Components Required

1. ESP32 Development Board:

The ESP32 serves as the core processing unit. It reads the sensor data, controls the LED

brightness using PWM, and communicates with the LCD over I2C.

2. Ultrasonic Sensor (HC-SR04):

This sensor is used to measure the distance between itself and an approaching object by

emitting ultrasonic waves and measuring the echo time.

3. I2C LCD (16x2):


The LCD is used to display the measured distance and LED brightness. Since it is I2C-based,

it requires only two data pins: SDA and SCL, simplifying wiring.

4. LED (with 220-ohm resistor):

An LED is used to visually represent the brightness level based on distance. PWM from the

ESP32 controls the LED intensity.

5. Breadboard and Jumper Wires:

Used for prototyping and connecting the components without soldering.

Chapter 4: Circuit Diagram & Connections


Connections:

Ultrasonic Sensor HC-SR04:

- VCC -> 5V (ESP32)

- GND -> GND

- TRIG -> GPIO 5 - ECHO -> GPIO 18

I2C LCD:

- VCC -> 5V

- GND -> GND

- SDA -> GPIO 21

- SCL -> GPIO 22

LED:

- Anode (+) -> 220 Ohm resistor -> GPIO 13

- Cathode (-) -> GND

Chapter 5: Code

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16,

2); const int trigPin = 5; const


int echoPin = 18; const int

ledPin = 13; const int

pwmChannel = 0;

const int freq = 5000;

const int resolution = 8;

void setup() { Serial.begin(115200);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

ledcSetup(pwmChannel, freq,

resolution); ledcAttachPin(ledPin,

pwmChannel);

lcd.init();

lcd.backlight();

lcd.setCursor(0, 0);

lcd.print("Initializing...

"); delay(1000);

void loop() { digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);
digitalWrite(trigPin, LOW); long duration

= pulseIn(echoPin, HIGH); float distance =

duration * 0.034 / 2; int brightness =

map(distance, 100, 0, 0, 255); brightness =

constrain(brightness, 0, 255);

ledcWrite(pwmChannel, brightness);

lcd.clear(); lcd.setCursor(0, 0);

lcd.print("Dist: "); lcd.print(distance);

lcd.print(" cm"); lcd.setCursor(0, 1);

lcd.print("Bright: "); lcd.print((brightness *

100) / 255); lcd.print("%"); delay(500);

Chapter 6: References

[1] https://randomnerdtutorials.com/esp32-pwm-arduino-ide/

[2] https://lastminuteengineers.com/hc-sr04-ultrasonic-arduino-tutorial/

[3] https://randomnerdtutorials.com/esp32-i2c-lcd-arduino-ide/

[4] https://www.espressif.com/

[5] https://www.robotique.tech

You might also like