60
HOSTELS ROOM MONITORING SYSTEM USING IOT NUR HUMAIRA BINTI MOHAMAD AZHAR BACHELOR OF COMPUTER SCIENCE (INTERNET COMPUTING) WITH HONOURS UNIVERSITI SULTAN ZAINAL ABIDIN AUGUST 2018

HOSTEL S ROOM MONITORING SYSTEM USING IOT

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: HOSTEL S ROOM MONITORING SYSTEM USING IOT

HOSTEL’S ROOM MONITORING SYSTEM

USING IOT

NUR HUMAIRA BINTI MOHAMAD AZHAR

BACHELOR OF COMPUTER SCIENCE

(INTERNET COMPUTING) WITH HONOURS

UNIVERSITI SULTAN ZAINAL ABIDIN

AUGUST 2018

Page 2: HOSTEL S ROOM MONITORING SYSTEM USING IOT

i

DECLARATION

The dissertation is submitted as a partial fulfillment for the award of a Bachelor of Computer

Science (Internet Computing) at the University of Sultan Zainal Abidin (UniSZA). This work is

the result of my own investigation. All sections of text and results which have been obtained from

other web/sources are full referenced. I understand that cheating and plagiarism constitute a breach

of University regulations and will be dealt with accordingly.

Signature: …………………………..

Name: Nur Humaira binti Mohamad Azhar

Date: ………………………………..

Page 3: HOSTEL S ROOM MONITORING SYSTEM USING IOT

ii

ACKNOWLEDGEMENT

Firstly, I would like to take this opportunity to express my deepest thanks to my supervisor,

Prof.Madya Dr Engku Fadzli Hasan bin Syed Abdullah for his kindness, patience and motivation

towards this project.

Not forgetting Faculty of Information and Computing (FIK), thank you for giving me

chances to discover and reveal new things by myself for this project. Besides, I would like to thank

to my family and all other lectures in Faculty of Informatics and Computing (FIK) for support,

helping and give me motivation in order to complete this project. Last but not least, thanks to my

supportive friends who always help, encourage and teach me with unlimited knowledge.

Page 4: HOSTEL S ROOM MONITORING SYSTEM USING IOT

iii

APPROVAL

This project report entitled Room Monitoring System Using IOT by Nur Humaira binti

Mohamad Azhar, matric number BTCL15041183 has been satisfactory in terms of scope, quality

and presentation as a partial fulfillment of the requirement for Bachelor of Computer Science

(Internet Computing) in University of Sultan Zainal Abidin (UniSZA).

Signature: …………………………………

Supervisor: Prof.Madya Dr Engku Fadzli Hasan

Bin Syed Abdullah

Date: ……………………………………….

Page 5: HOSTEL S ROOM MONITORING SYSTEM USING IOT

iv

ABSTRACT

The project proposes an efficient implementation for IOT (Internet of Things) used for monitoring

movements and activities in the hostel’s room. This project can be a great help with the

advancement of wireless technologies such as Wi-Fi, and cloud network. The proposed project

consists of server controller and sensors. We also describe the main problems of the hostel’s room

which are security and energy saving. Sensors collect data about abnormal room situations or

activities and send this data to the central system or cloud. Sensors are installed at different room

locations in the building with a different device identification (ID). This project presents the

development and implementation of a room monitoring system that can be used to monitor

important activities in room. The prototype system shown in this project has been tested in a room

and improvement made. The system, with further improvements can be used to monitor indoor

environment conditions automatically and has great potential for safety in room.

Page 6: HOSTEL S ROOM MONITORING SYSTEM USING IOT

v

ABSTRAK

Projek ini mencadangkan pelaksanaan yang cekap untuk IOT (Internet of Things) yang digunakan

untuk memantau pergerakan dan kegiatan di bilik asrama. Projek ini dapat menaik taraf kemajuan

teknologi tanpa wayar seperti Wi-Fi, dan rangkaian awan. Projek yang dicadangkan ini terdiri

daripada kawalan sensor pelayan. Kami juga menerangkan masalah utama bilik asrama yang

merupakan keselamatan dan penjimatan tenaga. Sensor mengumpul data mengenai situasi atau

aktiviti bilik yang tidak normal dan menghantar data ini ke sistem pusat atau rangkaian awan.

Sensor dipasang di lokasi bilik yang berbeza di dalam bangunan dengan pengenalan peranti yang

berbeza (ID). Projek ini menghasilkan pembangunan dan pelaksanaan sistem pemantauan bilik

yang boleh digunakan untuk memantau aktiviti penting di dalam bilik. Sistem prototaip yang

ditunjukkan dalam projek ini telah diuji dalam bilik dan penambahbaikkan telah dibuat. Dengan

penambahbaikan yang telah dibuat ianya boleh digunakan untuk memantau keadaan persekitaran

tertutup secara automatik dan mempunyai potensi besar untuk keselamatan di dalam bilik.

