0% found this document useful (0 votes)
9 views39 pages

Wifi Based Home Automatoin Black Book Ok

This project report details the development of a Wi-Fi-based home automation system using the ESP32 microcontroller, allowing remote control of household appliances via a centralized mobile application. The system enhances convenience, security, and energy management while ensuring user safety through various protective measures. The report includes an introduction, objectives, components used, and a comprehensive overview of the system's architecture and functionality.
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)
9 views39 pages

Wifi Based Home Automatoin Black Book Ok

This project report details the development of a Wi-Fi-based home automation system using the ESP32 microcontroller, allowing remote control of household appliances via a centralized mobile application. The system enhances convenience, security, and energy management while ensuring user safety through various protective measures. The report includes an introduction, objectives, components used, and a comprehensive overview of the system's architecture and functionality.
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/ 39

Shivajirao S.

jondhle polytechnic, asangaon

A
PROJECT REPORT
Wi-Fi-Based Home Automation
Submitted in the partial fulfillment of the requirement for the award of the diploma

in

ELECTRICAL ENGINEERING

Submitted by,

RUPESH D. SURYARAO
ADESH G. BHOIR
PRANAV P. CHAUDHARI
AMOL M. ZUGARE

UNDER THE GUIDANCE OF

DEPARTMENT OF ELECTRICAL ENGINEERING

SHIVAJIRAO.S.JONDHLE, POLYTECHNIC
ASANGAON

[2024-25]
Shivajirao S. jondhle polytechnic, asangaon

Vighnaharata Trust’s

SHIVAJIRAO S. JONDHLE POLYTECHNIC, ASANGAON


Institute Code: 0935
(Affiliated to Maharashtra State Board of Technical Education, Approved by AICTE)

Department of Electrical Engineering


2024-25
CERTIFICATE

This is to certify that Mr. RUPESH D. SURYARAO from


Shivajirao.S.Jondhle Institute having Enrollment No.23112090504 has completed
project of final year having title Wi-Fi-Based Home Automation during the academic
year2024-25.The project completed by individually/in a group consisting of 4
persons under the guidance of faculty guide.

Name & Signature of guide:----------------------


Telephone:

Head of Department Principal

External Examiner Sign Internal Examiner Sign


Shivajirao S. jondhle polytechnic, asangaon

Vighnaharata Trust’s
SHIVAJIRAO S. JONDHLE POLYTECHNIC, ASANGAON
Institute Code: 0935
Affiliated to Maharashtra State Board of Technical Education, Approved by AICTE)

Department of Electrical Engineering


2024-25
CERTIFICATE

This is to certify that Mr. ADESH G. BHOIR from


Shivajirao.S.Jondhle Institute having Enrollment No.23112090476 has completed
project of final year having title Wi-Fi-Based Home Automation during the academic
year2024-25.The project completed by individually/in a group consisting of 4
persons under the guidance of faculty guide.

Name & Signature of guide:----------------------


Telephone:

Head of Department Principal

External Examiner Sign Internal Examiner Sign


Shivajirao S. jondhle polytechnic, asangaon

Vighnaharata Trust’s

SHIVAJIRAO S. JONDHLE POLYTECHNIC, ASANGAON


Institute Code: 0935
(Affiliated to Maharashtra State Board of Technical Education, Approved by AICTE)

Department of Electrical Engineering


2024-25
CERTIFICATE

This is to certify that Mr. PRANAV P. CHAUDHARI from


Shivajirao.S.Jondhle Institute having Enrollment No.23112090496 has completed
project of final year having title Wi-Fi-Based Home Automation during the academic
year2024-25.The project completed by individually/in a group consisting of 4
persons under the guidance of faculty guide.

Name & Signature of guide:----------------------


Telephone:

Head of Department Principal

External Examiner Sign Internal Examiner Sign


Shivajirao S. jondhle polytechnic, asangaon

Vighnaharata Trust’s

SHIVAJIRAO S. JONDHLE POLYTECHNIC, ASANGAON


