IoT Smart Home Automation Project
IoT Smart Home Automation Project
INTERNET OF THINGS
A major project report submitted in partial fulfillment of the
requirements for the degree of
BACHELOR OF TECHNOLOGY
in
ELECTRICAL ENGINEERING
Submitted By:
Affiliated to
We hereby declare that the project entitled “Smart Home Automation Using The
Internet Of Things” was carried out by us under the guidance of Professor &
Electrical Engineering. The results embodied in this report have not been copied
from any source. The results embodied in this report have not been submitted to
any other University or Institute for the award of any other degree.
This is here to certify that the project entitled “Smart Home Automation Using
The Internet Of Things” is a bonafide record of a major project presented by
Chandan Lenka (Regd. No. - 2001320103), Debabrata Ray (Regd. No. -
2001320099), Fhiroj Bag (Regd. No. - 2001320101) and Pabitra Kumar
ojha(Regd. No. - 2001320100), under the supervision of Dr Pratap Chandra
Nayak, Head of the Department (HOD), Electrical Engineering Department.
During the academic year 2020-24 in partial fulfilment of the requirements for the
award of the Degree of Bachelor of Technology in Electrical Engineering from
Aryan Institute of Engineering and Technology, Arya Bihar, Bhubaneswar,
Khordha, Odisha, Under Biju Patnaik University of Technology, Rourkela, Odisha.
We live in an exciting time where more and more everyday items and “things”
are becoming smart! “Things” have sensors and can communicate with other
“things” and can provide control to more “things”. The Internet of Things, IoT,
hugely is upon us and people are rapidly inventing new gadgets that enhance
our lives. The price of microcontrollers with the ability to talk over a network
keeps dropping and developers can now think and build things inexpensively.
This IoT-based home automation project is done using a low-cost custom build
ESP32 WiFi Module and Raspberry Pi Zero. A system that uses a mobile app to
control basic home functions and features automatically through the internet
from anywhere around the world, an automated home is sometimes called a
smart home. It is meant to save the electric power and provide better security
service. The home automation system differs from other systems by allowing
the user to operate the system from anywhere around the world through an
internet connection without breaking any convention usability.
This project provides a significant electric power-saving solution at homes and
at offices with the help of dynamic control of electric supply over the internet
using a smart switch, and another is a low-cost wireless plug-and-use
surveillance system with live streaming over the internet connection and in-
build video storage capacity.
The project contains both hardware and software development where the
hardware program is built using C and Python language on Arduino IDE,
whereas the mobile application is built using Java language Android studio.
Contents
Page
No.
Acknowledgement
Abstract
List Of Figures
List Of Table
Chapter 1 INTRODUCTION 1
1.1 Introduction 1
1.2 Objectives of the Project 1
1.3 Project focus 1
1.4 Organization of Report 2
Chapter 2 BACKGROUND MATERIAL 3
2.1 Conceptual Overview 3
2.2 Technologies Involved 5
Chapter 3 METHODOLOGY 10
3.1 Detailed methodology that will be adopted 11
3.2 Overall project timeline 14
Chapter 4 IMPLEMENTATION 15
4.1 Modules 15
4.2 Prototype 39
Last Chapter CONCLUSION & FUTURE SCOPE 31
6.1 Conclusions 31
6.2 Future Scope of Work (at least 3 points) 31
REFERENCE 32
LIST OF TABLE
Table No. Table Title Page No.
3.1 Overall Timeline 11
3.2 IP-based Surveillance MICROPROCESSOR Timeline 12
3.3 Smart-Switch Timeline 3
LIST OF FIGURES
Figure No. Figure Title Page No.
2.1 Smart-Switch Overview 3
2.2 Switch Setup 5
2.4 ESP 32 5
2.5 ESP 32 architecture diagram 5
2.6 Android Mobile Application 6
2.7 MICROPROCESSOR Setup 7
2.8 Raspberry Pi Zero 7
2.9 Raspberry Pi Zero Architecture 7
2.10 Image sensor 8
3.1 Software Development Cycle 10
4.1 Switch circuit diagram 16
4.2 Initial case Smart-Switch 17
4.3 First case Smart-Switch 17
4.4 Second case Smart-Switch 18
4.5 Third case Smart-Switch 18
4.6 Forth case Smart-Switch 19
4.7 Last case Smart-Switch 19
4.8 Flow char of mobile application 23
4.9 MICROPROCESSOR setup 23
4.10 Surveillance Flow diagram 26
4.11 Block processes on video 27
4.12 Smart Switch prototype 25
4.13 Smart Switch mobile application 29
4.14 IP-based Surveillance MICROPROCESSOR prototype 30
Chapter 1
INTRODUCTION
1.1 Introduction
Home automation has made it possible to have what is often referred to as a "Smart
Home", a home that can detect and identify you, automatically adjust the lighting to your
predefined taste, open doors automatically, play your favorite music, water your flower in the
morning, switch on the security lights at night and switch them off in the morning, heat water
for bathe and tea, stream to you anywhere in the world via internet a live video of what is
happening in and around your premises. It make it possible to link lighting, entertainment,
security, telecommunications, heating, and air conditioning into one centrally controlled
system. This allows you to your house an active partner in managing your busy life and assist
you with efficient living.
Nowadays, you can hardly find a house without a home automation system which can
range from the remote for the television, burglar alarm and hi-tech security surveillance, to an
automated air condition system that maintain the temperature at a predefined value.
This project wants to add new devices to home which can progress towards fully
automated home and make life easier and productive.
The objective of this project is to design and build new IoT hardware which can be
control using mobile application from anywhere around the world and that can installed at
every home and office at lowest possible cost.
1
1.4 Organization of Report
The entire Project is composed of five chapters. each covering a section of work as
summarized below:
Chapter one gives an introduction to automation as a whole and the different types
of automation. And also define project motivation and objectives.
Chapter two covers an extensive background overview of project working and which
technology are involved in development with establishment of standards and
protocols and benefits.
Chapter three highlights the project methodology, giving reasons for choice of
specific platform and components, and also comprehensive details on project
development timeline.
Chapter four is on the project design and implementation with clear practical details
of the project design, construction, testing, microcontroller coding and debugging.
Special emphasis is also made on the flexibility and scalability of the project work
with real life illustration.
Chapter five is on the project results and analysis, that how project fill up the needs
which was analysis at initial stage.
Last chapter is on the conclusion and recommendations based on the project work
with emphasis on the reliability, maintainability and flexibility of the design. Also,
recommendations based on the challenges encountered and further possible
development inn the project work.
2
Chapter 2
BACKGROUND MATERIAL
3
CIRCUIT DIAGRAM:
4
2.2 Technologies Involved
4 two-way switches.
4 port electromagnet relay.
220 Volt to 5 Volt AC to DC power
adapter. Software used to program ESP32
microcontroller
5
Fig 2.4 ESP 32 Fig 2.5 ESP 32 architecture diagram
6
Android Mobile Application
About half of the population around the world prefers Android over another operating
systems or devices. IoT is one of the biggest areas where Android app development
technology is continuously contributing with its enormous benefits. Internet of Things is
generally recognized as the interconnectedness of different smart devices over the Internet.
The devices make use of sensors and internet connectivity, which helps them receive, collect
and transmit information. So development on android platform is the right option for this
project.
Smart-Switch application named Smart-Fox is developed on android platform with API 19
compatible which covers 90.1% android device of the total devices.
List of support used on android device to run mobile application.
Wi-Fi.
Internet GSM.
Location.
Room SQLite database.
7
2.2.1 Technology using for IP-Based Surveillance MICROPROCESSOR
8
Sony IMX219 image sensor [3]
"IMX219", Type 1/4.0, approximately 8.08M effective pixels, back-illuminated
CMOS image sensor for the growing mobile market. The IMX219 satisfies the fulfillment
performance of "high sensitivity" and "high frame rate imaging" to meet the demands for
high-quality MICROPROCESSORapplications, and can be easily put on
MICROPROCESSORfronts of stylish and slim bezel devices achieved by the reduced size.
Not only the normal rate of all-8M pixels at full field of view and 30 frame/s, 4 times
faster imaging is also possible by 2 × 2 analog binning mode. Also, a LSC function*1
corrects optical unevenness to adjust during the module fabrication process, and contributes
to suppressing of system cost. Additionally, combining with a rear-end ISP supporting of
BME-HDR*2 enables future scalability of the high-dynamic-range video imaging.
Image sensor is prefect for video surveillance with low power consumption and high
quality video. This make image sensor perfect fit for this project.
9
2.1.2 Programming Language used during project
Project has used three different programming languages for our project. For the
development of the application on android, we have used Java Platform. Android Software
Development kit incorporates IntelliJ software where Java programming is performed. IntelliJ
software is used to write the codes for the application under Java Platform. Raspbian OS is
used at the raspberry pi.
Java: Java is a set of several computer software products and specifications from Oracle
Corporation that provides a system for developing application software and deploying it in a
cross-platform computing environment. Java is used in a wide variety of computing platforms
from embedded devices and mobile phones on the low end, to enterprise servers and
supercomputers on the high end.
Python: Python is an interpreter, interactive, object-oriented programming language. It
incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and
classes. Python combines remarkable power with very clear syntax. It has interfaces too many
system calls and libraries, as well as to various window systems, and is extensible in C or
C++. It is also usable as an extension language for applications that need a
programmable interface. Python is a high-level general-purpose programming language
that can be applied to many different classes of problems. 5.2.3.
C: For embedded programming of ESP 32 for Smart Switch using Arduino IDE. it is a non-
object-oriented high-level programming language.
Raspbian OS: Raspbian is a free Operating System based on Debian optimized for the
raspberry pi hardware. Raspbian comes with more than 35000 packages; pre-combined
software bundled in a nice format for easy installation on Raspberry pi.
10
Chapter 3
METHODOLOGY
11
3.2 Overall Project Timeline
IP-based T
Surveillance Phase - 1 E
MIC Surveillance S T
ROPROCES MICROPROCESSOR T E
SOR I S
Development N T
G I
N
Phase - 2 G
Smart Switch
Smart
Switch 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Develop
ment
Tim
elin
e
(We
eks)
MICROP
ROCESS 1
OR& Hardware Week
Research
2
Inte Weeks
r
a 2 T
c Weeks E
t S
i T
o 2 I
n Weeks N
1
D Week G
e
1 2 3 4 5 6 7 8 9
12
v
i
c
e
Cont
r
o
l
Video Processing
Algori
thm &
Backu
p
App Development
Liv
e
S
t
r
e
a
m
i
n
g
13
Timeline (weeks)
14
Phase -2 - Development of Smart-Switch.
This development was choose at second because it required high amount of time to
develop due to two different platform. Total six Iterative cycles were required to refine the
device in to perfect working condition.
Hardw
are 2
selection Weeks
and
compatibi
lity 1
Week
Embe
dded
3 Weeks T
Progra
ming E
S
T
Cloud 4 Weeks I
setup N
and data G
manage 1
Week
ment
Android
App
Develop 2
ment Weeks
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Communicatio
n Between
Device, App
and Cloud
Add
data
monitorin
g on
App
Tim
eline
(We
eks)
15
Chapter 4
IMPLEMENTATIN
4.1 Modules
Project is divided into two development modules :-
16
4.1 Smart Switch development
Except bulb connect, all device and circuit with be packed in switch board. Circuit
diagram represent accurate layout of connection inside switch board. Where individual
switch are connected with ESP 32 board and operate at 5 volt and electromagnetic trigger
relay is also control by ESP 32 board. When switch is on board trigger relay to complete
240 volt circuit of bulb, result to light in bulb.
So in Smart-Switch, ESP 32 board take decision when to turn on light, when switch is
pressed manually or receive request from mobile app through Wi-Fi network over internet.
17
2) Different possible case studies.
Initial case - Smart-switch is connected to web server using local Wi-Fi network over
internet. And mobile application can be connected to switch and set server through local Wi-
Fi network or over GSM internet connect as shown in Fig 4.2.
1st Case - when switch is turn on manually. Switch send request to server and update
the status, web server also update status of mobile app by sending back request to mobile
application. same process also repeat for turn off request.
18
2nd Case - when switch is turn on from mobile app when switch is in same Wi-Fi
network. Mobile app send direct request to smart switch and update status, same request is
also sent to server.
3rd Case - when switch is turn on from mobile app when connect over internet. Mobile app
sent request to web server and Switch get update from web server.
19
Fig 4.5 Forth case Smart Switch
4th Case - When Switch is turn on from mobile app when to internet services off-line and
mobile is connected to same network.
Last Case - When smart switch is off line. Even then switch can be turn on and off manually.
20
3) Embedad sudo program.
void start()
{
get wifi credentials ()
get web server
credentials () connect to
wifi()
if(no connect)
{
Start wifi AP mode to get connected()
}
get switch
status() Start
loop()
}
void loop() {
if(connected ){
check web server status()
check mobile app status()
check manual switch
status()
}
update relay status()
check status of
switch() delay()
continue loop()
}
GET and POST request and response from switch and mobile app to web
Responce = 14920:true
22
Update request from switch to web server
23
5) Mobile application flow and development.
24
Start Screen - Inital load all the data from room SQLite database from mobile and
check varify login credentials and sync data with web server.
Login Screen - Check login credentials and redirect to Wi-Fi configuration screen.
Signup Screen - Submit new user login detail with email opt varification.
Home Screen - where user can control all configure switch. When connected to network.
Device Config. - Configure new switch device to app and connect switch to local Wi-Fi
network, when switch is in Wi-Fi AP mode.
Switch Config. - When new switch device is configure to app it automatically add
all device switch to app and configure at default mode. Which can edit my user as
per need.
Switch Power usage - Shows to detail utilization of power for each switch and
device in Kilo-watts hours over a time of year.
25
4.2.1 IP-based Surveillance MICROPROCESSOR development.
26
2) Different test case parameters.
3) Sudo program.
27
4) Web sevice format and data storage format.
UDP – User Datagram Protocol is a transport protocol that can deliver “datagrams”
(data with some networking metadata attached to it) from one computer to another.
The data in a datagram might be just a small chunk of the full data object being
transferred between two computers, so each datagram has a sequence number that aids
in properly reconstructing the original data object. Unlike TCP, the UDP does not
require a connection to be established and kept alive between two computers. One
computer informs another computer of its IP address and the port on which it is
expecting to receive datagrams, and as long as a socket is listening on that port the
datagrams can keep flowing in. Another difference between UDP and TCP is that the
former does not make any guarantees that datagrams will arrive in the correct order (or
arrive at all). It is the application developer’s job to deal with reassembling the data
and accommodating any missing datagrams. UDP is commonly used for applications
that do not benefit from the strong delivery guarantees of TCP, such as video
streaming where dropping an occasional video frame or two is not a noticeable
problem.
28
RTSP – Real-Time Streaming Protocol is like HTTP but it is built specifically for
setting up, configuring, and tearing down streaming media sessions, such as a video
chat session or a movie being streamed to a computer from streaming media server.
RTSP is not involved with the actual video streaming, but just managing the
streaming session. It has a set of directives like DESCRIBE, which asks the streaming
media source to list the available media types and their capabilities, and SETUP,
which is how the client app tells the server which media type it wants to consume and
gets a session ID back in the response.
RTP – Real-time Transport Protocol is the low-level protocol used to break a video
into packets that can be streamed between computers. Those packets of video data are
often put into UDP datagrams. To get a feel for the kind of processing involved with
RTP video streams, check out this high-level overview of the process on
StackOverflow.
H.264 and MJPEG – These are commonly used compression techniques for
audio/video files. Most normal humans do not ever need to know or care about how
such things work or can be decoded, since companies like Apple build support for
them into their products. iOS uses hardware acceleration to decode H.264 video (by
processing it on the GPU instead of the CPU). I’m not sure if they hardware
accelerate MPEG4 but I assume they do. For a taste of what’s involved with decoding
H.264 formatted for RTP, check out RFC 6184. The main advantage of MPEG is
high quality video at fairly low data rates , In properly equipped pcs , this is an
excellent solution , We can size/position the video anywhere on the screen in both
AVI and MPEG format .
For this project selecting MJPEG will be advenatages protocal to live stream and store
video.
29
4.2 Prototype
1) Smart Switch
30
2) IP-based surveillance MICROPROCESSOR
31
Last Chapter
CONCLUSION & FUTURE
SCOPE
6.1 Conclusions
The prime objective of our project is to use the Smartphone to control the home
appliances effectively. The switch mode are used to control the home appliances. The video
feedback is received in the android app which streams the video of IP-
MICROPROCESSORera. This project is based on the Raspberry pi, Android platform Java,
ESP 32 and Python. These platforms are Free Open Source Software. So the overall
implementation cost is low and can be easily configured. User can easily interact with the
android phone/tablet. The user can send commands via the mobile application. The data are
being analyzed by the application and are sent over a network. The Raspberry pi and ESP 32
acts as a hardware, analyses the data and activates the GPIO (General Purpose Input Output)
Pins. The GPIO Pins are connected to the relays switch which activated the required home
appliances. In this way, automation process is carried out.
Both device are cost low extremely low.
Device Price
8000 Rs
IP-Based Surveillance ESP 32
MICRO PROCESSOR
32
REFERENCES
Conference Papers
[1] , “Home Automation”, Energy Efficient Smart Home Automation
System volume no 1, publication year 2015, Total pages 11.
Web
[1] About ESP32, www.espressif.com
[2] Raspberry Pi Zero W, www.raspberrypi.org
[3] MICROPROCESSORSensor, www.sony-semicon.co.jp
[4] Software development cycle,
www.upedu.org [5], ESP 32 , www.ESP 32
.com
[6] , Raspberry Pi Zero W setup, www.developer.ibm.com
33