Page 7: HOSTEL S ROOM MONITORING SYSTEM USING IOT

vi

TABLE OF CONTENTS

DECLARATION ………………………………………………………………. i

ACKNOWLEDGEMENT …………………………………………………….. ii

APPROVAL ……………………………………………………………………. iii

ABSTRACT ……………………………………………………………………. iv

CHAPTER 1 …………………………………………………………………….. 1

INTRODUCTION ………………………………………………………………. 1

1.1 Overview ……………………………………………………………. 1

1.2 Problem Statement ………………………………………………….. 2

1.3 Objectives Project …………………………………………………... 3

1.4 Project Scope ……………………………………………………….. 3

1.5 Limitations of Work ………………………………………………... 4

1.6 Expected Results …………………………………………………… 4

CHAPTER 2 …………………………………………………………………….. 5

LITERATURE REVIEW ……………………………………………………… 5

2.1 Introduction ………………………………………………………… 5

2.2 Related works ………………………………………………………. 5

2.2.1 Example of Research Paper …………………………………. 6

2.3 Chapter Summary …………………………………………………... 7

CHAPTER 3 …………………………………………………………………….. 8

Page 8: HOSTEL S ROOM MONITORING SYSTEM USING IOT

vii

METHODOLOGY ……………………………………………………………... 8

3.1 Introduction ………………………………………………………… 8

3.2 System Development Life Cycle (SDLC) ………………………….. 8

3.3 Justification for Methodology ………………………………………. 9

3.4 System / Software Development Methodology …………………… 10

3.4.1 Determine the objective phase ……………………………… 10

3.4.2 Requirement analysis phase ………………………………… 10

3.4.3 Design phase ………………………………………………... 10

3.5 System Design ……………………………………………………... 11

3.5.1 Context Diagram (CD) ……………………………………... 11

3.5.2 Data Flow Diagram (DFD) ………………………………..... 12

3.5.3 Entity Relationship Diagram (ERD) ……………………….. 14

3.6 Implementation phase ……………………………………………... 15

3.7 Software and Hardware Requirement …………………………….. 15

3.7.1 Software Requirements …………………………………….. 15

3.7.2 Hardware Requirements ……………………………………. 16

3.8 Chapter summary ………………………………………………….. 16

CHAPTER 4 …………………………………………………………………… 17

SYSTEM DESIGN AND MODELING ……………………………………… 17

4.1 Introduction ……………………………………………………….. 17

Page 9: HOSTEL S ROOM MONITORING SYSTEM USING IOT

viii

4.2 System Framework ………………………………………………... 18

4.3 Proof of Concept ………………………………………………….. 19

4.3.1 Arduino Uno setup sketch …………………………………. 19

4.3.2 NodeMCU setup sketch ……………………………………. 20

4.4 Thinger Database Design …………………………………………. 21

CHAPTER 5 …………………………………………………………………… 25

IMPLEMENTATION AND TESTING ……………………………………… 25

5.1 Introduction ……………………………………………………….. 25

5.2 Hardware ………………………………………………………….. 25

5.2.1 Overview …………………………………………………… 26

5.2.2 Arduino Software …………………………………………... 28

5.2.3 PIR and Temperature sensor ……………………………….. 29

5.3 Programming ……………………………………………………… 30

5.4 Result ……………………………………………………………… 37

5.5 Chapter summary …………………………………………………. 40

CHAPTER 6 …………………………………………………………………… 41

CONCLUSION AND FUTURE WORK …………………………………….. 41

6.1 Introduction ……………………………………………………….. 41

6.2 Project Constrains …………………………………………………. 41

6.3 Conclusion ………………………………………………………… 42

Page 10: HOSTEL S ROOM MONITORING SYSTEM USING IOT

ix

6.4 Future Work ……………………………………………………….. 43

6.5 Chapter summary ………………………………………………….. 43

REFERENCES ……………………………………………………………….... 44

APPENDIX ……………………………………………………………………... 46

Page 11: HOSTEL S ROOM MONITORING SYSTEM USING IOT

x

LIST OF TABLES

TABLE TITLE PAGE

Table 1 Example Research Paper …………………………………….. 6

Table 2 Software Requirements ……………………………………... 15

Table 3 Hardware Requirements …………………………………...... 16

Page 12: HOSTEL S ROOM MONITORING SYSTEM USING IOT

xi

LIST OF ABBREVIATIONS

CD Context Diagram

DFD Data Flow Diagram

ERD Entity Relationship Diagram

IOT Internet of Things

SDLC System Development Life Cycle

PIR Passive Infrared sensor

Page 13: HOSTEL S ROOM MONITORING SYSTEM USING IOT

1

Chapter 1

INTRODUCTION

1.1 Overview

Nowadays, Internet is very important in our daily life. Internet had made our life

become easier such as to communicate with people and it’s also important to keep people

close to each other. Besides, Internet is a medium for people to find any resources,