Institute Code: 0935
(Affiliated to Maharashtra State Board of Technical Education, Approved by AICTE)

Department of Electrical Engineering


2024-25
CERTIFICATE

This is to certify that Mr. AMOL M. ZUGARE from


Shivajirao.S.Jondhle Institute having Enrollment No.23112090507 has completed
project of final year having title Wi-Fi-Based Home Automation during the academic
year2024-25.The project completed by individually/in a group consisting of 4
persons under the guidance of faculty guide.

Name & Signature of guide:----------------------


Telephone:

Head of Department Principal

External Examiner Sign Internal Examiner Sign


Shivajirao S. jondhle polytechnic, asangaon

INDEX

Sr.no Page no.


Title of the chapter
1 Chapter 1: Introduction 1
1.1 Objective 2

1.2 Block Diagram 3

1.3 Component used 4

1.4 ESP Communications interface 6

1.5 Working principle 7

1.6 Type of SSRs 8

1.7 electrical specifications 8

2 Chapter 2: Power rating of resistor 12


2.1 Capacitor type 13

3 Chapter 3: LED electrical characteristics 15


3.1 Type of PCB based on material 17

4 Chapter 4: Circuit design and working 18


principle

4.1 Power of supply design 28


Shivajirao S. jondhle polytechnic, asangaon

4.2 Components required 18

4.3 Working Principle 19

5 Chapter 5: Software implementation 20

6 Chapter 6: WI-FI Connectivity 26

6.1 mobile / web interface 26

6.2 result 26

6.3 Application 26

7 Chapter 7 : Conclusion 27

8 Chapter 8: Reference 28

9 Actual Project 29
Shivajirao S. jondhle polytechnic, asangaon

LIST OF FIGURE

Page No
Fig.no. Name Of Figure

Fig.no.1 BLOCK DIAGRAM 3

Fig.no.2 15-ESP32-WROOM-32 Microcontroller 6

Fig.no.3 Solid State Relay (SSR) module. 7

Fig.no.4 Uno with Arduino SSR connection 9

Fig.no.5 10
Resistor and Resistor symbol

Fig.no.6 Various types of capacitors with symbol 13

Fig.no.7 15
Circuit Board (PCB)

Fig.no.8 ACTUAL PROJECT 29


Shivajirao S. jondhle polytechnic, asangaon

ACKNOWLEDGEMENT

It gives me a great pleasure to submit this project report on Wi-Fi-Based Home


Automation. I express my sincere thanks to my guide Mr.Samir Tarmale sir for his
guidance and time to time valuable suggestion and providing constant support
throughout this work.

I am very thankful to the staff members of electrical engineering department for


their persistent inspection inspiration.

I am also very much thankful to Principal, who has been a constant source of
inspiration to complete the work.
Shivajirao S. jondhle polytechnic, asangaon

ABSTRACT

The quick development of Internet of Things (IoT) technology has opened up the
possibility for fresh approaches to home automation, bringing greater convenience,
security, and energy savings. This paper provides a thorough review of a Wi-Fi-based
home automation system that uses wireless connectivity to monitor and control
household appliances from anywhere. The suggested system unifies different
components, such as smart lighting, climate control, security cameras, and household
appliances, through a common centralized mobile application.The system
architecture is developed to provide end- to-end communication among devices
through Wi-Fi protocols, where users can control their home setup from anywhere
across the globe with internet access. User-friendly interfaces and automation
algorithms enable custom settings, like scheduling, remote control, and real-time
alerts, to improve user experience and interaction.Security features, such as
encryption and authentication mechanisms, are integrated to safeguard user
information and bar unauthorized access. The system's scalability also facilitates the
incorporation of new devices with ease, rendering the system responsive to changing
user demands.Through a sequence of case studies and user opinions, the viability
and usability of the Wi-Fi- based home automation system are analyzed, showcasing
enhanced energy management, security, and overall quality of life. The study
identifies the potential of Wi-Fi technology to revolutionize conventional homes into
intelligent living spaces and ultimately towards the larger vision of smart cities and
sustainable living.
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-1
INTRODUCTION

