fuzzy control system for smart home application nik … · 2020. 7. 16. · microcontroller unit...
TRANSCRIPT
![Page 1: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/1.jpg)
i
FUZZY CONTROL SYSTEM FOR SMART
HOME APPLICATION
NIK NOR NATASHA AQILAH BINTI NEK LEH
BACHELOR OF COMPUTER SCIENCE
(COMPUTER NETWORK SECURITY) WITH
HONORS
UNIVERSITI SULTAN ZAINAL ABIDIN
2020
![Page 2: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/2.jpg)
ii
DECLARATION
I hereby declare that this report based on my original work except for quotations and citation,
which have been duly acknowledged. I also declare that it has not been previously or
concurrently submitted for any other degree at University Sultan Zainal Abidin or other
institutions.
Signature : ………………………………..
Name : Nik Nor Natasha Aqilah binti Nek Leh
Date : 16th July 2020
![Page 3: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/3.jpg)
iii
CONFIRMATION
This is to confirm that:
The research conducted and the writing of this report was under my supervision.
Signature : ………………………………….
Name : Dr Aznida Hayati Binti Zakaria@Mohamad
Date : 16th July 2020
![Page 4: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/4.jpg)
iv
DEDICATION
All praise is due to Allah who has given me this opportunity to conduct this report for this
final year project.
I would like to express my greatest appreciation to my family and friends who supported me
and encourage me throughout the process of completing my project. I would like to express
my sincere appreciation and gratitude to my supervisor Dr Aznida Hayati Binti Zakaria @
Mohamad for encourage, guidance, critics, advice, motivation and supports. This project
would not have been completed without continue support from them.
I have learned more from this subject about the way to conduct a project research. Every
single thing that I learned from my supervisor, I accepted as a valuable experience in my life.
I will always remember all the knowledge and guidance that I have obtained. Also, sincere
thanks to all my fellow friends for their help in completing my final project.
![Page 5: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/5.jpg)
v
ABSTRACT
The ever-growing use of smart devices has already influenced all aspects of human
life and has triggered the emergence of the smart home. Not to be mentioned, the different
parts of a Smart Home are researched but there are still distances from an applicable system,
using the modern technology. This paper presents the Smart Home system necessary for
controlling the house based on mobile application and microcontroller. The system is able to
monitor and control room temperature which is air conditioner and lights in the house using
fuzzy logic. The main aim of the prototype development is to reduce electricity wastage by
facilitating the home owner to optimize the usage of electricity through remote control using
mobile application. This is because the usage of the electricity were increased drastically
nowadays. Furthermore, this system also provide ease of control which support special needs
of the elderly and people with disabilities. Mobile application was used for sending message
from user’s mobile phone that automatically enable the controller to take any further action
such as to switch ON and OFF the home appliances such as lights and air conditioner. The
system is activated when user open and used the application in their mobile which then send
the signal to controller at home. Upon receiving the signal from mobile application, the
microcontroller unit then automatically controls the electrical home appliances by switching
ON or OFF the device according to the user order. In other words, it read signal from the
mobile phone and response to control the devices according to the received signal. This fuzzy
control system for smart home application could provide an effective mechanism in utilizing
the energy source efficiently.
![Page 6: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/6.jpg)
vi
ABSTRAK
Penggunaan peranti pintar yang semakin berkembang telah mempengaruhi semua
aspek kehidupan manusia dan telah mencetuskan kemunculan rumah pintar. Bahagian-
bahagian yang berbeza dari Rumah Pintar diteliti tetapi masih jauh dari sistem yang terpakai,
menggunakan teknologi moden. Jadi, projek ini membentangkan sistem Smart Home yang
diperlukan untuk mengawal rumah berdasarkan aplikasi mudah alih dan mikrokontroler.
Sistem ini dapat memantau dan mengawal suhu bilik yang merupakan penghawa dingin dan
lampu di dalam rumah menggunakan fuzzy logic. Tujuan utama pembangunan prototaip
adalah untuk mengurangkan pembaziran elektrik dengan memudahkan pemilik rumah untuk
mengoptimumkan penggunaan elektrik melalui alat kawalan jauh menggunakan aplikasi
mudah alih. Ini kerana penggunaan elektrik meningkat secara drastik pada masa kini. Selain
itu, sistem ini juga menyediakan kemudahan kawalan yang menyokong keperluan khas orang
tua dan orang kurang upaya. Aplikasi mudah alih digunakan untuk menghantar mesej dari
telefon pintar pengguna yang secara automatik membolehkan pengawal mengambil tindakan
lanjut seperti beralih ON dan OFF peralatan rumah seperti lampu dan penghawa dingin.
Sistem ini diaktifkan apabila pengguna membuka dan menggunakan aplikasi dalam telefon
pintar mereka yang kemudiannya menghantar isyarat kepada pengawal di rumah. Apabila
menerima isyarat dari aplikasi mudah alih, unit mikrokontroller kemudian mengawal
peralatan rumah elektrik secara automatik dengan menukar atau mematikan peranti mengikut
pesanan pengguna. Dalam erti kata lain, ia membaca isyarat dari telefon dan bertindak balas
untuk mengawal peranti mengikut isyarat yang diterima. Sistem kawalan fuzzy untuk aplikasi
rumah pintar dapat menyediakan mekanisme yang berkesan dalam menggunakan sumber
tenaga yang efisien.
![Page 7: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/7.jpg)
vii
CONTENTS
FUZZY CONTROL SYSTEM FOR SMART ........................................................................ i
HOME APPLICATION ......................................................................................................... i
DECLARATION .................................................................................................................. ii
CONFIRMATION ............................................................................................................... iii
DEDICATION ..................................................................................................................... iv
ABSTRACT ......................................................................................................................... v
ABSTRAK........................................................................................................................... vi
CONTENTS ....................................................................................................................... vii
LIST OF FIGURES .............................................................................................................. x
CHAPTER I ......................................................................................................................... 1
INTRODUCTION ................................................................................................................ 1
1.1 Background ................................................................................................................. 1
1.2 Problem Statement ....................................................................................................... 2
1.3 Objective ..................................................................................................................... 3
1.4 Scope ........................................................................................................................... 3
1.5 Limitation .................................................................................................................... 4
1.6 Expected Result ........................................................................................................... 4
CHAPTER II ....................................................................................................................... 5
LITERATURE REVIEW ...................................................................................................... 5
2.1 Introduction ................................................................................................................. 5
2.2 Related Works ............................................................................................................. 6
2.2.1 Smart Home Automation System........................................................................... 6
2.2.2 Home Automation System using Android .............................................................. 7
2.2.3 Android Based Automation System for the next Generation of Technology using
Wi-Fi ............................................................................................................................. 8
![Page 8: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/8.jpg)
viii
2.2.4 SHAS-IoT : Smart Home Automation System (SHAS) using Internet of Things
(IoT) to Improve Safety and Security ............................................................................. 9
2.2.5 An Internet of Things Based Air Conditioning and Lighting Control System for
Smart Home ................................................................................................................. 10
2.2.6 Smart Home Control by using Raspberry Pi & Arduino UNO ............................. 11
2.2.7 Advanced Home Automation System Using Raspberry pi and Arduino ............... 12
2.2.8 Smart GSM Based Home Automation System ..................................................... 13
2.2.9 Social Networks of Things for Smart Homes Using Fuzzy Logic......................... 14
CHAPTER III ..................................................................................................................... 15
METHODOLOGY.............................................................................................................. 15
3.1 Introduction ............................................................................................................... 15
3.2 Methodology Phases .................................................................................................. 16
3.2.1 Planning .............................................................................................................. 17
3.2.2 Data Model (Requirement) .................................................................................. 17
3.2.3 Design ................................................................................................................. 21
3.2.4 Implementation ................................................................................................... 24
3.2.5 Testing ................................................................................................................ 24
3.2.6 Deployment ......................................................................................................... 25
3.3 Summary ................................................................................................................... 25
CHAPTER IV ..................................................................................................................... 26
IMPLEMENTATION ......................................................................................................... 26
4.1 Introduction ............................................................................................................... 26
4.2 Project Implementation .............................................................................................. 27
4.3 Expected Result ......................................................................................................... 28
4.4 Summary ................................................................................................................... 33
CHAPTER V ...................................................................................................................... 34
CONCLUSION ................................................................................................................... 34
5.1 Introduction ............................................................................................................... 34
![Page 9: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/9.jpg)
ix
5.2 Contribution .............................................................................................................. 35
5.3 Constraint .................................................................................................................. 35
5.4 Future Work .............................................................................................................. 36
5.5 Conclusion ................................................................................................................. 36
APPENDICES .................................................................................................................... 37
APPENDIX 1 .................................................................................................................. 37
APPENDIX 2 .................................................................................................................. 38
APPENDIX 3 .................................................................................................................. 39
REFERENCES ................................................................................................................... 44
![Page 10: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/10.jpg)
x
LIST OF FIGURES
FIGURE TITLE PAGE
1 Agile Development Model Methodology 16
2 Circuit diagram of DHT11 temperature and humidity sensor 21
3 Circuit diagram of PIR sensor 21
4 Framework of the system 22
5 Flowchart of the Smart Home System 22
6 Flow chart for smart switch node sends status to Android app 23
7 Flow chart for Android app sends status to smart switch node 23
8 Complete circuit of system 27
9 To install the RPi.GPIO package 28
10 Code for PIR sensor 29
11 Result show movement not detected when the PIR sensor 29
is stay still
12 Result show movement detected if the PIR sensor is moving 30
13 Coding for DHT11 Temperature and Humidity sensor 30
14 Coding for DHT11 Temperature and Humidity sensor 31
15 Coding for DHT11 Temperature and Humidity sensor 31
![Page 11: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/11.jpg)
xi
16 Coding for DHT11 Temperature and Humidity sensor 32
17 Blynk Smart Home user interfaces for air conditioning 32
![Page 12: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/12.jpg)
1
CHAPTER I
INTRODUCTION
1.1 Background
The use of electricity is very important as one of the main source of energy that is
crucial in this modern life. Some kinds of mechanism using available technology could be
used to reduce wastage in electricity usage. Hence a prototype based on a microcontroller
device using mobile application is developed. It can automatically control any electrical
equipment at home remotely using mobile phone. So the electrical energy saving in daily
life can be made more efficient and effective.
Mobile application technology has been widely accepted as a part of medium of
communication. The purpose of using mobile application is to provide widest coverage at
minimal cost. Then the use of mobile application would facilitate in controlling the
electrical device at home from long distance and low in maintenance and independent
from any physical geographical boundary. At the present time, people use electrical
energy as one of the main source of power of energy to operate any electrical device or
![Page 13: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/13.jpg)
2
appliance. Most of the people turn on the light and air conditioner for 24 hours per day
even when they are away from home. Leaving the light and air conditioner turned on
continuously, lead to energy waste.
Thus this project which is Fuzzy Control System for Smart Home Application is
proposed to develop a system to facilitate the home owner to optimize usage of electricity
remotely using mobile application.
1.2 Problem Statement
There are several problems that have been identify in this project. This problem
statement will be the core statements in improving the existing system which are:
i. People with disabilities face the problem
Disable people might find it a problem as they need to move around to
switch on or off their home appliances such as air conditioner and lighting.
ii. Waste time
If the appliances is on in the users house while they are on their way to
work or maybe they already at the office, it might take some time to come
back home just to switch it off. It is frustrated and nuisance if their
workplace is far from home.
![Page 14: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/14.jpg)
3
iii. Electricity wastage
People is too busy with their daily life, working from morning and back at
home at night. Sometimes they forgot to check whether the appliances in
their home is switch off or not as they leave the home.
1.3 Objective
i. To propose the design of the Fuzzy Control System for Smart Home
Application anywhere at any time.
ii. To implement the design of the model into Smart Home System.
iii. To test and evaluate whether the Smart Home System developed is fully
functioned.
1.4 Scope
This project focuses on two scope:
1. Scope of client which is to all people that has house.
2. Scope of technology which is this technology will use Raspberry pi kit.
![Page 15: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/15.jpg)
4
1.5 Limitation
This project is only work in a wireless network connection to send the signal to the
microcontroller and sensor at home. Next, this project only use the battery for power supply.
1.6 Expected Result
At the end of this project, the expected outcome from this project will be :
i. Able to help users to control and monitor the appliances in order to control
appliances usage.
ii. The Fuzzy Control System for Smart Home Application is fully developed,
installed and functioned for user to use.
![Page 16: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/16.jpg)
5
CHAPTER II
LITERATURE REVIEW
2.1 Introduction
Literature review is a text of scholarly paper, which includes the current knowledge
including substantive findings, as well as a theoretical and methodological contribution to a
related works. There are a few devices related to Electrical Control System for Smart Home
Application (Air Conditioner). However, most of the devices did meet the requirement that
needed by the users.
![Page 17: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/17.jpg)
6
2.2 Related Works
2.2.1 Smart Home Automation System
According to this article [1], Smart home automation system is a web based
application that allows user to monitor home appliances using mobile devices. This system
established for the entire home user after gaining access from administrator. This system
includes remote control and monitoring domestic appliances, security and energy
management. Once all the appliances in home are automated and connected it important to
consider issue of security authentication and access control.
The implementation and design of this project done by using three methods, motion
sensor technology, RF remote control and Wi-Fi Router hand held to control of the selective
home devices. The software consists of assembly language for programming microcontroller
and visual basic language that use to communicate between transmitter and receiver model.
The system is created for energy efficient housing that was optimized for low cost.
![Page 18: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/18.jpg)
7
2.2.2 Home Automation System using Android
In this article [2], target of this venture is to build up with Android application
controlled Bluetooth which is the input is taken in the Android. The framework executes
Bluetooth innovation to give remote access from the cell phone. Bluetooth operation is
accomplished by any PDA/Tablet and so forth with Android OS, upon a GUI (Graphical User
Interface) based touch Screen operation.
This article states that the switches status is synchronized in all the control framework
while each one of the UI demonstrates the constant existing switches status. Android
application goes about as the transmitter, which sends ON/OFF orders to the collector where
loads are associated. This invention has secure connection channels amongst application and
Raspberry pi. It has the utilization of secure conventions over Bluetooth with the goal that
different gadgets can't control the appliances. The framework expected to control electrical
machines and gadgets in-house with generally minimal effort outline, easy to use interface,
and simplicity of establishment.
![Page 19: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/19.jpg)
8
2.2.3 Android Based Automation System for the next Generation of Technology using
Wi-Fi
This article [3] is a project focused on a design of monitoring and controlling home
automation system from an android application based on Raspberry Pi. This system uses Wi-
Fi technology as a communication protocol to connect system components. This system focus
on two main component which is the first one is android application that can give orders to
units that one wishes to control by locally or remotely and the second one is Raspberry pi that
has an appropriate interface to sensors and appliances of a home automation system and
finally able to communicates with android application through wireless technology.
Android is used as the operating system in this project as it is the most suitable OS to
run the system. The Andoid code is installed as an executable on the phone, which then
communicate with the java server on the computer system. Java language is used as the
communication for the system to run and complete. The designed system not only monitors
the sensor data, like temperature, gas, light, motion sensors, but also actuates a process
according to the requirement, for example switching on the light when it gets dark. It also
stores the sensor parameters in the cloud (Gmail) in a timely manner.
This will help the user to analyze the condition of various parameters in the home anytime
anywhere.
![Page 20: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/20.jpg)
9
2.2.4 SHAS-IoT : Smart Home Automation System (SHAS) using Internet of Things
(IoT) to Improve Safety and Security
In this article [4], this project tell us how SHAS-IOT provides high degree of security
and safety also energy saving. This project includes a description of SHAS-IoT that enable of
monitoring sensors and remotely controlling actuators to flexibly construct security and
safety services. Basically, this project which contains SHAS-IoT refers to automation of
home appliances which can be viewed from security, automatic monitoring and controlling
view. The major element of this project are sensors network, Arduino and mobile application.
From a home security perspective, this project includes alarm system, smoke
detectors and all of the doors lighting, cameras and other sensors. This system is built by
combining many communication protocols such as ZigBee, GSM, WiFi into wireless
network through a standard home gateway. This home gateway actually works as a central
control unit that manages the overall communication.
There are two scenarios in building SHAS-IoT. The first scenario is smart home
remote system. For this scenario, the Bluetooth module is turned n and begin to send and
receive from the mobile. User need to sign up in the mobile application by personal data then
user can start sign in at that exact time. For example, if user choose room one, user can
control every device in the room by clicking turn in or off.
Then, the second scenario is full control automatic within the home. In this scenario,
all sensors work in case there are a person in the home. For example, if user enter the home
or any room, user can see the action happened by sensor for every part in the home.
![Page 21: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/21.jpg)
10
2.2.5 An Internet of Things Based Air Conditioning and Lighting Control System for
Smart Home
This article [5] proposed an IoT based system which provides the controls the controls
of air conditioning and lighting devices in a smart home. The system proposed provides both
heat comfort and energy savings to the households. This system includes switches and
sensors that communicate with a central axis which are sometimes called “gateways”. These
“gateways” are control systems with a user interface that interact with a tablet, mobile phone
or computer and the network connectivity of these systems is managed by IoT.
This system works when the residents leave their smart homes, the devices inside
their homes automatically turn off. The residents use mobile devices for this system instead
of a physical key. For this smart home application, the NodeMCU WiFi module with
embedded system architecture and the Arduino Pro Mini 328P microcontroller are used.
NodeMCU WiFi has a modular structure with built-in WiFi feature which its programmable
feature makes it possible to implement internet applications of objects at low costs. Arduino
Pro Mini acts as an RF receiver module DHT22 temperature humidity sensor is used to take
the temperature and humidity information of the medium.
![Page 22: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/22.jpg)
11
2.2.6 Smart Home Control by using Raspberry Pi & Arduino UNO
This paper [6] presents a flexible and an inexpensive home control and monitoring
system by utilizing network based on Raspberry Pi and using Arduino Microcontroller. The
interface between the Access Point and switches with IP connectivity for accessing devices
and appliances and controlling it remotely will be made by using Android based Smartphone
application or server computer. This switch node connected to electrical devices that can be
controlled using sensor and remotely controlled through an access point, the Smart Switch
system for Smart Home development consists of two major parts that are smart switch device
and the access point. The main hardware for this system contain: Raspberry Pi, Arduino
Microcontroller, nRF24L0+ Wireless Transceiver, Relay Modules, Gang Switches, Lamps,
Plugs, Sensors and Wire Set. Expected outcomes from this system: programming by using
Python that comes built-in with Raspbian, Wireless module adapter to make connections
between the Arduino Microcontroller and nRF24L0+ Wireless Transceiver.
This paper has system development for monitoring and determining the confidence of
fire in a building presented shows the Raspberry Pi’s power in home automation. Thus the
developed Raspberry Pi prototype Sensor Web node is based on RESTful services and
constructed in order to build the infrastructure that supports fast critical event signalling and
remote access through the Internet to sensor data (the detection of critical events is performed
by using fuzzy logic). Both shown client mean for data processing is just one possible way of
application. Use Raspberry Pi as a Sensor Web node with the presented approach makes its
applications endless.
![Page 23: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/23.jpg)
12
2.2.7 Advanced Home Automation System Using Raspberry pi and Arduino
This article [7] proposed a cost effective system to achieve such automation system
based on IoT concept. All the devices of this system are connected to Raspberry Pi. This
system also provides a facility to control all home appliances locally without the internet via
a local network. Raspberry Pi runs a web server to host a web -based control interface and a
SQL database to maintain the current status of appliances. The interface can be accessed
through the internet or locally without the internet. The automatic re-start mechanism makes
the system more efficient. Raspberry Pi is used as it is a powerful computer and supports the
latest web technologies and databases.
The proposed system controls home appliances remotely using Raspberry Pi. The
Raspberry Pi receives commands from the user through a web interface and executes a shell
command to generate a control signal for Arduino. Then, relay switches are controlled by the
Arduino according to the control signal. The system requires the following components; A
hotspot ( wireless internet connectivity or pocket router) to provide internet connection to the
Raspberry Pi; A Raspberry Pi which acts as a web server, SQL server and also a control unit;
Dataplicity to remotely access Raspberry Pi from anywhere in the world via internet without
DynDNS, VPN, static IP or Port forwarding("Dataplicity: Remotely Control your Raspberry
Pi "); Web-based graphical user interface (GUI) to control the system("Web Interface,");
Arduino to control relay switch according to the control signal sent by the Pi.
For the restart mechanism All of the appliances are connected with the Arduino. So, if
Arduino is reset, all appliances will be turned off automatically. When the power goes off, the
Pi will be off. That means the server will go offline. The appliances will not get into their
previous state after restarting the server. To prevent this problem a python script is used.
When the server will reboot this script will run automatically and restore the previous state.
![Page 24: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/24.jpg)
13
2.2.8 Smart GSM Based Home Automation System
The article [8] Smart GSM Based Home Automation System is focused on
functionality of the GSM protocol, which allows the user to control the target system away
from residential using the frequency bandwidths. It is the implementation of the home
automation technology using Global System for Mobile Communication (GSM) modem to
control home appliances such as light, conditional system, and security system via Short
Message Service (SMS) text messages. This system applied the concept of serial
communication and AT-commands towards development of the smart GSM-based home
automation system.
The system works when the home owners will be able to receive feedback status of
any home appliances under control whether switched on or off remotely from their mobile
phones. PIC16F887 microcontroller with the integration of GSM provides the smart
automated house system with the desired baud rate of 9600 bps. In this proposed system
design, incoming SMS message is sent from the user phone to the GSM modem as a text
message via cellular network. The GSM modem then sends the commands in text mode to the
PIC microcontroller using an RS232 interface. The RS232 voltage levels are at ±12V
whereas both the microcontroller input and output operates at 0V to +5V. Since RS232 is not
compatible with microcontroller, MAX232 is utilized to enable the communication between
both the GSM modem and PIC microcontroller by converting RS232 level signals to TTL
level signal. Outgoing message from the system containing the home appliances status is
delivered to the mobile phone through GSM modem.
Among the cellular technologies, GSM network is preferred for the communication
between the home appliances and the user due to its wide spread coverage [8,9] which makes
the whole system online for almost all the time.
![Page 25: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/25.jpg)
14
2.2.9 Social Networks of Things for Smart Homes Using Fuzzy Logic
This article [9] presents an approach for Smart Homes using Fuzzy Logic. The
proposed study provides solutions for development of smart homes and proposed a model for
inter Smart home communication. This approach not only gets real time data from internal
sensors rather it also includes input from local weather station for Fuzzification and
Defuzzification process to produce results in real time. The aim of proposed system is to
provide dynamic information and communication between nearby as well as remote smart
homes.
The proposed model provide an economical solution for inter-smart home
communication because in the proposed Smart Home network system it is not necessary to
deploy or install sensors for input in every node (home) rather it only needs one home form a
cluster to be equipped with sensors or smart objects in order to share the sensory information
to its own as well as other clusters within smart home network using fuzzy cloud services.
This system receives sensory inputs within Fuzzy cloud and on the basis of
knowledge base including Scaling Function, Fuzzy Rules and Membership functions fuzzy
rule base system process it to produce output after fuzzification and defuzzification using
inference engine. Any Logic based on multiple values regarding truth values or any real
number between “0” and “1” of a variable is called fuzzy logic that is used to perform the
concept of partial truth in which truth vale may be between completely true and false.
![Page 26: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/26.jpg)
15
CHAPTER III
METHODOLOGY
3.1 Introduction
Methodology is the outline of the way a process or task will be carried out. Thus, the
development of this device is carried out by applying the methodology of Electrical Control
System for Smart Home Application (Air Conditioner) development. The development of this
project is carried out by applying the methodology of Agile Development. Figure below
shows the iterative and incremental model that is chosen to develop the project. This model is
chosen because the project can be developed through repeated cycle which is iterative. The
project can be proceeds if there are any changes in the middle of the project.
![Page 27: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/27.jpg)
16
3.2 Methodology Phases
This model consists of six phases which are planning, requirement, analysis and design,
implementation, testing and deployment.
Figure 1 : Agile Development Model Methodology
![Page 28: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/28.jpg)
17
3.2.1 Planning
The first step of the Agile Development is planning where in this step included the
development of Raspberry pi and implemented coding from the Raspberry pi. By referring
from previous project, Raspberry pi is an important part in this project because Raspberry pi
is the main part of this project and will be attached with others part and sensor. This step also
include the development of selection the right sensor that 40 kHz ultrasonic sensor
(HCSR04). This step is important to develop the Raspberry pi board to combined with the
ultrasonic sensor to give signal to the sensor at home whether to switch on or off the air
conditioner.
3.2.2 Data Model (Requirement)
3.2.2.1 Software
3.2.2.1.1 Raspberry Pi OS
Raspberry Pi OS (formerly Raspbian) is a Debian based
operating system for Raspberry Pi. Raspberry Pi OS is a free
operating system that runs on the Raspberry Pi single-board
computer. Raspberry Pi OS is a software that are used to write
and run code to the Raspberry Pi. It is easy to use and flexible.
![Page 29: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/29.jpg)
18
3.2.2.1.2 Google Firebase
Google Firebase is a Google-backed application development
software that enables developers to develop iOS, Android and
Web apps. Firebase provides tools for tracking analytics,
reporting and fixing app crashes, creating marketing and
product experiment.
3.2.2.1.3 Python
Python is an interpreted, object-oriented, high-level
programming language with dynamic semantics. Python's
simple, easy to learn syntax emphasizes readability and therefore
reduces the cost of program maintenance.
3.2.2.1.4 Blynk
Blynk is an IOT platform developed for iOS and Android
applications that allows controllers such as Arduino, Raspberry
Pi, ESP32, NodeMCU to be controlled over the internet.
![Page 30: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/30.jpg)
19
3.2.2.2 Hardware
3.2.2.2.1 Raspberry Pi
A Raspberry Pi is a credit-card sized computer originally
designed for education, inspired by the 1981 BBC Micro. The
Raspberry Pi is open hardware, with the exception of the
primary chip on the Raspberry Pi, the BroadcommSoC (System
on a Chip), which runs many of the main components of the
board–CPU, graphics, memory, the USB controller, etc.
3.2.2.2.2 PIR motion sensor
This PIR sensors signals produce are only high (motion
detected) and low (no motion detected). With this signal feed
into the controller, the controller will able to notice the present
of the human and thus takes appropriate action on the lights.
3.2.2.2.3 DHT11 Temperature and Humidity Sensor
Provides digital temperature and humidity readings. Really
easy to set up, and only requires one wire for the data signal.
![Page 31: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/31.jpg)
20
3.2.2.2.4 Relay Module
A relay is an electrically-operated switch. These switches can
be extremely useful for a variety of Raspberry Pi projects (think
turning on a light).
3.2.2.2.5 Mini Breadboard
The modern breadboard is a plug-and-play way to make
connections between electronic components. It is easy to setup.
To connect all the input and output of the circuit.
3.2.2.2.6 ESP8266 WiFi
A self contained SOC with integrated TCP/IP protocol stack
that can give any microcontroller access to your WiFi network.
The ESP8266 is capable of either hosting an application or
offloading all Wi-Fi networking functions from another
application processor.
3.2.2.2.7 Light Dependent Resistor (LDR)
An LDR is a component that has a (variable) resistance that
changes with the light intensity that falls upon it. This allows
them to be used in light sensing circuits.
![Page 32: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/32.jpg)
21
3.2.3 Design
This step is required so that the flow of project will be successful. In this step, a design of a
circuit as shown as in figure below.
Figure 2 : Circuit diagram of DHT11 temperature and humidity sensor
Figure 3 : Circuit diagram of PIR sensor
![Page 33: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/33.jpg)
22
Figure 4 : Framework of the system
Figure 5 : Flowchart of the Smart Home System
![Page 34: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/34.jpg)
23
Figure 6 : Flow chart for smart switch node sends status to Android app
Figure 7 : Flow chart for Android app sends status to smart switch node
![Page 35: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/35.jpg)
24
The flowchart of the Smart Home System shows that when the power is ON, all of the
component will start working, the Raspberry pi will connect to the wireless network. When
the network establish, the PIR sensor, LDR sensor and DHT11 Temperature and Humidity
sensor will generate pulse. Smart switch node will send status to base station. Raspberry Pi at
the access point will receives status and send status to hosting server. Hosting server receives
status and store at database. The server reads status at database, then show and update the
result in ON/OFF button. The information will be send to user’s smartphone in term of
notification.
3.2.4 Implementation
After the design phase has been develop, the configuration and the coding of the
Raspberry is implement. The circuit is installed and connected. The coding for the pulse of
waves include the 1-minute looping time for generate the pulse. If else rule is used in the
coding to determine whether there has obstacle or not.
3.2.5 Testing
In this step the complete circuit will be test. If there is still error occurred, it will be
solve in this step. If there is any change need to implement, the project must start back at
design step for revision flow.
![Page 36: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/36.jpg)
25
3.2.6 Deployment
After the circuit has been completely installed without error, the complete circuit will
be attached.
3.3 Summary
In this chapter, the methodology of the project is explained. The flow of this project
followed the steps that need to develop the Smart Home System. The requirement of the
hardware and software is listed properly for the development of the Smart Home System.
![Page 37: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/37.jpg)
26
CHAPTER IV
IMPLEMENTATION
4.1 Introduction
The core of Fuzzy Control System for Smart Home Application is Raspberry Pi
programming board and Blynk iOS and Android Interface Developer to show how mobile
apps can be used for controlling the smart home. Blynk is an IOT platform developed for iOS
and Android applications that allows controllers such as Arduino, Raspberry Pi, ESP32,
NodeMCU to be controlled over the internet. In this chapter, the system will be tested and
implemented. Testing and implementation is about to construct the system as specific design
that has been developed in previous phase, methodically verified to ensure that they are error-
free and fully meets user requirements. This phase should be done before a system is fully
utilized. This chapter will cover the correct mechanism on testing the system based on the
correct implementation.
![Page 38: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/38.jpg)
27
4.2 Project Implementation
System implementation is the process of defining how the information system should
be built like the physical system design and as well as ensuring that the information system is
operational and used. At the same time the system developed must meets the quality standard
to sync with the quality assurance.
Figure 8: Complete circuit of system
The complete circuit of the Fuzzy Control System for Smart Home Application is
fully developed. Before attaching the circuit in the home, the circuit must be tested first to see
if it is working. The assembler of the circuit must be handled carefully as many wire is
connected to each other. The test is running for multiple time to make sure that the system is
![Page 39: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/39.jpg)
28
fully function. After finalized all the function and fix the problem, the circuit is ready to be
attached.
After that, all the sensor and wire were placed in their position. Then , the testing is
made to make sure all the sensors and board fully function. The circuit board will be placed
in a suitable place in the home to see if it can be operated without any problem occur after
that.
4.3 Expected Result
Figure 9 : To install the RPi.GPIO package
![Page 40: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/40.jpg)
29
Figure 10 : Code for PIR sensor
Figure 11 : Result show movement not detected when the PIR sensor is stay still
![Page 41: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/41.jpg)
30
Figure 12 : Result show movement detected if the PIR sensor is moving
Figure 13 : Coding for DHT11 Temperature and Humidity sensor
![Page 42: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/42.jpg)
31
Figure 14 : Coding for DHT11 Temperature and Humidity sensor
Figure 15 : Coding for DHT11 Temperature and Humidity sensor
![Page 43: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/43.jpg)
32
Figure 16 : Coding for DHT11 Temperature and Humidity sensor
Figure 17 : Blynk Smart Home user interfaces for air conditioning
![Page 44: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/44.jpg)
33
For the application shown in Figure 17, the measured temperature and humidity
values are compared with the set values by means of the code written to the controller to
control the air conditioning devices. The communication between the Raspberry Pi and the
devices is provided wirelessly by the RF modules. Relay module contacts connected to the
digital outputs of the Raspberry Pi enable both the on/off control of the air conditioner and
the adjustment of the parameters.
4.4 Summary
As a conclusion, this chapter covers the implementation of code into the system,
interface design and testing of the system. The complete implementation of the Fuzzy Control
System for Smart Home Application can be used for all kind of house. This system will be
automatically turn on when user downloaded the application for this smart home. The system
achieve the objective of the system.
![Page 45: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/45.jpg)
34
CHAPTER V
CONCLUSION
5.1 Introduction
In this chapter, I will discuss the contribution, constraint, conclusion, and future
works of the project. The conclusion of the system discussed about the final product of the
system for the user that using the system. Project constraint will discussed the state of all
difficulty that have been faced throughout the development of the project. The future work
will discuss about the suggestion for the project and whether it is functioned or not.
![Page 46: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/46.jpg)
35
5.2 Contribution
Fuzzy Control System for Smart Home Application is able to help in making
automated system for home facilities. At the very same time, the management of the
appliances and the summary of home consumption will be decreased as user can control it.
This will help very much as the focus is providing a system that can manage the energy usage
efficiently. Since the appliances can be manage by the end users, the system is highly
scalability. After having the platform, the android base platform will be built to meet the need
for user friendly interface.
5.3 Constraint
While completing this project, there are several constraints that come up throughout
the implementation of the project. The first one will be the wired connection between all the
sensors, Raspberry Pi and NodeMCU that have to face and overcome in this project. This is
because the wired connection for this prototype are not tight and easily detached. It is quite
difficult to setup all the sensors to their position and need to make sure all the wire is nicely
managed so that it is not easily detached. This is because if the wire is placed incorrectly, it
will affect the whole system and will make the sensor not working properly.
The second one will be the internet connectivity which is one of the biggest problems
that need to cope with. This is because the main function of this system is to send notification
to user’s smartphone. So the system must always connect to internet to send the data and
![Page 47: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/47.jpg)
36
notification to smartphone. The poor connection of WiFi forced us to use our own wireless
network and it must always active to do the project.
5.4 Future Work
Here are some suggestion for the system to work more efficient in future. The
suggestions are:
Improve the apps by using voice command to control the appliances.
Use bigger memory for Raspberry Pi to afford all the sensors coding.
Big data analytics on the collected data using appropriate tools and techniques.
5.5 Conclusion
As a conclusion, this system is expected to be able to control the list of appliances
according to the system. It will help users to control the appliances in order to control
appliances usage. Having too much electric appliances inside the home may cause increasing
the rate of usage and expenditure to the household. Automated home system can oversee
energy more efficiently for various appliances anytime and anywhere. Lastly, this project
bring benefit to people by ease their daily life in form of monitored and controlled home
appliances to them via smartphone.
![Page 48: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/48.jpg)
37
APPENDICES
APPENDIX 1
Task FYP1 W
1
W
2
W
3
W
4
W
5
W
6
W
7
W
8
W
9
W
10
W
11
W
12
W
13
W
14
Project Title
Proposal
Research
Proposal
Presentation
Development
of
Methodology
Report
Drafting of
Proposal
Final
Presentation
Report
Submission
Table 1: Gantt chart of FYP 1
![Page 49: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/49.jpg)
38
APPENDIX 2
Task FYP 2 W
1
W
2
W
3
W
4
W
5
W
6
W
7
W
8
W
9
W
10
W
11
W
12
W
13
W
14
Design Interface
Implementation
and
Development
Presentation 1
Documentation
Added value and
Testing
Final
Presentation
Report
Submission
Table 2: Gantt chart of FYP 2
![Page 50: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/50.jpg)
39
APPENDIX 3
Sketch of Raspberry Pi OS
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
PIR_OUT_PIN = 11 # pin11
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(PIR_OUT_PIN, GPIO.IN) # Set BtnPin's mode is input
def loop():
while True:
if GPIO.input(PIR_OUT_PIN) == GPIO.LOW:
print '...Movement not detected!'
else:
print 'Movement detected!...'
def destroy():
GPIO.cleanup() # Release resource
if __name__ == '__main__': # Program start from here
setup()
![Page 51: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/51.jpg)
40
try:
loop()
except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be
executed.
destroy()
DHT11 Temperature and Humidity Sensor
import RPi.GPIO as GPIO
import time
channel = 18
data = []
j = 0
GPIO.setmode(GPIO.BCM)
time.sleep(1)
GPIO.setup(channel, GPIO.OUT)
GPIO.output(channel, GPIO.LOW)
time.sleep(0.02)
GPIO.output(channel, GPIO.HIGH)
![Page 52: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/52.jpg)
41
GPIO.setup(channel, GPIO.IN)
while GPIO.input(channel) == GPIO.LOW:
continue
while GPIO.input(channel) == GPIO.HIGH:
continue
while j < 40:
k = 0
while GPIO.input(channel) == GPIO.LOW:
continue
while GPIO.input(channel) == GPIO.HIGH:
k += 1
if k > 100:
break
if k < 8:
data.append(0)
else:
data.append(1)
j += 1
print "sensor is working."
print data
![Page 53: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/53.jpg)
42
humidity_bit = data[0:8]
humidity_point_bit = data[8:16]
temperature_bit = data[16:24]
temperature_point_bit = data[24:32]
check_bit = data[32:40]
humidity = 0
humidity_point = 0
temperature = 0
temperature_point = 0
check = 0
for i in range(8):
humidity += humidity_bit[i] * 2 ** (7 - i)
humidity_point += humidity_point_bit[i] * 2 ** (7 - i)
temperature += temperature_bit[i] * 2 ** (7 - i)
temperature_point += temperature_point_bit[i] * 2 ** (7 - i)
check += check_bit[i] * 2 ** (7 - i)
tmp = humidity + humidity_point + temperature + temperature_point
if check == tmp:
print "temperature : ", temperature, ", humidity : " , humidity
![Page 54: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/54.jpg)
43
else:
print "wrong"
print "temperature : ", temperature, ", humidity : " , humidity, " check : ", check, " tmp : ",
tmp
GPIO.cleanup()
![Page 55: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/55.jpg)
44
REFERENCES
[1] A.S.Biradar, S.B.Dhage, V.V.Jamadar, H.S.Kasar, Prof.Javed Shaikh.“
Smart Home Automation System” International Journal of Advanced Research
in Computer Engineering & Technology (IJARCET) Volume 5, Issue 4, April
2016.
[2] Mahabub Rabbani “ Home Automation System Using Android”
Department of Computer Science and Engineering Daffodil International
University, 6 May 2018.
[3] Prachi Bhure, Naziya Pathan, Shyam Dubey “Android Based Automation
System for the next Generation of Technology using Wi-Fi” International
Journal of Science Technology & Engineering Volume 3, Issue 05, November
2016.
[4] Diaa Salama Abd-Elminaam, Ahmed A. Toony, “SHAS-IoT : Smart Home
Automation System (SHAS) using Internet of Things (IoT) to Improve Safety
and Security” Research Journal of Applied Sciences, May 2018.
[5] Mehmet Taştan, Hayrettin Gökozan “An Internet of Things Based Air
Conditioning and Lighting Control System for Smart Home” American
Scientific Research Journal for Engineering, Technology, and Sciences,
December 2018.
[6] Hamid Hussain Hadwan, Y. P. Reddy “ Smart Home Control by using
Raspberry Pi & Arduino UNO” International Journal of Advanced Research in
Computer and Communication Engineering Vol. 5, Issue 4, April 2016.
[7] Chinmay Bepery, Sudipto Baral, Animesh Khashkel & Farhad Hossain,
“Advanced Home Automation System Using Raspberry-Pi And Arduino”
![Page 56: FUZZY CONTROL SYSTEM FOR SMART HOME APPLICATION NIK … · 2020. 7. 16. · microcontroller unit then automatically controls the electrical home appliances by switching ... Tujuan](https://reader033.vdocument.in/reader033/viewer/2022053111/6082c663cf828543bc34c561/html5/thumbnails/56.jpg)
45
International Journal of Computer Science and Engineering (IJCSE) Vol. 8,
Issue 2, Feb - Mar 2019.
[8] Rozita Teymourzadeh, CEng, Member IEEE/IET, Salah Addin Ahmed,
Kok Wai Chan, and Mok Vee Hoong “Smart GSM Based Home Automation
System” UCSI University Kuala Lumpur, Malaysia, December 2013.
[9] Muhammad AsadUllah, Sagheer Abbas, Naila Samar Naz, Syed Saqib
Raza Rizvi, Tariq Zia, Kinza Sardar, “ Social Networksof Things for Smart
Homes Using Fuzzy Logic” International Journal of Computer Science and
Network Security, VOL.18 No.2, February 2018.