information and also we can store data which called cloud storage. Now we are in the

Internet of Things (IOT) era which our daily work depends on the Internet.

This project proposes an efficient implementation for IOT (Internet of Things) used

for monitoring movements and activities in the hostel’s room. This project can be a great

help with the advancement of wireless technologies such as Wi-Fi, and cloud network. The

proposed project consists of server controller and sensors. We also describe the main

problems of the smart home which are safety, security and energy saving. Sensors collect

data about abnormal room situations or events and send this data to the central system or

cloud. Sensors are installed at different room locations in the building.

Page 14: HOSTEL S ROOM MONITORING SYSTEM USING IOT

2

Two sensors are used in the proposed system; PIR and temperature sensor. The PIR

sensor (Passive Infrared sensor) allows you to sense motion in room and they are basically

made of a passive or pyro electric sensor (round metal), which can detect levels of infrared

radiation. The PIR detect the movement when the motions was in their area then the data

collected frequently. Temperature sensor can measure the amount of heat energy or even

coldness that is generated by an object or system, allowing us to “sense” or detect any

physical change to that temperature producing either an analogue or digital output.

Temperature sensors are used on circuit boards, as part of thermal tests in room controls.

1.2 Problem Statement

A problem statement is a concise description of the issues that need to be addressed and

his including:

i. Students not be able to see or know if any movements occurred in their

rooms when they are not there.

ii. Safety at the hostel are not really secured as there are no monitoring device

in the room to detect any suspicious movements like wild animals, thieves

and so on.

iii. Students need to take precautions on their own in order to ensure their

properties are in safe conditions

iv. High usage of electricity as the students often left their room with opened

light source.

Page 15: HOSTEL S ROOM MONITORING SYSTEM USING IOT

3

1.3 Objectives Project

This project consist of three (3) objectives:

i. To analyze current problem in hostel room monitoring system.

ii. To design proposed hostel room monitoring system.

iii. To develop the hostel room monitoring system.

1.4 Project Scope

The scope of functionalities are divided into 2 main users:

i. ADMIN

Admin can monitor the system controller.

Admin can manage the data collected.

ii. STUDENTS

Students can view the data of the system.

iii. STAFF

Staff can view the data of the system.

Page 16: HOSTEL S ROOM MONITORING SYSTEM USING IOT

4

1.5 Limitations of Work

The limitations of work are:

i. Fluctuation of data happens frequently.

ii. Sensors need to be installed in each room to differentiate which rooms has a

problem.

iii. Open sources platform unable to send notification to the user’s mobile phone.

1.6 Expected Results

Main target in develop the system are:

i. Admin can view the data collected by the monitor system.

ii. System would be able to collect motion and temperature data frequently

based on the time requirement.

iii. Students will feel safe whenever they leaving their room for a long time

period.

Page 17: HOSTEL S ROOM MONITORING SYSTEM USING IOT

5

Chapter 2

LITERATURE REVIEW

2.1 Introduction

In this chapter, will reviewed some previous researches were carried out. The main

objective of this project is to develop room monitoring system. These related works have been

reviewed to improve the quality and reliability of this project.

2.2 Related works

In this project, we will used PIR sensor to detect and monitor the movement which is

plugged-in to the Arduino board. Another sensor were used are temperature sensor to detect the

temperature in room environment.

Albert Gifson et. Al. (2009) has conducted on “Room Detection System using a Passive

Infrared Sensor (PIR) controlled by Microcontroller AT89S52”. In this paper, they used PIR

sensor as a low logic when it captures the heat waves of the human body. They used PIR sensor

with microcontroller that used to send a signal to the personal mobile phone but before they sent

the message, the message must be programmed and stored in the microcontroller.

Page 18: HOSTEL S ROOM MONITORING SYSTEM USING IOT

6

Sun-Kuk Noh et. Al. (2013) has conducted on “Design of a Room Monitoring System for

Wireless Sensor Network”. In this paper, they focused on designing a simple wireless sensor

network (WSN) module. They used ZigBee for personal area network (PAN) sensor monitoring

and control. A WSN was developed to circuit schematic using PowerPCB tools PADS and made

it a printed circuit board (PCB).

Petros Spachos, Jieyu Lin, Hadi Bannazadeh, Alberto Leon-Garcia has conducted on

“Smart Room Monitoring through Wireless Sensor Networks’. In this paper, they demonstrate

the design of our monitoring system called MonArch that tackles the challenge in a smart room

infrastructure. A real time wireless ad-hoc sensor network system for carbon dioxide monitoring

at a complex indoor environment is supported. The system aims to detect and monitor the level

of carbon dioxide on a real-time basis and provide overall air quality alerts timely.

Table 1: Example Research Paper

No Author Title Year Objective Advantage

1. Albert Gifson,

Slamet.

Long Distance

Observation System

using PIR sensor.

2009 1. To detect the

maximum distances

between an object in

room control

application.

2. To use the light

intensity in room

automatically.