In the era of the Internet of Things (IoT), home automation has emerged as a
transformative technology that enhances the comfort, security, and energy efficiency
of modern households. With the increasing availability of affordable
microcontrollers and wireless communication modules, homeowners can now
control and monitor electrical appliances remotely with ease. This project introduces
a Wi-Fi-based home automation system built around the ESP32 microcontroller,
designed to manage and control home appliances from any device connected to the
internet.

The ESP32, a powerful and cost-effective Wi-Fi-enabled microcontroller, acts as the


central control unit. It connects to a web-based interface or smartphone application,
allowing users to switch on or off three electrical loads (such as lights, fans, or other
devices) in real-time. The hardware setup includes MOC3020 optoisolators, which
provide electrical isolation between the low-voltage control side and high-voltage
AC loads, and TRIACs (BT41600B) for efficient AC load switching. A ULN2003
driver is used to interface between the ESP32 and the optoisolators for better current
handling capabilities.

The power supply section consists of a 12V AC to DC converter, relays,


resistors,capacitors and necessary wiring to ensure stable and safe operation of the
circuit. The system also supports secure IP- basedcommunication to prevent
unauthorized access, using Nauthentication mechanisms to ensure only verified users
can control the appliances.

By automating the control of household devices through a reliable and scalable


system, this project not only enhances user convenience but also promotes efficient
energy management. It serves as a practical model for implementing smart home
solutions that are both cost-effective and userfriendly,catering to the growing
demand for intelligent living environments.

1
Shivajirao S. jondhle polytechnic, asangaon

OBJECTIVE
.

The primary objective of this project is to develop a reliable and efficient home
automation system

 using the ESP32 microcontroller. The system should:


 Allow remote control of three electrical loads.
 Provide a user-friendly interface via Wi-Fi.
 Ensure safety using optoisolators and relays.
 Convert 12V AC to DC for powering the circuit.

2
Shivajirao S. jondhle polytechnic, asangaon

BLOCK DIAGRAM

Fig No.1

 Microcontroller: ESP32
 Wi-Fi Module: Integrated in ESP32
 Optoisolator: MOC3020
 Driver Circuit: ULN2003
 Switching Device: TRIAC (BT41600B)
 Power Supply: 12V AC to DC conversion
 Loads: 3 AC appliances

3
Shivajirao S. jondhle polytechnic, asangaon

COMPONENTS USED
Microcontroller
Microcontroller (ESP32)
The ESP32 is a powerful, low-cost, and energy-efficient microcontroller with integrated
WiFi and Bluetooth capabilities. Developed by Espressif Systems, it is widely used in IoT
applications, automation, smart devices, and wireless communication projects.

Features of ESP32
 Processor: Dual-core Xtensa LX6 (or single-core in some variants)
 Clock Speed: Up to 240 MHz
 Memory:
 520 KB SRAM
 External flash memory support (SPI Flash)
 Wireless Connectivity:
 Wi-Fi: 802.11 b/g/n (2.4 GHz) • Bluetooth: BLE 4.2 & Classic Bluetooth
 I/O Ports:
 Up to 34 GPIOs (depending on the module)
 ADC (12-bit, up to 18 channels)
 DAC (8-bit, 2 channels)
 SPI, I2C, UART, PWM, I2S, CAN, and SDIO interfaces
 Power Supply:
 Operating Voltage: 3.0V – 3.6V • Deep sleep power consumption: ~10 µA
 Security Features:
 Secure boot
 Flash encryption
 AES, RSA cryptographic support
 Operating Temperature: -40°C to 125°C
ESP32 is available in different SMD module variants, commonly used in embedded systems:
1. ESP32-WROOM-32
 Most commonly used module

4
4
Shivajirao S. jondhle polytechnic, asangaon

 Integrated PCB antenna


 4MB Flash (default), available in 8MB and 16MB versions
2. ESP32-WROVER
 Similar to WROOM but includes additional PSRAM
 Suitable for applications requiring more memory
