Smart Home IoT Project Report
Smart Home IoT Project Report
“SMART HOME”
for the partial fulfilment of the Degree of Bachelor of Technology in
(SESSION 2022-2026)
Submitted by:
1|P a ge
KONARK INSTITUTE OF SCIENCE &
TECHNOLOGY
CERTIFICATE
This is to certify that the project report entitled "SMART HOME" submitted by
Jigyansu Bej bearing Registration Number 2201214042, is submitted in partial
fulfillment of the requirements for the award of the Bachelor of Technology
degree.
This project report is an authentic piece of work carried out under my supervision
and guidance.
2|P a ge
ACKNOWLEDGEMENT
I take this opportunity to express my heartfelt thanks to all those who individually
as well as collectively helped us in the successful completion of this project.
I also extend our sincere thanks to all the Computer Science Engineering
Department faculty members for their support and encouragement.
I owe special thanks to my parents for their moral support and warm wishes, and
finally, I would express our appreciation to all my friends for their support which
helped me to complete my project successfully.
3|P a ge
DECLARATION
I further declare that no part of it has been submitted for the award,
degree or diploma, or similar title of this for any other Examining
Body/University or Institute previously.
4|P a ge
ABSTRACT
The Smart Home project aims to design and develop an IoT-based intelligent
home automation system that ensures comfort, safety, and efficiency through
seamless communication between hardware and cloud services. The system
enables users to monitor and control household appliances such as fans, lights,
and water pumps using a web-based interface built with [Link] and Tailwind
CSS.
The system’s intelligence lies in its ESP32 microcontroller, which acts as the
brain of the hardware unit. It communicates with the cloud-based [Link] +
Express server through HTTP protocol and WebSocket connections for real-
time control and data synchronization.
The user authentication and OTP verification are managed using the Twilio API,
ensuring secure access. Environmental awareness is incorporated through sensors
such as gas sensors (for smoke detection) and ultrasonic sensors (for water level
monitoring). The buzzer acts as a safety alarm, while RGB LEDs visually
indicate Wi-Fi, API, and smoke status.
The entire architecture is powered by a 12V SMPS regulated via a DC-DC buck
converter (12V to 5V) for the ESP32. On the software side, MongoDB and
MySQL are used in a hybrid model — MongoDB for user authentication and
MySQL for ESP control and data logging — ensuring both scalability and
reliability.
Overall, the Smart Home system demonstrates real-time IoT automation, data-
driven decision-making, and modern web architecture, serving as a
foundation for future AI-enabled smart city systems.
5|P a ge
CONTENTS
6|P a ge
(CHAPTER 1)
INTRODUCTION
With the rapid advancement in Internet of Things (IoT) and cloud computing technologies,
home automation has emerged as a crucial component of modern smart living. The concept of
a Smart Home revolves around creating an intelligent environment where various electrical and
electronic appliances, sensors, and actuators are interconnected and can be remotely monitored,
controlled, and automated to improve the quality of life, ensure safety, and optimize energy
consumption.
Traditional home systems generally lack flexibility, require manual configuration, and are
incapable of adapting to dynamic user requirements or environmental changes. Most of them
depend heavily on human interaction for routine operations such as switching appliances on or
off, monitoring water levels, or detecting hazardous conditions like gas leaks or smoke. These
limitations not only result in inefficiency but also pose potential safety and environmental
concerns.
The proposed Smart Home project bridges this technological gap by integrating IoT modules,
APIs, and databases into a unified, interconnected, and intelligent ecosystem that can be
accessed and controlled from any web browser. The system is designed to provide real-time
monitoring, automated responses, and user control over various household operations through
an interactive and responsive web interface.
At the hardware level, the system employs the ESP32 microcontroller, which serves as the
central control unit. It interfaces with multiple sensors and actuators, including gas sensors for
smoke and leakage detection, ultrasonic sensors for water level measurement, relays for
appliance control, buzzers for alerts, and RGB LEDs for system status indication. The ESP32
is programmed using the Arduino IDE and communicates with the cloud-based [Link] +
Express server via HTTP and WebSocket protocols. This ensures fast and secure data
transmission between the hardware and the cloud, allowing real-time updates and command
execution.
On the software side, the frontend is developed using [Link] and Tailwind CSS, providing a
clean, modern, and mobile-responsive dashboard. This interface allows users to monitor sensor
7|P a ge
data, control appliances, and view real-time environmental information. The system integrates
with a Weather API, which dynamically displays current weather conditions and enables
intelligent automation — for example, adjusting fan control or lighting based on ambient
temperature or light levels. To ensure security and reliability, the Smart Home system
implements OTP-based user authentication through the Twilio Messaging API. The user
database and authentication details are managed in MongoDB, while device commands, ESP
status, and sensor readings are stored in MySQL for efficient retrieval and synchronization.
This dual-database architecture provides both scalability and stability, ensuring smooth system
operation even under multiple concurrent requests.
The hardware setup is powered by a 12V SMPS, regulated down to 5V using a DC-to-DC buck
converter to maintain safe voltage levels for the ESP32 and peripheral devices. For testing and
simulation, the system uses Wokwi, where relays are represented by LEDs and motors simulate
fan and pump operations.
The project also utilizes Render for backend deployment and Vercel for hosting the client
interface, with GitHub serving as the version control repository for collaborative development
and version tracking.
Overall, the Smart Home project exemplifies the power of combining IoT, cloud technology,
and web development into a single, intelligent automation platform. It ensures:
By integrating hardware intelligence with web-based control and cloud services, this project
takes a step toward building future-ready smart environments that are secure, scalable, energy-
efficient, and user-centric. It serves as a foundational prototype for larger implementations in
smart cities, eco-homes, and next-generation IoT-enabled infrastructures.
8|P a ge
PROBLEM STATEMENT
In traditional households, electrical appliances and safety systems are manually operated,
leading to inefficiencies and potential hazards such as energy wastage, overfilling water
tanks, or fire/smoke incidents going unnoticed.
Existing home automation systems are often expensive, platform-dependent, or require
complex configurations, making them less accessible to common users.
Additionally, most systems lack real-time monitoring, secure user authentication, and
multi-device communication, which are crucial in modern IoT ecosystems.
Therefore, there is a need for a low-cost, cloud-connected Smart Home system that integrates
monitoring, control, and safety features accessible from any device through a web-based
interface.
1. To develop a real-time monitoring system using ESP32 and sensors for detecting
smoke, gas, and water levels.
2. To build a user-friendly web interface using [Link] and Tailwind CSS for controlling
devices and displaying status updates.
3. To establish secure communication between client, server, and hardware using
WebSocket and HTTP protocols.
4. To implement OTP-based authentication using the Twilio messaging API for user
verification.
5. To integrate weather information using external Weather APIs for smart decision-
making.
6. To maintain reliable data storage using MongoDB (user data) and MySQL (device
data).
7. To deploy the system on cloud platforms (Render for backend and Vercel for frontend)
ensuring 24/7 accessibility.
8. To test and validate the system for stability, performance, and real-time
synchronization.
9|P a ge
(CHAPTER 2)
FEASIBILITY STUDY
A feasibility study is conducted to ensure that the Smart Home project is technically,
economically, and operationally viable. It evaluates whether the proposed system can be
successfully implemented with the available resources, time, and technology.
The Smart Home system is technically feasible because it uses readily available and proven
technologies such as the ESP32 microcontroller, [Link], and [Link]. All sensors and
actuators (gas sensor, ultrasonic sensor, relay, buzzer) are easily compatible with ESP32, and
their drivers are well supported by the Arduino IDE. The cloud communication is achieved
using WebSocket and HTTP protocols, ensuring real-time control and data synchronization.
Modern databases like MongoDB and MySQL provide scalability and efficiency in data
storage and retrieval. Hence, from a technical perspective, the proposed solution is practical
and reliable.
The system’s total cost is low and affordable for academic and prototype-level development.
It uses cost-effective components like ESP32, basic sensors, and open-source software tools.
Hosting platforms such as Render and Vercel offer free or low-cost deployment options,
reducing expenses.
10 | P a g e
All software and APIs ([Link], MongoDB, MySQL, [Link]) are open-source, making the
system highly economical for implementation.
Moreover, OTP-based authentication enhances security, ensuring only authorized users can
control devices.
Thus, the system can be effectively operated with minimal training or supervision.
The Smart Home project can be completed within the duration of a minor project semester
(8–10 weeks).
The timeline can be divided into stages such as:
The Smart Home system contributes to energy conservation and safety, promoting a
sustainable lifestyle.
By monitoring appliances and automating water usage, it helps reduce waste and improve
resource efficiency — aligning with the Smart City and Green Energy initiatives.
11 | P a g e
HARDWARE AND SOFTWARE ARCHITECTURE
1 Hardware Architecture
ESP32 Dev Module – Main IoT microcontroller responsible for control and
communication.
RGB LEDs (x3) – Status indication for Wi-Fi, API, and smoke conditions.
Relay Module / LED Simulation – For fan and light control (replaced by LEDs in
simulation).
DC to DC Buck Converter (12V to 5V) – Power regulation for ESP32 and sensors.
2 Software Architecture
o Framework: [Link]
12 | P a g e
o APIs: REST APIs for commands and WebSocket for real-time updates
Databases:
o MySQL: For ESP status logs, sensor data, and device commands.
Hardware Firmware:
o Language: C/C++
o Connection: ESP32 communicates with the [Link] server via HTTP server
protocol.
External APIs:
13 | P a g e
CIRCUIT DIAGRAM OF SMART HOME SYSTEM
14 | P a g e
CIRCUIT DIAGRAM EXPLANATIONS
1. ESP32 as the Central Controller
The ESP32 development board serves as the brain of the entire Smart Home system. It features
dual-core processing, built-in Wi-Fi, and multiple GPIO pins, making it ideal for IoT
applications. All sensors, relays, and actuators are directly connected to the ESP32’s digital
pins. It processes input signals from sensors (like gas and ultrasonic) and sends real-time data
to the cloud using HTTPS communication. It also receives control commands (e.g., turning
on/off fan or light) from the web server through WebSocket or REST APIs, ensuring live
synchronization between hardware and software. The ESP32 operates on a stable 5V power
supply derived from a 12V SMPS through a DC-to-DC buck converter, which ensures a
constant and safe voltage for microcontroller operation.
Two relay modules are connected to the ESP32 to control high-power electrical devices such
as lights and water pumps. In this simulation, LEDs represent relay outputs, but in practical
use, the relay modules act as electronic switches that isolate and safely control AC or DC loads.
Each relay input is connected to an ESP32 GPIO pin, which drives it HIGH or LOW to toggle
the device ON or OFF. The relay modules are powered by 5V, with their grounds connected to
the ESP32 common ground.
An L298N motor driver module is connected to control a DC motor, which represents the fan
or a water pump in the system. The motor driver receives control signals from three ESP32
pins:
IN1 and IN2 determine the motor’s direction (forward or reverse).
ENA is connected to a PWM channel, allowing control over motor speed (fan
regulation).
The motor driver’s Vmotor pin receives 12V from the SMPS, while the logic section is
powered by 5V from the buck converter, ensuring safe operation of both high- and low-
voltage circuits.
HC-SR04 Ultrasonic Sensor: Measures the distance between the sensor and the water
level in a tank. The TRIG and ECHO pins connect to ESP32 GPIOs for pulse
transmission and reception, providing the water level reading in centimeters.
MQ-Series Gas Sensor: Detects the presence of smoke or harmful gases. Its analog
output is connected to one of the ESP32’s ADC (Analog-to-Digital Converter) pins,
allowing real-time monitoring of air quality.
15 | P a g e
5. Visual and Audio Alerts
The circuit includes three RGB LEDs to visually represent system statuses:
Wi-Fi LED: Indicates network connectivity (Red = disconnected, Yellow =
connecting, Green = connected).
API LED: Shows server communication status.
Smoke LED: Displays air quality (Blue = normal, Red = smoke detected).
In addition, a buzzer is connected via a transistor driver circuit to alert users audibly
during smoke or gas detection events. This dual-alert mechanism ensures both visual
and audible feedback in emergency conditions.
The entire system is powered through a 12V SMPS, which provides adequate voltage for high-
power devices like motors and pumps. The voltage is stepped down to 5V using a buck
converter, which powers the ESP32, sensors, and relay modules. All components share a
common ground, ensuring stable operation and signal consistency. The overall circuit is neatly
integrated — combining sensors, actuators, communication modules, and safety indicators —
to deliver a fully functional IoT-based Smart Home system that emphasizes automation, safety,
and remote accessibility.
16 | P a g e
(CHAPTER 3)
Working Principle
The ESP32 collects data from sensors (gas, ultrasonic) and controls relays or
simulated LEDs.
Sensor readings and device statuses are sent to the [Link] server through HTTP.
The server updates the MySQL database with the latest data and sends updates to
the client via WebSocket.
The [Link] interface fetches and displays all real-time data, enabling users to toggle
devices.
On login, users receive an OTP via Twilio API for authentication.
Weather conditions are fetched via API and reflected on the dashboard with
animations.
Alerts (like smoke) trigger a buzzer and visual warnings on the web interface.
The system allows users to monitor and control appliances in real time from any location
through a secure web interface. Using WebSocket and HTTPS protocols, users receive
instant feedback and can toggle devices such as lights, fans, and pumps with minimal delay,
ensuring efficient and responsive home automation.
Equipped with a gas and smoke detection system, the Smart Home enhances household
safety. In case of a gas leak or smoke detection, the system triggers an audible buzzer alarm
and visual alerts through RGB LEDs, notifying users instantly. This proactive safety measure
helps in preventing fire hazards and ensures a secure living environment.
By using sensor-based automation and smart control algorithms, the system helps reduce
unnecessary power consumption. Automatic operation of fans, water pumps, and lights
ensures that devices are active only when needed, leading to significant energy savings and
promoting eco-friendly living.
The integration of cloud-based servers ([Link] and Express) with [Link] frontend allows
global access to the system. Users can log in securely, monitor home conditions, and control
17 | P a g e
devices from anywhere via the Internet. This cloud connectivity provides seamless IoT
communication and ensures that data is synchronized and accessible in real time.
User data and control commands are securely handled using OTP verification (Twilio API)
and a dual-database model (MongoDB + MySQL). This ensures both user-level security
and system reliability, preventing unauthorized access while maintaining smooth backend
operations and accurate data logging.
The Smart Home system uses low-cost, easily available components such as the ESP32,
ultrasonic sensor, L298N driver, and relay modules. All software frameworks used are
open-source, reducing overall project cost. Additionally, the modular architecture allows
future scalability — AI-based automation, voice control (Alexa/Google Home), or mobile app
integration can be easily added later.
18 | P a g e
CHALLENGES OF SMART HOME
The entire system relies heavily on a stable internet connection for real-time communication
between the ESP32 device and the cloud server. Any network interruption or weak Wi-Fi signal
can cause delays in command execution, missed updates, or even temporary loss of control,
affecting system reliability and user experience.
Since the Smart Home operates over the internet, it is exposed to potential cybersecurity
threats such as unauthorized access, data breaches, and hacking attempts.
Sensitive information like user credentials, OTPs, and device control commands must be
securely transmitted and encrypted to prevent malicious exploitation or privacy violations.
3. Integration Complexity
The system depends on a continuous and stable power supply for its operation. Any voltage
fluctuation or power failure can disrupt the functioning of sensors and controllers.
Additionally, components like the ESP32, L298N motor driver, and relays have current and
voltage limits, which restrict the direct control of high-power appliances without proper
isolation and protection circuits.
As new devices and sensors are introduced, integrating them into the existing Smart Home
framework can be difficult due to limited GPIO pins, software updates, and communication
protocol differences. Maintaining compatibility between various IoT devices and platforms
(e.g., different Wi-Fi modules or cloud services) remains a major scalability challenge for
large-scale deployment.
19 | P a g e
(CHAPTER 4)
The Smart Home system can also be adapted for small industries and offices to automate
lighting, cooling, and machinery based on sensor data. Environmental monitoring features,
such as smoke detection and temperature control, improve workplace safety, while automation
reduces operational costs and human errors.
By using water-level sensing and pump control, the same system can be implemented for smart
irrigation in agricultural fields or greenhouses. The ultrasonic and relay integration helps in
maintaining optimal water levels automatically, ensuring efficient water usage and crop health
with minimal human intervention.
The Smart Home system can assist elderly or disabled individuals by automating essential tasks
like lighting, temperature control, or safety alerts. Smoke or gas detection with buzzer alarms
ensures quick response during emergencies, making it a reliable support system in healthcare
environments.
This system can be deployed in college laboratories, classrooms, or hostels for energy
management and environmental monitoring. It also serves as a learning prototype for students
and researchers working on IoT, cloud computing, and automation technologies, encouraging
innovation and technical exploration.
20 | P a g e
CODING
// Smart Home - ESP32 with HTTPS communication to backend
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <esp32-hal-ledc.h>
#include <ArduinoJson.h> // Include ArduinoJson for command parsing
#define TRIG_PIN 12
#define ECHO_PIN 14
#define API_R_PIN 32
#define API_G_PIN 15
#define API_B_PIN 4
#define SMOKE_R_PIN 2
#define SMOKE_G_PIN 16
#define SMOKE_B_PIN 17
21 | P a g e
const int PWM_FREQ = 5000;
const int PWM_RES = 8; // 8-bit resolution (0..255)
// Status enums/values
int wifiStatus = 0; // 0=red,1=yellow,2=green
int apiStatus = 0; // 0=red,1=yellow,2=green
int smokeStatus = 1; // 0=red (smoke), 1=blue (clear)
// Communication timers
unsigned long lastHeartbeat = 0;
unsigned long lastUpdate = 0;
unsigned long lastCommandPoll = 0;
const unsigned long heartbeatInterval = 30000; // 30s
const unsigned long updateInterval = 5000; // 5s
const unsigned long commandInterval = 10000; // 10s
22 | P a g e
// ==== Helper Functions ====
void pwmWriteChannel(int ch, int value) {
if (ch < 0) return;
if (value < 0) value = 0;
if (value > 255) value = 255;
ledcWrite(ch, value);
}
ledcAttachPin(API_R_PIN, CH_API_R);
ledcAttachPin(API_G_PIN, CH_API_G);
ledcAttachPin(API_B_PIN, CH_API_B);
ledcAttachPin(SMOKE_R_PIN, CH_SMOKE_R);
ledcAttachPin(SMOKE_G_PIN, CH_SMOKE_G);
ledcAttachPin(SMOKE_B_PIN, CH_SMOKE_B);
}
23 | P a g e
if (wifiStatus == 0) setRGBbyChannel(CH_WIFI_R, CH_WIFI_G, CH_WIFI_B, 255, 0,
0);
else if (wifiStatus == 1) setRGBbyChannel(CH_WIFI_R, CH_WIFI_G, CH_WIFI_B, 255,
255, 0);
else setRGBbyChannel(CH_WIFI_R, CH_WIFI_G, CH_WIFI_B, 0, 255, 0);
// API LED
if (apiStatus == 0) setRGBbyChannel(CH_API_R, CH_API_G, CH_API_B, 255, 0, 0);
else if (apiStatus == 1) setRGBbyChannel(CH_API_R, CH_API_G, CH_API_B, 255, 255,
0);
else setRGBbyChannel(CH_API_R, CH_API_G, CH_API_B, 0, 255, 0);
// Smooth fade blink for a particular RGB channel set (uses channels)
void fadeBlinkChannels(int chR, int chG, int chB, int r, int g, int b) {
unsigned long now = millis();
if (now - lastFadeUpdate > fadeInterval) {
fadeValue += fadeDirection * 5;
if (fadeValue >= 255) { fadeValue = 255; fadeDirection = -fadeDirection; }
if (fadeValue <= 0) { fadeValue = 0; fadeDirection = -fadeDirection; showStatusLEDs();
return; }
lastFadeUpdate = now;
setRGBbyChannel(chR, chG, chB, (r * fadeValue) / 255, (g * fadeValue) / 255, (b *
fadeValue) / 255);
}
}
24 | P a g e
// Non-blocking cooling fan schedule implemented in loop()
void updateCoolingFan() {
unsigned long now = millis();
if (cooling_state == 0) { // initial ON 20s
if (now - cooling_state_start < 20000UL) {
digitalWrite(COOLING_FAN, HIGH);
} else {
digitalWrite(COOLING_FAN, LOW);
cooling_state = 1;
cooling_state_start = now;
}
} else if (cooling_state == 1) { // OFF for 60s after initial
if (now - cooling_state_start >= 60000UL) {
// switch to repeating schedule: ON 180s, OFF 60s
cooling_state = 2;
cooling_state_start = now;
digitalWrite(COOLING_FAN, HIGH);
} else {
digitalWrite(COOLING_FAN, LOW);
}
} else if (cooling_state == 2) {
unsigned long elapsed = now - cooling_state_start;
if ((elapsed % 240000UL) < 180000UL) {
digitalWrite(COOLING_FAN, HIGH);
} else {
digitalWrite(COOLING_FAN, LOW);
}
}
}
25 | P a g e
[Link]("Host: " + String(serverHost));
[Link]("Content-Type: application/json");
[Link]("Content-Length: ");
[Link]([Link]());
[Link]("Connection: close");
[Link]();
// Send payload
[Link](payload);
// Read response
// Wait for server to send response or timeout (10 seconds)
unsigned long timeout = millis();
while ([Link]() && ![Link]() && millis() - timeout < 10000UL) {
delay(10);
}
// Skip headers
while ([Link]()) {
String line = [Link]('\n');
if ([Link]("\r")) break;
}
26 | P a g e
}
}
if (httpResponseCode > 0) {
[Link]("Heartbeat sent: 200 OK");
apiStatus = 2; // green
} else {
[Link]("Heartbeat failed: " + String(httpResponseCode));
apiStatus = 0; // red
}
showStatusLEDs();
}
if (httpResponseCode > 0) {
[Link]("Update sent: 200 OK");
} else {
[Link]("Update failed: " + String(httpResponseCode));
}
}
27 | P a g e
// NOTE: This replaces the HTTPClient GET method
int httpsGet(const String& path, String& response) {
if ([Link](serverHost, httpsPort)) {
// Send request header
[Link]("GET " + path + " HTTP/1.1");
[Link]("Host: " + String(serverHost));
[Link]("Connection: close");
[Link]();
// Skip headers
while ([Link]()) {
String line = [Link]('\n');
if ([Link]("\r")) break;
}
28 | P a g e
}
// Path is /api/esp/command?espId=esp32
String path = "/api/esp/command?espId=" + espId;
String payload = ""; // payload will hold the response
if (httpResponseCode > 0) {
[Link]("Command received: " + payload);
if (error) {
[Link]("deserializeJson() failed: ");
[Link](error.c_str());
apiStatus = 1; // Yellow: Communication successful but data is corrupt/unexpected
format
showStatusLEDs();
return;
}
apiStatus = 2; // Green
// Control light
if ([Link]("lightStatus")) {
const char* lightStatus = doc["lightStatus"];
if (strcmp(lightStatus, "ON") == 0) {
lightState = true;
digitalWrite(RELAY_LIGHT, HIGH);
} else if (strcmp(lightStatus, "OFF") == 0) {
29 | P a g e
lightState = false;
digitalWrite(RELAY_LIGHT, LOW);
}
}
// Control fan
if ([Link]("fanStatus")) {
const char* fanStatus = doc["fanStatus"];
if (strcmp(fanStatus, "ON") == 0) {
digitalWrite(FAN_IN1, HIGH);
digitalWrite(FAN_IN2, LOW);
ledcWrite(CH_FAN, 255); // full speed on channel CH_FAN
} else if (strcmp(fanStatus, "OFF") == 0) {
digitalWrite(FAN_IN1, LOW);
digitalWrite(FAN_IN2, LOW);
ledcWrite(CH_FAN, 0);
}
}
} else {
// 3. Handle Other Non-JSON Responses
[Link]("Command poll failed: Response is not JSON (unexpected format).");
apiStatus = 1; // Yellow
}
} else {
[Link]("Command poll failed: " + String(httpResponseCode));
apiStatus = 0; // Red
}
showStatusLEDs();
}
// ==== Setup ====
void setup() {
[Link](115200);
delay(100);
pinMode(RELAY_LIGHT, OUTPUT);
pinMode(RELAY_PUMP, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(COOLING_FAN, OUTPUT);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
30 | P a g e
ledcAttachPin(FAN_ENA, CH_FAN);
// Default outputs
digitalWrite(RELAY_LIGHT, LOW);
digitalWrite(RELAY_PUMP, LOW);
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(COOLING_FAN, LOW);
digitalWrite(FAN_IN1, LOW);
digitalWrite(FAN_IN2, LOW);
ledcWrite(CH_FAN, 0); // Fan off
setupRGBPins();
showStatusLEDs();
// Connect WiFi
wifiStatus = 1; // yellow
showStatusLEDs();
[Link]("Airtel_hite_5737", "Air@00132");
unsigned long tstart = millis();
while ([Link]() != WL_CONNECTED && millis() - tstart < 20000UL) {
delay(200);
[Link](".");
}
if ([Link]() == WL_CONNECTED) {
wifiStatus = 2; // green
[Link]("\nWiFi connected: " + [Link]().toString());
} else {
wifiStatus = 0; // red
[Link]("\nWiFi failed");
}
showStatusLEDs();
}
// Read smoke sensor (assuming GPIO 34 is the analog input for the smoke sensor)
int smokeVal = analogRead(34);
// You may need to tune this threshold based on your sensor
if (smokeVal > 500) {
31 | P a g e
if (!smokeDetected) {
[Link]("Smoke detected!");
}
smokeDetected = true;
smokeStatus = 0;
digitalWrite(BUZZER_PIN, HIGH);
pulseSmokeLED_channels();
} else {
if (smokeDetected) {
[Link]("Smoke cleared.");
}
smokeDetected = false;
smokeStatus = 1;
digitalWrite(BUZZER_PIN, LOW);
showStatusLEDs();
}
32 | P a g e
WEB -APP USER INTERFACE
33 | P a g e
(CHAPTER 5)
FUTURE WORK
The Smart Home system developed using IoT and cloud technologies lays the foundation for
the next generation of intelligent living environments. Although the current prototype
efficiently performs automation, monitoring, and alert functions, there are several potential
improvements and expansions that can transform it into a fully autonomous smart ecosystem.
In the future, AI algorithms can be implemented to make the system more self-learning and
adaptive. By analyzing user habits and environmental conditions, the system can automatically
adjust lighting, temperature, and fan speed for maximum comfort and efficiency. This will help
create a truly intelligent home that operates without manual intervention.
The system can be enhanced by integrating voice assistants such as Amazon Alexa, Google
Assistant, or Apple Siri. This would allow users to control appliances and check system status
using simple voice commands. Additionally, gesture-based controls using motion sensors or
cameras could make operation more convenient and user-friendly, especially for differently-
abled individuals.
A dedicated Android and iOS mobile app can be developed to complement the web-based
dashboard. Through this app, users could receive push notifications, live status updates, and
security alerts even when they are away from [Link] app integration would improve
accessibility and enhance real-time control of connected devices.
By collecting and analyzing sensor data over time, the system could predict possible failures
in appliances or irregular energy usage patterns. Using data analytics and machine learning,
the system can generate reports on energy consumption and suggest optimization measures
to reduce electricity bills and prevent equipment damage.
Currently, most data are sent to cloud servers for processing. In the future, edge computing
can be implemented so that some processing occurs directly on the ESP32 or local gateway
34 | P a g e
devices. This will reduce latency, improve data privacy, and ensure continuous operation even
during network failures. It will make the system more secure, responsive, and independent.
(CHAPTER 6)
CONCLUSION
The Smart Home System represents a significant step toward the modernization of traditional
homes into intelligent, energy-efficient, and secure living environments. By leveraging the
power of the Internet of Things (IoT), cloud computing, and web technologies, this project
successfully demonstrates how household devices can be interconnected and managed
remotely through an interactive and user-friendly interface. The integration of sensors,
actuators, and online databases ensures real-time communication, data collection, and
automation — making daily life more convenient, safe, and sustainable. The main objective of
this project was to design and implement a cost-effective IoT-based home automation system
capable of monitoring environmental conditions and controlling electrical appliances remotely.
Using the ESP32 microcontroller as the core processing unit, the system connects to the internet
via Wi-Fi and communicates securely with the cloud-based [Link] + Express server through
HTTPS and WebSocket protocols. The [Link] + Tailwind CSS frontend provides a visually
appealing web dashboard for real-time control and monitoring, while the backend ensures
stable data management using MongoDB for user authentication and MySQL for device status
and command storage. The developed system successfully performs multiple operations such
as controlling lights, fans, and water pumps, monitoring water tank levels using an ultrasonic
sensor, and detecting smoke or gas leakage using an MQ-series sensor. Upon detecting any
hazardous condition, the system instantly activates the buzzer alarm and changes the color of
the RGB indicator LEDs, providing both visual and audible alerts.
Additionally, the integration of a weather API allows the system to fetch real-time weather
information, enabling smart environmental decisions such as adjusting fan operation or lighting
based on current conditions. Throughout the development, careful consideration was given to
security, efficiency, and reliability. The inclusion of OTP-based authentication using the Twilio
API ensures that only authorized users can access or control the system, enhancing data
integrity and user safety. The use of open-source technologies and low-cost hardware
components like the ESP32, L298N driver, and relays make the entire system highly affordable
and replicable for educational, residential, and small-scale industrial purposes.
The Smart Home system also demonstrates the potential for future expansion into AI-driven
automation, mobile app integration, and smart city infrastructure. With further improvements,
such as voice control, predictive analytics, and edge computing, this system can evolve into a
more autonomous and intelligent home ecosystem capable of learning user habits and
optimizing energy consumption.
In conclusion, the Smart Home project has successfully achieved its intended objectives by
combining hardware, software, and cloud technologies into a unified IoT platform. It not only
provides real-time monitoring and automation but also promotes energy conservation,
enhances safety, and reduces manual intervention.
35 | P a g e
The project serves as a solid foundation for future research and development in the fields of
IoT, embedded systems, artificial intelligence, and smart infrastructure. Ultimately, it
demonstrates how technology can transform traditional homes into intelligent environments
that align with the vision of sustainable and connected living in the modern digital era.
(CHAPTER 7)
REFERENCES
1. Simon Monk, Programming Arduino: Getting Started with Sketches, 2nd Edition,
McGraw-Hill Education, 2016.
– A practical guide for programming microcontrollers and interfacing sensors and
actuators using the Arduino IDE.
2. John C. Shovic and Alan Simpson, Raspberry Pi IoT Projects: Prototyping
Experiments for Makers, Apress, 2016.
– Provides real-world IoT project examples and insight into communication between
hardware and cloud systems.
3. A. Bahga and V. Madisetti, Internet of Things: A Hands-On Approach, Universities
Press, 2015.
– Covers IoT architecture, cloud communication, and real-time data handling relevant
to Smart Home applications.
4. ESP32 Technical Reference Manual, Espressif Systems, 2020.
– Official documentation describing the hardware features, Wi-Fi functionality, and
GPIO operations used in the project.
Available at: [Link]
5. Arduino Official Documentation, [Link].
– Reference for ESP32 setup, coding libraries, and integration using the Arduino IDE.
Available at: [Link]
6. [Link] and [Link] Documentation, [Link] Foundation.
– Used for developing the backend server and creating secure API communication.
Available at: [Link]
7. [Link] Official Documentation, Meta Platforms, Inc.
– Reference for building the Smart Home web dashboard with responsive design and
dynamic updates.
Available at: [Link]
8. MongoDB Developer Guide, MongoDB Inc.
– Used for storing authentication and OTP details in the database.
Available at: [Link]
9. MySQL Reference Manual, Oracle Corporation.
– Guide for structured data management and ESP32 device command storage.
Available at: [Link]
36 | P a g e
10. Twilio Messaging API, Twilio Inc.
– Used for OTP-based authentication to enhance system security.
Available at: [Link]
11. OpenWeatherMap API, OpenWeather Ltd.
– Used to fetch live weather updates for dynamic dashboard visualization.
Available at: [Link]
37 | P a g e