1. Contribute a

system to become

more secured.

2. Saved the energy

consumption.

Page 19: HOSTEL S ROOM MONITORING SYSTEM USING IOT

7

2. Sun-Kuk Noh,

Kuk-Se Kim,

Yoo-Kang Ji.

Room Monitoring

System for Wireless

Sensor Networks.

2013 1. To increasing

living standards and

expectations for

comfort.

2. To supply a

comfortable

environment for

people.

1. To build wireless

monitoring system

using ZigBee with

the number of

wireless sensor

network available.

3. Petros

Spachos,

Jieyu Lin,

Hadi

Bannazadeh,

Alberto Leon-

Garcia.

Smart Room

Monitoring through

Wireless Sensor

Networks

2017 1. To manage

heterogeneous

virtualized resources

in cloud

infrastructures.

2. To detect and

monitor the level of

carbon dioxide on a

real-time basis.

1. Provides overall

air quality alerts

timely.

2.3 Chapter Summary

This chapter discussed about the technique ad model used in the proposed system. The

technique and model are chosen based on the previous research articles and journal. There are

also the advantages and disadvantages for each model.

Page 20: HOSTEL S ROOM MONITORING SYSTEM USING IOT

8

Chapter 3

METHODOLOGY

3.1 Introduction

This chapter discusses the methods and alternatives that have been used from the

beginning until the end of this project. Project flow and system overview is discussed briefly to

give more understanding of the design and development concept of this project. Details for every

phases that are involved in this project development are explained.

3.2 System Development Life Cycle (SDLC)

System Development Life Cycle (SDLC) is a model used in project management that

contains five basic stages which are requirement analysis, design, implementation, testing and

evolution. SDLC involved in an information system development project from the beginning of

project.

Page 21: HOSTEL S ROOM MONITORING SYSTEM USING IOT

9

Figure 3.1: System Development Life Cycle (SDLC) [7]

3.3 Justification for Methodology

In this project, the agile methodology software development is a method of software

development that is method anticipates change and allows for much more flexibility than

traditional methods. Admin can make small objective changes without huge changes to the

budget or schedule. Giving high priority to user participation, from the very beginning of the

development cycle. If there are defects or challenges, then changes can be made during

production cycles to fix the issue.

Page 22: HOSTEL S ROOM MONITORING SYSTEM USING IOT

10

3.4 System / Software Development Methodology

Project’s methodology must be organized in scientific investigation to solve problems to

ensure the objectives of this project can be achieved. The step of develop is important because it

will guide the research through the project development.

3.4.1 Determine the objectives phase

This project will be successful if the objectives of this project is clear and know

the problems which lead us to come out with this project. We have interviewed the students in

hostel regarding to this matter. We had collected the data from students in the hostel’s room. The

requirement for this project was studied..

3.4.2 Requirement analysis phase

PIR and temperature monitoring system devices should be installed in all

controlled room in the hostel. The sensors should be function able or collect the data better.

Sensors should be located in specific room areas and they should be positioned so as to be

minimally affected.

3.4.3 Design phase

The development of context diagram (CD) and data flow diagram (DFD) in this

project show the flow how the system. Both sensor send the data information to the system and

the admin and users are able to view the data collected.

Page 23: HOSTEL S ROOM MONITORING SYSTEM USING IOT

11

3.5 System Design

System design is a process of defining the architecture, components (PIR and temperature

sensor) and data for a Thinger.io system. System design in designing phase involves Context

Diagram (CD), Data Flow Diagram (DFD), and Entity Relationship Diagram (ERD).

3.5.1 Context Diagram (CD)

The Context Diagram (CD) is used to establish the context and boundaries of the

system to be modelled: which things are inside and outside of the system being modelled, and

what is the relationship of the system with these external entities [2].

Figure 3.2: Context Diagram of Room Monitoring System

Based on Figure 3.2 above, it shows a context diagram which involved four entity which

is two type of sensor, one admin and user’s mobile phone.

Page 24: HOSTEL S ROOM MONITORING SYSTEM USING IOT

12

3.5.2 Data Flow Diagram (DFD)

A data flow diagram (DFD) is a two-dimensional diagram that explain how data

is processed and transferred into a system. The graphical depiction identifies each sources of data

and how it interacts with other data sources to reach common output.

Figure 3.3: Data Flow Diagram of Room Monitoring System

Page 25: HOSTEL S ROOM MONITORING SYSTEM USING IOT

13

3.5.2.1 Process 1.0: Check movement process

In this process, the PIR sensor will check the movement in student’s room. The sensor

will be installed in each room to detect the movement. The movement data will be collected and

the data will be process to send to the cloud. Data from cloud will generate the data information

to be stored in database. The database platform will send the notification to the user and staff

mobile phone via GSM modem. The data report will send to the log reporting process. Admin

able to view the movement data.

3.5.2.2 Process 2.0: Check temperature process

In this process, the temperature sensor will check the reading temperature in student’s