3. ESP32-MINI-1
 Smaller form factor (16mm x 23mm)
 Ideal for compact applications
 Based on RISC-V architecture
 Lower power consumption
 Only single-core CPU
 The ESP32 supports different power modes:
 Active Mode: Full functionality with Wi-Fi and Bluetooth enabled.
 Modem Sleep: Wi-Fi/Bluetooth disabled, but the CPU remains active.
 Light Sleep: CPU paused, but peripherals like RTC and ULP processor remain
 active.
 Deep Sleep: Only RTC remains active, lowest power consumption (~10µA).
 Hibernation: RTC clock off, lowest power (~5µA).

5
Shivajirao S. jondhle polytechnic, asangaon

ESP32 Communication Interfaces


 UART: Up to 3 UART interfaces for serial communication.
 SPI: Supports high-speed SPI communication.
 I2C: Two I2C controllers for sensor and device communication.
 PWM: Up to 16 channels, useful for motor control, LED dimming.
 CAN Bus: Communication for automotive applications.
 Ethernet: Can be interfaced with external Ethernet modules.

 15-ESP32-WROOM-32 Microcontroller

Fig.no.2

6
Shivajirao S. jondhle polytechnic, asangaon

 Solid State Relay (SSR) is an electronic switching device that operates without
mechanical contacts. Unlike traditional electromechanical relays (EMR), SSRs use
semiconductor components such as triacs, thyristors, or MOSFETs to switch
electrical loads. SSRs offer silent operation, fast switching, and long lifespan,
making them ideal for industrial and automation applications.

 Solid State Relay (SSR) module.


Fig.no.3

• Working Principle
• An SSR consists of three main sections:
• Input Circuit (Control Side):
• Accepts a low-voltage DC or AC signal (e.g., from a microcontroller, PLC, or sensor).
• Uses an optocoupler to electrically isolate the input from the output.
• Isolation Stage (Optocoupler):
• Ensures electrical isolation between input and output.
• Uses an LED and a phototransistor or photothyristor inside the SSR to
activate switching.
• Output Circuit (Load Side):
• Uses a semiconductor switch (e.g., TRIAC, MOSFET, or SCR) to control the
highpower AC or DC load.
• Works in either Zero-Crossing Mode (switches at AC zero voltage to reduce noise) or
Random Turn-On Mode (switches immediately when triggered).

7
7
Shivajirao S. jondhle polytechnic, asangaon

• Types of SSRs
• SSRs are classified based on their output type:
• AC SSR
• Uses triacs or thyristors for switching.
• Designed for AC loads (e.g., heaters, motors, lighting).
• DC SSR
• Uses MOSFETs or IGBTs to switch DC loads.
• Used in applications like solar power, batteries, and automation.
• Hybrid SSR
• Combines a mechanical relay and SSR for improved efficiency.
• Suitable for high-power applications with frequent switching.

• Electrical Specifications

Parameter
Typical Value

Input Voltage 3V – 32V DC (Control Signal)

Load 24V – 480V AC / 3V – 100V DC


Voltage
Load
1A – 100A
Current
Switching
<1ms (very fast)
Speed
Isolation Voltage
2kV – 4kV

8
Shivajirao S. jondhle polytechnic, asangaon

 Arduino Uno with SSR connection


Fig.no.4