room. The sensor will be installed in each room to collect the temperature data. The data

collected will be process to be send to the cloud. Data temperature from cloud will generate the

data information to be stored in database. The database platform will send the notification to the

user and staff mobile phone. The data report will send to the log reporting process. Admin will

be able to view the reading temperature.

3.5.2.3 Process 3.0: Log Reporting

In this process, the admin will view the data collected through the database system. The

data collected include the date, time and the sensor reading in each hostel’s room. The collected

data will be recorded and users able to view the data whenever they login to the database system.

Page 26: HOSTEL S ROOM MONITORING SYSTEM USING IOT

14

3.5.3 Entity Relationship Diagram (ERD)

An entity relationship diagram (ERD) shows the relationships of entity sets stored

in a database. An entity in this context is a component of data. In other words, ER diagram

illustrate the logical structure of databases.

Figure 3.4: ER Diagram of Room Monitoring System

Page 27: HOSTEL S ROOM MONITORING SYSTEM USING IOT

15

3.6 Implementation phase

In the implementation phase, the sensor will be setup using arduino board to get

the 5V power supply and NodeMCU used to send the data to the cloud system. NodeMCU,

ESP8266 model will be used to connected the sensor with the Internet. All the sources code will

be generate using arduino sketches software and the code will be upload to the NodeMCU.

3.7 Software and Hardware Requirement

This section shows the list of hardware and software that involve in the

development process of this project. List of hardware and software are shown below

3.7.1 Software Requirements

Table 2: Software requirements

No. Software Purpose

1. Sketch Run Arduino coding and upload in Arduino Uno

hardware.

2. Google Chrome Browser to open database platform.

3. Microsoft Word 2013 Used to prepare documentation of the report.

4. Snipping Tool To captured and screen shot the images.

5. Windows 8 Operating system for PC.

Page 28: HOSTEL S ROOM MONITORING SYSTEM USING IOT

16

3.7.2 Hardware requirements

Table 3: Hardware requirements

No. Item Description / Purpose

1. Arduino Uno To connect the sensor from the breadboard and join

the Arduino Uno with the PC via USB cable.

Model: Arduino Uno (Rev3)-ICSP

2. NodeMCU Connect the sensor with the internet connection to

collect data from sensor.

Model: ESP8266 Wi-Fi module

3. PIR sensor Detect movements.

4. Temperature sensor Detect heat/ room temperature.

5. USB cable Connect the Arduino Uno and NodeMCU with PC.

6. PC ASUS laptop.

3.8 Chapter Summary

This chapter discussed about the step or methodology to conduct this project. For this

project, SDLC which is agile methodology have been used. Furthermore, with this method it can

guide us from the beginning to the end of the project.

Page 29: HOSTEL S ROOM MONITORING SYSTEM USING IOT

17

CHAPTER 4

SYSTEM DESIGN AND MODELLING

4.1 Introduction

This chapter review design phase in project development. Design is a process of resulting

product and it proposed framework of thinking. It represents a model on how to achieve a specific

goal in project. Whereas, model represent set of strategy on which to achieve design goals.

Modelling process involved a graphical representation of the function and processes for the

development of a system before the system was developed. In this project, flowchart, context

diagram (CD), data flow diagram (DFD) and entity relationship diagram (ERD) were produced

before the system was developed so that the system will be developed successfully.

Page 30: HOSTEL S ROOM MONITORING SYSTEM USING IOT

18

4.2 System Framework

Figure 4.1: Room Monitoring System framework

Figure 4.1 above show the framework for Room Monitoring System and the project will

develop soon. Before Admin can use this system, they need to setup the Arduino Uno with the

correct one and need to test the sensors to make sure the sensors working well with the arduino

board. This is important for them to get a correct reading about the monitoring problem in each

room. User will get notification via mobile phone that was send by the system.

When the arduino setup show the correct reading, the wired from arduino board will be

move into Node MCU board. Node MCU will be used because it had built-it with Wi-Fi

Page 31: HOSTEL S ROOM MONITORING SYSTEM USING IOT

19

connection. The data from Node MCU and the sensors will be sent to database platform. In this

system, the database platform had been used is Thinger.io. All the data collected will be stored in

Thinger database, and the list data will be shown in data bucket in the database. The data collected

will be specified on certain time which they need to be collected, and the shortest time that data

can be collected within 60 seconds.

4.3 Proof of Concept

4.3.1 Arduino Uno setup sketch

Figure 4.2: Arduino Uno setup sketch

Figure 4.2 show how the Arduino setup to connect the PIR sensor and the Temperature

sensor. The jumper wires had been used to connect the sensors to the arduino board.

Page 32: HOSTEL S ROOM MONITORING SYSTEM USING IOT

20

4.3.2 NodeMCU setup sketch

Figure 4.3: Node MCU setup sketch

Figure 4.3 show how the Node MCU setup to replace the arduino uno board. With the

internet connection, the reading data from PIR and temperature sensor will be sent to the database.

Page 33: HOSTEL S ROOM MONITORING SYSTEM USING IOT

21

4.4 Thinger.io Database Design

Thinger.io allows the user to explore or browse the entire data collected smoothly.

Thinger.io are known as an open sources platform that allow user to register their account info to

use the website. The attractive features graphics can help user do not get bored using the system.

Figure 4.4: User signup or registration form

The figure shows the first page that user need to register their username, email, and

password before login into the database system.

Page 34: HOSTEL S ROOM MONITORING SYSTEM USING IOT

22

Figure 4.5: Login

Figure 4.5 shows the login page that user need to insert registered username and password

before use the system.

Page 35: HOSTEL S ROOM MONITORING SYSTEM USING IOT

23

Figure 4.6: Add Device

Admin will add a device to connect with Thinger.io. Admin need to fill up the device

details. The device details include device id, device description, and device credentials the click

“Add Device”.

Page 36: HOSTEL S ROOM MONITORING SYSTEM USING IOT

24

Figure 4.7: Device List

Figure 4.7 shows list of the devices that connected with Thinger.io. If there is new device,

an admin needs to fill in the form add device first.

4.5 Chapter Summary

This chapter discussed the system framework overview, proof of concept and interface of

the database system which are essential as a guideline for reviewing the data collected by the each

sensor. This chapter also include how to connect the devices with the system.

Page 37: HOSTEL S ROOM MONITORING SYSTEM USING IOT

25

CHAPTER 5

IMPLEMENTATION AND TESTING

5.1 Introduction

This chapter discusses about the implementation process, testing process and the expected

result that can be achieved from the proposed design which have been discussed in Chapter 3.

5.2 Hardware

This project, the Arduino Uno board is used as a board to upload the code and then

connected with sensors. This device is the latest revision of the basic Arduino USB board. It

connect to the computer with the standard USB cable and contains everything that need to program

and use the board [14]. This project also used the NodeMCU ESP8266 model which is built-in

Wi-Fi adapter which is easy for us to connect with Internet connection.

Page 38: HOSTEL S ROOM MONITORING SYSTEM USING IOT

26

5.2.1 Overview

The Arduino Uno board is the most popular board is the most popular board and

mostly referred for the beginners as they are super easy to begin with, it does not require any

specific arduino uno software instead of that they only need to select the arduino uno in the device

option before uploading the program. The Arduino Uno can be powered by USB cable or directly

supplying 9 – 12v from the barrel jack. The circuitry operates at 5v dc which in case input more

than that is regulated with the help of 7805 voltage regulator. The 7805 voltage regulator ic is used

regulate the voltage supplied to the arduino board and manage it through processor and other

elements [12].

Figure 5.1 : Arduino UNO [12]

Page 39: HOSTEL S ROOM MONITORING SYSTEM USING IOT

27

For this project, we are also using NodeMCU, ESP8266 model is used. This is because it

can connect with the Internet. Besides, this project used a Wi-Fi connection to send the collected

data sensor to the cloud so that the user can easily view it from the system. All the code were

uploading into the NodeMCU using an Arduino Sketch software. A sketch is the name that

Arduino uses for a program. It's the unit of code that is uploaded to and run on an Arduino board

[13].

Figure 5.2 : NodeMCU, ESP8266 model [14].

Page 40: HOSTEL S ROOM MONITORING SYSTEM USING IOT

28

5.2.2 Arduino Software (IDE)

Programs written using Arduino Software (IDE) are called sketches. These

sketches are written in the text editor and are saved with the file extension .ino. The editor

has features for cutting/pasting and for searching/replacing text. The message area gives

feedback while saving and exporting and also displays errors. The console displays text

output by the Arduino Software (IDE), including complete error messages and other

information. This project is using C programing languages.

Figure 5.3 : Arduino sketch

Figure 5.3 shows the software have been used to run the sources code.

Page 41: HOSTEL S ROOM MONITORING SYSTEM USING IOT

29

5.2.3 PIR and Temperature sensor

Each PIR and temperature sensor will be installed in every room with different

device ID. The user will easily checked through the system the data collected by the devices all

the time.

Figure 5.4: PIR and Temperature sensor setup

Figure 5.4 shows how the PIR and Temperature setup that need to be installed in each

user’s room.

Page 42: HOSTEL S ROOM MONITORING SYSTEM USING IOT

30

5.3 Programming

As mentioned before this project have been used C languages programming using sketches.

After all the source code is uploading to the sensor to make sure both temperature and PIR sensor

are working well. The sensor need to be connected with the database platform which is Thinger.io.

To make sure the device connect with database system need to use this line:

#define _DEBUG_

#include <ESP8266WiFi.h>

#include <ThingerESP8266.h>

#define USERNAME "nurhumaira"

#define DEVICE_ID "ESP8266_new"

#define DEVICE_CREDENTIAL "some_credentials"

#define SSID "Xiao Zhan"

#define SSID_PASSWORD "sekarang1234"

ThingerESP8266 thing (USERNAME, DEVICE_ID,

DEVICE_CREDENTIAL);

Page 43: HOSTEL S ROOM MONITORING SYSTEM USING IOT

31

int arrayUS[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0};

int sensorValue;

int sensorValueClean;

int sensorValueClean2;

float temp;

int tempPin = A0;

int pirSensor = 5; //nodemcu D1

int tempSensor = A0; // update accordingly

void setup() {

Serial.begin(9600);

thing.add_wifi(SSID, SSID_PASSWORD);

pinMode(pirSensor, INPUT);

Serial.println("Starting PIR sensor reading...");

Page 44: HOSTEL S ROOM MONITORING SYSTEM USING IOT

32

// ####################### PIR Reading ######################

thing["PIR"] >> [] (pson& out){

for (int i = 0; i < 20; i++){

//PIR reading

int sensorValue = digitalRead(pirSensor);

arrayUS[i] = sensorValue;

delay(50);

}

array_arrangement(arrayUS, 20); //sort array

sensorValueClean = filter(arrayUS, 20);

if (sensorValueClean == 1) {

Serial.println();

Serial.println("Motion detected!");

}else {

Serial.print(".");

}

delay(100);

out = sensorValueClean;

};

// ################### End of PIR Reading ##################

Page 45: HOSTEL S ROOM MONITORING SYSTEM USING IOT

33

// ################## Temperature Reading ##################

thing["temperature"] >> [] (pson& out){

for (int i = 0; i < 20; i++){

//Temperature reading

int sensorValue = analogRead(tempSensor);

arrayUS[i] = sensorValue;

delay(50);

}

array_arrangement(arrayUS, 20); //sort array

sensorValueClean2 = filter(arrayUS, 20);

temp = analogRead(tempPin);

temp = temp * 0.48828125;

Serial.print("TEMPERATURE = ");

Serial.print(temp);

Serial.print("C");

Serial.println();

delay(1000);

out = sensorValueClean2;

};

// ############ End of Temperature Reading #################

}

Page 46: HOSTEL S ROOM MONITORING SYSTEM USING IOT

34

void loop() {

thing.handle();

delay(1000);

}

void array_arrangement(int *a, int n) { // sorting

// Author: Bill Gentles, Nov. 12, 2010)

for (int i = 1; i < n; ++i){

int j = a[i];

int k;

for (k = i - 1; (k >= 0) && (j < a[k]); k--)

{

a[k + 1] = a[k];

}

a[k + 1] = j;

}

}

int filter(int *a, int n) {

int i = 0;

int count = 0;

int maxCount = 0;

int filter = 0;

int median;

int prevCount = 0;

while (i < (n - 1)) {

prevCount = count;

count = 0;

while (a[i] == a[i + 1]) {

count++;

i++;

}

if (count > prevCount && count > maxCount) {

filter = a[i];

maxCount = count;

median = 0;

Page 47: HOSTEL S ROOM MONITORING SYSTEM USING IOT

35

}

if (count > prevCount && count > maxCount) {

filter = a[i];

maxCount = count;

median = 0;

}

if (count == 0) {

i++;

}

if (count == maxCount) { //If the dataset has 2 or more modes.

median = 1;

}

if (filter == 0 || median == 1) { //Return the median if there

is no mode.

filter = a[(n / 2)];

}

return filter;

}

}

Page 48: HOSTEL S ROOM MONITORING SYSTEM USING IOT

36

Both sources code above show how to generate the collected data from sensor to

the database system, Thinger.io.

thing["PIR"] >> [] (pson& out)

thing ["temperature"] >> [] (pson& out)

Page 49: HOSTEL S ROOM MONITORING SYSTEM USING IOT

37

5.4 Result

The result from the data collected by the sensor will be send to the Thinger.io. Once the

device connected to the NodeMCU board, the data will be recorded live via system widget.

Figure 5.7: Device API connection

Figure 5.7 above the device is going to generate the data from the sensor through their

system and save the data into the cloud.

Page 50: HOSTEL S ROOM MONITORING SYSTEM USING IOT

38

Figure 5.8: Data received

The graph widget in Figure 5.8 above shown the data from PIR sensor and temperature

sensor collected by the system.

Page 51: HOSTEL S ROOM MONITORING SYSTEM USING IOT

39

Figure 5.9: Database of Temperature Sensor

The Figure 5.9 list of data collected in room using Temperature sensor every one minutes.

Page 52: HOSTEL S ROOM MONITORING SYSTEM USING IOT

40

Figure 5.10: Database of PIR sensor

The Figure 5.10 list of data collected in room using PIR sensor every one minutes.

5.5 Chapter Summary

This chapter discussed how the implementation and testing process are done. It is important

to make sure the implementation process going well so that when we test the system, the result

will be as expected. To achieve the project successfully, always referred to the objectives that have

been discussed earlier.

Page 53: HOSTEL S ROOM MONITORING SYSTEM USING IOT

41

CHAPTER 6

CONCLUSION AND FUTURE WORK

6.1 Introduction

This chapter discusses on the conclusion and expected results of this project. The

conclusion of the system discusses for users that use the system. Project constraints state all the

difficulties that have been faced throughout the development of the system. Expected result

discusses on this chapter and the conclusion is made to conclude about the project.

6.2 Project Constrains

There are several problems and limitations that occurred during the development

of this project. The problems and limitations in conducting this study are:

The unstable connections of Internet connection which could bring some problem

during the system development process.

Require long-term power consumption during testing to get an accurate and better data

collection.

Unable to send the notifications because of using the open sources platform without

any payment.

Page 54: HOSTEL S ROOM MONITORING SYSTEM USING IOT

42

6.3 Conclusion

As a conclusion, with the introduction of Room Monitoring System in the building, the use

of sensors will greatly improve the quality and security of the room. The IOT monitoring system

will need to be integrated with an IOT cloud platform so that we can send a data to a user. Concept

of everyday object using built-in sensors to gather data and take action on that data across a

network.

It is important to make sure the implementation process going well so that when we test

the system, the result will be as expected. The expected result from this project is an admin, student

and staff can view the data collected by the monitor system. Then, during the project development,

we will make sure the system would be able to collect motion or movement data and the

temperature data frequently based on the time requirement. We expect that students will feel safe

whenever they leaving their room for a long time period. To achieve the project successfully,

always referred to the objective that have been discussed earlier.

During conducting this study, the concept of Internet of Things (IOT) can be implemented

by placing number of Arduino board for each room. So they can collect the data of each room

covered. In addition, this project is useful for students because they can monitor the room’s

condition everywhere. Besides, by using Arduino uno we can save our money because the price is

cheap and can bring them anywhere.

Page 55: HOSTEL S ROOM MONITORING SYSTEM USING IOT

43

6.4 Future Work

There is little suggestion that can be made for future work which can be used to upgrade

the efficiency of this project. Some suggestions that can to be considered are:

Upload the sources code whenever the sensor are ready to test in the environment.

Use an open sources platform that able to send the notifications to the user via email

or mobile phone.

Create a system which can collect the data from the sensor and save them into the

database.

6.5 Chapter Summary

In this chapter, the benefit of the project and the difficulty faces during the development

process are highlighted. Besides, the future work highlighted could possibly aid in a better tool

development which can be more useful to the users in the future.

Page 56: HOSTEL S ROOM MONITORING SYSTEM USING IOT

44

REFERENCES

[1] Albert Gifson, Slamet. “Long Distance Observation System using PIR sensor.” Journal

of Computer Network and Applications. IEEE (2009).

[2] Sun-Kuk Noh, Kuk-Se Kim, and Yoo-Kang Ji. “Room Monitoring System for Wireless

Sensor Networks.” (2013).

[3] Petros Spachos, Jieyu Lin, Hadi Bannazadeh, Alberto Garcia. “Smart Room Monitoring

through Wireless Sensor Networks.” (2017)

[4] Tariq, A.K., Ziyad, A.T., & Abdullah, A.O. (2013). Arduino Wi-Fi network analyzer.

Procedia Computer Science, 21, 522-529.

[5] Gubbi, Jayavardhana, et al. “Internet of Things (IoT): A vision, architectural elements,

and future directions.” Future Generation Computer Systems 29.7(2013): 1645-1660.

[6] Ansari, Aamir Nizam, et al. “An Internet of Things approach for motion detection using

NodeMCU.” Intelligent Computing and Internet of Things (ICIT), 2014 International

Conference on.IEEE, 2015.

[7] https://melsatar.blog/2012/03/15/software-development-life-cycle-models-and-

methodologies/

[8] https://www.techopedia.com/definition/25895/iterative-and-incremental-development

[9] https://www.cs.uct.ac.za/mit_notes/software/htmls/ch06s06.html

[10] https://www.linkedin.com/pulse/what-software-development-life-cycle-sdlc-phases-

private-limited

Page 57: HOSTEL S ROOM MONITORING SYSTEM USING IOT

45

[11] https://www.arduino.cc/en/Main/Boards

[12] https://eeeproject.com/arduino-uno-board/

[13] https://www.arduino.cc/en/Tutorial/Sketch

[14] https://frightanic.com/iot/comparison-of-esp8266-nodemcu-development-boards/

Page 58: HOSTEL S ROOM MONITORING SYSTEM USING IOT

46

APPENDIX

Page 59: HOSTEL S ROOM MONITORING SYSTEM USING IOT

47

Figure 1.0: Activities and Milestone of the Project

Page 60: HOSTEL S ROOM MONITORING SYSTEM USING IOT

48

Figure 1.1: Gantt Chart Final Year Project.