• Pin Configuration
• Most SSRs have four terminals:
• Input Side (Control Signal)
• + (Vcc): Connects to microcontroller or DC power source.
• - (GND): Connects to ground.
• Output Side (Load Switching)
• Load Input (L1 or A1): Connects to AC/DC live wire.
• Load Output (L2 or A2): Connects to the load.
• int SSR_Pin = 7; // SSR connected to pin 7
• void setup() {pinMode(SSR_Pin, OUTPUT);}void loop()
{digitalWrite(SSR_Pin, HIGH); // Turn ON AC load
• delay(5000);// Wait for 5 sec
• digitalWrite(SSR_Pin, LOW); // Turn OFF AC load
• delay(5000);// Wait for 5 sec

9
Shivajirao S. jondhle polytechnic, asangaon

Resistor
A resistor is a passive electrical component that resists or limits the flow of electric current in a
circuit. It is one of the most commonly used components in electronics, primarily for current
limiting, voltage division, and signal processing.

Resistor Symbol

 Resistor and Resistor symbol

Fig.no.5
Circuit Symbol:
There are two standard resistor symbols used in circuit diagrams:
 IEC Standard (Europe & Asia):
 A simple rectangle ( )▭
 ANSI Standard (USA):
 A zig-zag line (Ω)
 Both symbols represent the same component.

10
Shivajirao S. jondhle polytechnic, asangaon

Unit of Resistance
 Resistance is measured in Ohms (Ω).
 Ohm’s Law states: V=I×RV = I \times RV=I×R where:

 V = Voltage (Volts)
 I = Current (Amperes)
 R = Resistance (Ohms)

11
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-2
Power Rating of Resistors
Every resistor has a power rating, which defines how much power it can handle before overheating.

Power Common size Application


rating
1/8W Smallest Signal Signal circuits
circuits
1/4W Most common General use
1/2W Medium power Audio
circuits
1W High-power circuits Amplifiers
5W+ Power electronics Motors

Formula to calculate power:


P=V×I=I2×R=V2RP = V \times I = I^2 \times R = \frac{V^2}{R}P=V×I=I2×R=RV2 These
resistors have a fixed resistance value that does not change.

Type Description Common Uses


Low cost, widely used in general
Carbon Film Resistor circuits. General-purpose circuits.
Audio and
Metal Film Resistor Higher precision and stability.
measurement circuits.
Wire-Wound Resistor Handles high power. Power circuits and
amplifiers.
Thick & Thin Film High precision and small size. Precision electronics.
Resistor

 Capacitor
A capacitor is a passive electronic component that stores and releases electrical energy in a circuit. It
consists of two conductive plates separated by an insulating material called a dielectric. Capacitors are
commonly used for energy storage, filtering, and signal coupling in electronic circuits.

22 12
Shivajirao S. jondhle polytechnic, asangaon

Capacitor Symbol

 Various types of capacitors with symbol

Fig.no.6
Circuit Symbols:
 Polarized Capacitor (Electrolytic/Tantalum): “ |”⊥ (One side marked for polarity)
 Non-Polarized Capacitor (Ceramic/Film): “||” (Two parallel lines)

Unit of Capacitance
Capacitance is measured in Farads (F) and represents the ability of a capacitor to store charge.
The relationship is given by:

13
Shivajirao S. jondhle polytechnic, asangaon

C=QVC = \frac{Q}{V}C=VQ where:


• C = Capacitance in Farads (F)
• Q = Charge in Coulombs (C)
• V = Voltage in Volts (V)

 Types of Capacitors

A. Fixed Capacitors
These have a constant capacitance value.

Type Description Application

Descripti
Ceramic Capacitor Small, non-polarized, stable High-frequency circuits, RF
Electrolytic Capacitor Large capacitance, polarized Power supply filtering
Tantalum Capacitor Stable, high capacitance, Compact circuits, timing
polarized applications
Film Capacitor Durable, stable, non-polarized Audio, motor circuits

Super Very high capacitance, stores Battery backup, energy storage


Capacitor energy

B. Variable Capacitors
These allow capacitance adjustment.

Type Description Application


Trimmer Capacito Small adjustable capacitor Radio tuning
Air Capacitor Adjustable plates for varying RF applications
capacitance

14
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-3
LED Electrical Characteristics
A. Forward Voltage (Vf)
• The voltage required to turn the LED on.
• Example: A red LED has a typical forward voltage of 1.8V to 2.2V.

B. Forward Current (If)


• The current flowing through the LED when it is on.
• Typical values: 10mA to 20mA for standard LEDs.

C. Power Consumption
P=Vf×IfP = V_f \times I_fP=Vf×If where:
• P = Power in watts
• Vf = Forward voltage
If = Forward current

 Circuit Board (PCB)


A Printed Circuit Board (PCB) is the backbone of almost all electronic devices. It
provides mechanical support and electrical connections between components using
conductive pathways made of copper. PCBs allow complex circuits to be compact,
reliable, and easy to manufacture.

Fig.no.7

15
Shivajirao S. jondhle polytechnic, asangaon

PCB Structure and Layers

A. Basic Layers of a PCB


A PCB consists of multiple layers, each serving a specific function:

Layer Description
Substrate (Base Material)
Provides structural support (FR4, CEM-1, PTFE).

Conductive layer that forms electrical connections (single/double-sided or


Copper Layer
multi-layer).
Solder Mask A protective coating that prevents solder bridging and oxidation.
Silkscreen Layer Contains component labels, pin numbers, and branding.
B. Types of PCB Based on Layers

PCB Type Description Application

Single-Layer PCB One copper layer on LED circuits,


a substrate. low-cost
devices.
Double-Layer Copper layers on Power
PCB both sides with vias supplies,
industrial
electronics.
Multi-Layer PCB More than two Smartphones,
layers with aerospace,
insulating layers in high-speed
between. circuits.

16
Shivajirao S. jondhle polytechnic, asangaon

Types of PCB Based on Material


PCB Material Properties Applications
FR4 (Fiberglass Strong, durable, General-purpose
Epoxy good insulation. electronics.

CEM-1, CEM-3 Cost-effective alternative to FR4.


Consumer electronics.
Aluminum PCB High thermal conductivity. LED lighting, power electronics.
Flexible PCB (FPC) Bendable, lightweight. Wearable devices, medical equipment.

PCB Manufacturing Process


 PCB Design – Circuit layout using software like Eagle, KiCad, Altium Designer.
 Printing the Design – Transferring the layout onto the copper board.
 Etching – Removing unwanted copper to leave only the circuit traces.
 Drilling – Creating holes for component mounting.
 Plating & Solder Mask Application – Coating copper traces and adding protective layers.
 Silkscreen Printing – Printing component identifiers.
 Testing – Checking for electrical continuity and short circuits.
 Component Assembly – Soldering components onto the PCB.

PCB Design Software


 KiCad – Open-source and widely used.
 Eagle – Industry standard for PCB design.
 Altium Designer – Professional-grade software.
 EasyEDA – Online PCB design tool

17
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-4
CIRCUIT DESIGN AND WORKING PRINCIPLE
The system consists of an ESP32 microcontroller, which receives user commands via Wi-Fi. These
commands activate the optoisolator (MOC3020), which triggers the ULN2003 driver circuit. The
driver then activates the TRIAC (BT41600B) to control AC loads.

POWER SUPPLY DESIGN


6A 230V AC to 12V DC, 2A power supply is commonly used in embedded systems,
motor control, and other electronic applications requiring stable DC power. Below is
a detailed breakdown of the design process, including components, circuit diagram,
working principles, and safety considerations.

Components Required
Component Specification Function
Step-down Transformer 230V AC to 15V AC, 3A Reduces high voltage AC to lower

Bridge Rectifier 4 x 1N5408 (3A, 1000V) AC voltage Converts AC to DC


Filter Capacitor 4700µF, 25V Electrolytic Smoothens DC output
LM338 (Adjustable, 5A) or LM7812 Provides a stable 12V output
Voltage Regulator (Fixed 12V, 2A)

Heatsink Large Aluminum Heatsink Dissipates regulator heat


Protection Fuse 3A, 250V Protects against high current
MOV (Metal Oxide Varistor)
275V Protects against voltage spikes
Diode 1N4007 (Reverse polarity protection) Prevents reverse current damage
Capacitor 0.1µF Ceramic Reduces high-frequency noise

189
Shivajirao S. jondhle polytechnic, asangaon

Working Principle
1. Step-Down Transformer
The step-down transformer reduces 230V AC to 15V AC, 3A to ensure sufficient input for rectification.

2. Bridge Rectifier (AC to DC Conversion)


The bridge rectifier (using 1N5408 diodes) converts AC voltage to pulsating DC.

3. Filter Capacitor (Ripple Removal)


A 4700µF capacitor smooths the DC output by reducing voltage fluctuations.

4. Voltage Regulator (12V Output Stabilization)


If LM7812 is used: Provides fixed 12V, 2A output.
If LM338 is used: Adjustable output, can provide higher current (up to 5A with a heatsink).

5. Protection Circuit
• Fuse (3A, 250V): Prevents damage in case of a short circuit.
• MOV (275V): Protects against voltage spikes.
• Diode (1N4007): Prevents reverse polarity issues.
• 0.1µF Ceramic Capacitor: Reduces noise and improves stability.

19
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-5
SOFTWARE IMPLEMENTATION
Arduino IDE
 Used for programming the ESP32

code:-
#include <WiFi.h> #include
<WebServer.h>

#define LIGHT1_PIN 23
#define LIGHT2_PIN 22
#define LIGHT3_PIN 21
#define PWM_PIN 27

WebServer server(80); // Web server on port 80

// WiFi AP credentials const char


*ssid = "HomeAutomation"; const char
*password = "12345678";

void setup() {
Serial.begin(115200); //
Set pins as output
pinMode(LIGHT1_PIN,
OUTPUT);

0 20
Shivajirao S. jondhle polytechnic, asangaon

pinMode(LIGHT2_PIN, OUTPUT);
pinMode(LIGHT3_PIN, OUTPUT);
pinMode(PWM_PIN, OUTPUT);
// Start WiFi as Access Point WiFi.softAP(ssid, password);
Serial.println("WiFi Access Point started"); Serial.print("IP Address: ");
Serial.println(WiFi.softAPIP());
// Handle Web Requests server.on("/", handleRoot);
server.on("/light1", handleLight1); server.on("/light2",
handleLight2); server.on("/light3",
handleLight3);server.on("/fan", handleFanSpeed);//
Start Server
server.begin();}voidloop(){server.handleClient();}
// Serve HTML Web Page void handleRoot()
{server.send(200, "text/html", getHTML()); }
// Control Light 1 void handleLight1()
{int state = server.arg("state").toInt();
digitalWrite(LIGHT1_PIN, state); server.send(200,
"text/plain", "OK"); }// Control Light 2 void handleLight2()
{int state = server.arg("state").toInt(); 31

21
Shivajirao S. jondhle polytechnic, asangaon

digitalWrite(LIGHT2_PIN, state); server.send(200, "text/plain",


"OK");}
// Control Light 3 void handleLight3()
{int state = server.arg("state").toInt();
digitalWrite(LIGHT3_PIN, state); server.send(200,
"text/plain", "OK"); }
// Control Fan Speed (PWM) void
handleFanSpeed() {int speed =
server.arg("speed").toInt();
analogWrite(PWM_PIN, speed);
server.send(200, "text/plain", "OK");}
// HTML Web Page String
getHTML() { return R"rawliteral(
<!DOCTYPE html>
<html>
<head>
<title>ESP32 Control</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family: Arial, sans-serif; text-align: center; }
.button { padding: 15px; width: 120px; margin: 10px; font-size: 18px; cursor: pointer; }
.on { background: green; color: white; }
.off { background: red; color: white; }
.slider { width: 80%; }
body {
font-family: 'Arial', sans-serif;text- align: center;background:
linear-gradient(to right, #1e3c72, #2a5298);color: white;padding:
20px;}

32

22
Shivajirao S. jondhle polytechnic, asangaon

h1
{font-size: 36px; margin- bottom: 20px;}
.container {display:
flex;flex-direction:column;align-items:
center;justify- content: center;}
.control {background: rgba(255, 255, 255, 0.2); padding: 20px;
border-radius:15px;margin:
15px;width: 80%; max-
width:400px;}
h2 {font-size: 24px; margin- bottom: 15px; }
.button {padding:
15px;width: 150px; margin:
10px;font- size: 20px;font- weight:
bold; border: none;border-radius:
10px; cursor: pointer; transition:
0.3s; display: inline- block;}
.on {background:#28a745;color:white;
box-shadow: 2px 2px 10px rgba(0, 255, 0, 0.6);

23
Shivajirao S. jondhle polytechnic, asangaon

.off {background:
#dc3545;color:white;
box-shadow: 2px 2px 10px rgba(255, 0, 0, 0.6);}
.button:hover { transform:scale(1.05);}
.slider {width: 90%; height: 15px;
background: #ddd; outline: none; opacity:
0.9;border-radius:10px; transition:
opacity 0.2s;}
.slider:hover { opacity: 1;}
.slider::-webkit-slider- thumb {-webkit-
appearance: none;
appearance:nonwidth:30px;
height: 30px; background: #ffc107;
border-radius: 50%; cursor: pointer;
box-shadow: 2px 2px 10px rgba(255, 193, 7, 0.6);}
</style>
<script>
function toggleLight(light, state) { fetch(`/${light}?state=${state}`)
.then(response => console.log(response));}
function setFanSpeed()
{ let speed = document.getElementById("fanSpeed").value;
\fetch(`/fan?speed=${speed}`).then(response => console.log(response));} 34

24
Shivajirao S. jondhle polytechnic, asangaon

let speed = document.getElementById("fanSpeed").value; fetch(`/fan?speed=${speed}`)


.then(response => console.log(response));}
</script>
</head>
<body>
<h1>ESP32 Smart Home Control</h1>
<div class="container">
<div class="control">
<h2>Light Controls</h2>
<button class="button on" onclick="toggleLight('light1', 1)">Light 1 ON</button>
<button class="button off" onclick="toggleLight('light1', 0)">Light 1 OFF</button><br>
<button class="button on" onclick="toggleLight('light2', 1)">Light 2 ON</button>
<button class="button off" onclick="toggleLight('light2', 0)">Light 2 OFF</button><br>
<button class="button on" onclick="toggleLight('light3', 1)">Light 3 ON</button>
<button class="button off" onclick="toggleLight('light3', 0)">Light 3 OFF</button><br>
</div>
<div class="control">
<h2>Fan Speed Control</h2>
<input type="range" id="fanSpeed" class="slider" min="0" max="255" oninput="setFanSpeed()">
</div>
</div>
</body>
</html>
)rawliteral";}

, ,,25
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-6

Wi-Fi Connectivity
• ESP32 connects to a Wi-Fi network
• User commands sent via HTTP requests

Mobile/Web Interface
• Developed using HTML, CSS, and JavaScript

RESULTS
• The system successfully controls three loads remotely.
• Response time is minimal.
• The circuit operates efficiently with proper isolation.
• Power consumption is minimal due to efficient components.

APPLICATIONS
• Smart Home Automation
• Industrial Load Control
• Office Automation Systems

26
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-7
CONCLUSION
This project demonstrates a cost-effective and efficient Wi-Fi-based home
automation system using ESP32. The integration of optoisolators and TRIACs
ensures safety and reliability. Wi-Fi home automation provides a simple, efficient,
and scalable solution for smart living in the modern era. Utilizing existing Wi- Fi
infrastructure, users can remotely control and monitor home appliances using
smartphones or voice assistants, improving comfort, energy efficiency, and security.
The system does not require complicated wiring and is easy to integrate with other
smart devices. As technology continues to evolve, Wi-Fi home automation will keep
changing, providing even smarter and more seamless experiences in the smart home
environment.

27
Shivajirao S. jondhle polytechnic, asangaon

CHAPTER-8
REFERENCES
1. ESP32 Documentation
2. TRIAC BT41600B Datasheet
3. ULN2003 Datasheet
4. MOC3020 Datasheet

28
Shivajirao S. jondhle polytechnic, asangaon

ACTUAL PROJECT

Fig.no.8

29

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy