Vous êtes sur la page 1sur 121

Context-aware Profiling using the Internet of Things

By

M. Osama Asif
(BECS/F12/0112)

Haris Ali Khan


(BECS/S12/0116)

Syed Haider Raza Naqvi


(BECS/F12/0116)

Under the supervision of


Assistant Prof. Iqbal Uddin Khan

Faculty of Engineering Sciences and Technology


Hamdard Institute of Engineering and Technology
Hamdard University, Main Campus, Karachi, Pakistan
2016
Context-aware Profiling using the Internet of Things

By

M. Osama Asif
(BECS/F12/0112)

Haris Ali Khan


(BECS/S12/0116)

Syed Haider Raza Naqvi


(BECS/F12/0116)

Under the supervision of


Assistant Prof. Iqbal Uddin Khan

2016
Context-aware Profiling using the Internet of Things

By

M. Osama Asif
(BECS/F12/0112)
Haris Ali Khan
(BECS/S12/0116)
Syed Haider Raza Naqvi
(BECS/F12/0116)

A project presented to the


Faculty of Engineering Sciences and Technology
Hamdard Institute of Engineering and Technology
In partial fulfillment of the requirements for the degree of

Bachelors of Engineering
In
Computer Systems Engineering
Faculty of Engineering Sciences and Technology
Hamdard Institute of Engineering and Technology
Hamdard University, Main Campus, Karachi.

CERTIFICATE

This project Context-aware Profiling using the Internet of Things presented by M .


O s a m a A s i f , H a r i s A l i K h a n a n d S y e d H a i d e r R a z a N a q v i under
the supervision of Assistant Professor, Mr. Iqbal Uddin Khan and approved by the project
examination committee has been presented to and accepted by the Hamdard Institute of
Engineering and Technology, in partial fulfillment of the requirements for Bachelor of
Engineering (Computer Systems Engineering).

Mr. Iqbal Uddin Khan (Member)


(Project Supervisor)

Engr. Azhar Dilshad (Member)


(Head of Department of
Computer Systems Engineering)

Prof. Dr. Pervez Akhtar (Member)


(Director, HIET)
ABSTRACT

This Final Year Project Context-aware Profiling using the Internet of Things is designed to
add intelligence to home devices using the IoT, facilitate less consumption of electricity for
energy saving as well as help the elderly people with mobility issues to have control of their
room surroundings without moving too much. It includes profiles of individual users containing
fields for different day timings and devices for control of the surrounding room environment.
The project facilitates the control of lighting, fan speed and windows blends through a web
interface that stores and loads user preferences with the help of a database. The project also
provides identification for each individual user.

1
ACKNOWLEDGEMENT

Firstly we acknowledge the divine help, blessings, guidance and support of Almighty ALLAH
for the completion of this project starting from the days of our idea gathering, proposal
presentation and then throughout the period of our first evaluation and now our final evaluation
and project report.

We also acknowledge Hamdard Institute of Engineering and Technology for the unwavering
support of the idea of our project, a coordinated effort that is necessary for the achievement of a
degree at the undergraduate level. We also acknowledge the critical views of all the experts who
pointed out our flaws and short comings at the time of the Proposal Presentation as well as the
First Evaluation.

We express our gratitude to Assistant Professor, Mr. Iqbal Uddin Khan for his insights and
views about our project and his constant help and support for guiding us through the Final Year
Project as our Project Supervisor. Whenever we could find him, he was there available for
discussion about the project. He also played an important role in arranging our project
presentations whether it be the Proposal Presentation or the First Evaluation.

Finally, parents, relatives and guardians were always there for us to support us financially and
also morally so it is important to acknowledge their efforts.

2
TABLE OF CONTENTS

CERTIFICATE.................................................................................................................................I

ABSTRACT....................................................................................................................................II
ACKNLOWLEDGEMENT...........................................................................................................III
TABLE OF CONTENTS..............................................................................................................IV
LIST OF FIGURES..................................................................................................VII
LIST OF TABLES.......................................................................................................................VII
LIST OF ABBREVIATIONS.....................................................................................................VIII

CHAPTER 1: INTRODUCTION.1
1.1 Background..1
1.2 Related Work...4
1.3 Definitions and Terms related to Smart Environment and IoT4
1.4 Related Projects.................................................................................................................15
1.5 Initiatives and efforts around the Globe.25
1.6 Motivation......................................................................................................................27
1.7 Objectives..27
1.8 Report Structure & Organization...27

CHAPTER 2: LITERATURE REVIEW..................................................................................28


2.1 Desired System Characteristics..28
2.2 Different types of individual Preferences..
.30
2.3 Goals of a Smart Office Environment..

3
...31
2.4 Technologies making IoT viable....31
2.4.1 Sensors and Actuators32
2.4.2 Middleware and
Networking..32
2.4.3 Ubiquitious and Pervasive
Computing...33
2.4.4 Protocols33
2.5 Important metrics of Smart
Environments..34
2.6 User adoption of IoT related
Technologies.35
2.7 Applications of IoT35
2.7.1 Home and Personal Level IoT
Applications...36
2.7.2 IoT Applications at the Enterprise Level
37
2.7.3 IoT applications for
Utilities...38
2.7.4 IoT applications in the Transportation
Domain..39
2.8 Short Comings and Challenges of a Smart Environment..43

CHAPTER 3: SYSTEM REQUIREMENT SPECIFICATION...


51
3.1 SRS for Context-aware Profiling using the Internet of Things
51
3.1.1 Functional Requirements...51
3.1.2 Non-Functional Requirements...52

CHAPTER 4: PROJECT SOFTWARE AND HARDWARE COMPONENTS.....53


4.1 Software Components53

4
4.1.1 HTML5..53
4.1.2 CSS3......54
4.1.3 JavaScript...56
4.1.4 PHP56
4.1.5 MySQL......57
4.1.6 Arduino IDE for Development and Interfacing of
devices.60
4.2 Hardware Components...60
4.2.1 Arduino Boards..61
4.2.2 Ethernet Shields.68
4.2.3 Router.69
4.2.4 RFID module and RFID card..
69
4.2.5 L298 Driver IC...70
4.2.6 LED and Fan
Devices.71
4.2.7 Battery72
4.2.8 Connecting Wires and Category 5 Ethernet Cables.......72

CHAPTER 5: SYSTEM
DESIGNING...73
5.1 Control Flow
Diagram....73
5.2 Architecture Diagram.73

CHAPTER 6: IMPLEMENTATION.74
6.1 Apache XAMPP.....74
6.2 Authentication using RFID and MySQL
database..74
6.3 Creating the Network.75
6.4 Styling of Website using
CSS.76

5
6.5 User Profile Form using HTML5, CSS3 and PHP77

CHAPTER 7: CONCLUSION AND FUTURE WORK


78
7.1 Advantages of the Project..78
7.2 Conclusion.78
7.3 Future Work...78

REFERENCES AND BIBLIOGRAPHY...79


APPENDIX A: Name A..zz
APPENDIX B: Name B..zz
APPENDIX C: Name C..zz

6
LIST OF FIGURES

Figure 1: IoT-A reference architecture...22


Figure 2: A picture highlighting different applications of IoT
37
Figure 3: Roadmap of key technological
developments.............................................................43
Figure 4: Executing simple query on
Workbench...60
Figure 5: L298N IC
Pinout.71
Figure 6: Control Flow
Diagram.73
Figure 7: Architecture
Diagram..73
Figure 8: RFID
Module..74
Figure 9: Implementing the
Network..75
Figure 10: Login Page75
Figure 11: Registration Form.77
Figure 12: User Profiling
Form...77

LIST OF TABLES

Table 1: List of Abbreviations..6


Table 2: Areas of application of smart
environment...40
Table 3: Potential IoT applications identified by different focus
groups.42
Table 4: Summaries of SRS
51
Table 5: Technical Specifications of Arduino
Uno.61
Table 6: Technical Specifications of Arduino Leonardo...............................................................65
LIST OF ABBREVIATIONS

Table 1: List of Abbreviations


S Abbrevi Meaning S Abbreviati Meaning
No. ations No. ons
1 IoT Internet of Things 60 iDorm Intelligent Dormitory
2 R&D Research and Development 61 EMD Energy Management Device
3 ICT Information and 62 ELLIOT Experimental Living Lab for
Communication Technology the Internet of Things
4 IPCC Intergovernmental Panel on 63 EBBITS Enabling Business Based
Climate Change Internet of Things Services
5 IEA International Energy Agency 64 UbiComp Ubiquitous Computing
6 RFID Radio Frequency 65 DAISy Dynamic Ambient Intelligent
Identification Systems Unit
7 Wi-Fi Wireless Fidelity 66 NFC Near Field Communication
8 3G, 4G- 3rd or 4th Generation Long 67 ISO International Standards
LTE Term Evolution Organization
9 MEMS Micro Electromechanical 68 IERC Internet of Things European
Systems Research Cluster
10 MASBO Multi Agent System for 69 CoAP Constrained Application
Building control Protocol
11 LAN Local Area Network 70 WSN Wireless Sensor Network
12 API Application Programming 71 HVAC Heating, Ventilation and Air
Interface Conditioning
13 SVG Scalable Vector Graphics 72 W3C World Wide Web Consortium
14 AHCE Adaptive Control of Home 73 ISES Iterative Sampling Earliest
Environments Solutions
15 iRoom Intelligent Room 74 PA Personal Agent
16 EU FP7 European Union 7th 75 SPOT Smart Personalized Office
Framework Program Thermal Control System
17 MIT Massachusetts Institute of 76 GAS Gadget ware Architectural
Technology Style
18 AI Artificial Intelligence 77 SD Secure Digital
19 UDP User Datagram Protocol 78 RFC Request For Comments
20 XUL XML User Interface 79 IoT-A Internet of Things Reference
Language Architecture
21 PPV Predicted Personal Vote 80 M2M Machine-to-Machine
22 CASAG Coordination and Support 81 6LoWPAN IPv6 over Low-Power
RAS Action for Global RFID- Wireless Personal Area
related Activities and Network
Standardization
23 PMV Predicted Mean Vote 82 IoT-i Internet of Things initiative
24 IEEE Institute of Electrical and 83 ITU International
Electronics Engineers Telecommunication Union
25 IPSO Internet Protocol for Smart 84 IETF Internet Engineering Task
Objects Force
26 TDMA Time Division Multiple 85 ANSI American National Standards
Access Institute
27 GPS Global Positioning System 86 MAC Media Access Control
28 FDMA Frequency Division Multiple 87 CSMA Carrier Sense Multiple
Access Access
29 IP Internet Protocol 88 PAN Personal Area Network
30 OS Operating System 89 XML Extensible Markup Language
31 CSS Cascading Style Sheets 90 ECG Electrocardiogram
32 SAP System Application and 91 AVR Alf and Vegards RISC
Products processor
33 GBROO Great Barrier Reef Ocean 92 SCADA Supervisory Control and Data
S Observing System Acquisition
34 XHTML Extensible Hyper Text 93 SRS System Requirement
Markup Language Specification
35 HTML Hyper Text Markup Language 94 UART Universal Asynchronous
Receiver Transmitter
36 SQL Structured Query Language 95 PHP Hypertext Preprocessor
37 ECMA European Computer 96 FIG Framework Interoperability
Manufacturers Association Group
38 VM Virtual Machine 97 I/O Input/output
39 DOM Document Object Model 98 PDF Portable Document Format
40 CGI Common Gateway Interface 99 CLI Command Line Interface
41 ISAM Indexed Sequential Access 100 PSR PHP Standards
Method Recommendations
42 RDBMS Relational Database 101 IDE Integrated Development
Management System Environment
43 CDC Communication Devices 102 LAMP Linux Apache MySQL
Class PHP/Perl/Python
44 DTR Data Terminal Ready 103 HID Human Interface Device
45 GUI Graphical User Interface 104 I2C Inter-Integrated Circuit
46 GPL General Public License 105 IRC Internet Relay Chat
47 ISP In-System Programmer 106 CRUD Create Read Update Delete
48 IC Integrated Circuit 107 USB Universal Serial Bus
49 RAM Random Access Memory 108 ICSP In Circuit Serial Programming
50 AC Alternating Current 109 LED Light Emitting Diode
51 XAMPP Cross-platform Apache 110 ARM Advance RISC(Reduced
MariaDB PHP and Perl Instruction Set Computing)
Machine
52 EEPRO Electrically Erasable 111 SEMAT Smart Environmental
M Programmable Read Only Monitoring and Analysis
Memory Technologies
53 FTDI Future Technology Device 112 SRAM Synchronous Random Access
International Memory
54 TTL Transistor-Transistor Logic 113 DFU Device Firmware Update
55 TWI Two Wire Interface 114 PWM Pulse Width Modulation
56 DC Direct Current 115 SPI Serial Peripheral Interface
57 RJ Register Jack 116 HTTP Hyper Text Transfer Protocol
58 TP Twisted Pair 117 COM Communication port
59 PoE Power over Ethernet 118 TCP Transmission Control
Protocol
CHAPTER 1:

INTRODUCTION

1.1 Background

In recent years, there has been a lot of interest taken in smart environments and the applications
of Internet of Things in order to incorporate smartness in our daily lives and home appliances. A
few terms like Ambient Intelligence, Profiling, Context-awareness, and activity recognition have
been used with smart environments. A new paradigm known as IoT was coined by Kevin Ashton
in 1999. The concept of this new paradigm is the seamless embedding of objects that are able to
connect to and communicate with other objects and devices with the help of networking
protocols for accomplishing a certain objective. Because of the R&D work in the IoT paradigm
that has enhanced communication and networking capabilities of objects, we are witnessing
appliances that are more potent and smart and are capable of being used with smaller computing
devices like smart phones. Through the construction of smart environment the tendency is to
achieve control of appliances and environmental conditions inside a small space such as a
building, a home, an office etc. The desire to control the surroundings in these small spaces
comes from the fact that we spend most of our times at our home, office or school. In the current
scenario of energy and power shortage locally in Pakistan, relying on smart infrastructure can be
one of the possible solutions for energy conservation. Meanwhile in Europe, the energy usage of
buildings is greater than both the transport and industrial sectors. Moreover, the buildings in the
UK utilize a greater percentage of total energy than buildings in other European countries. Due
to this, there is a greater need to develop a mechanism to reduce consumption of electricity in a
cost effective way so that financial resources can be saved. In accordance with the IEA decision
of a 77% cut in the carbon dioxide levels by 2050 at the IPCC, such measures should be taken in
order to reduce electricity consumption. As our everyday objects become smarter in the near
future there will be greater consumption of energy worldwide and hence it is significant to take
steps now to reduce energy usage. If energy is carefully used and its wastage is avoided then a
building could achieve a 30% improvement in performance. Due to the technological leap that
has been possible because of ICT
we can now realize the control of our room surroundings and bring smartness into our room
appliances without explicit movement. With the passage of time and the growth of processing
power in microprocessors and controllers as well as the cheap availability of network
technologies such as Wi-Fi and Ethernet and all sorts of portable devices like Smart Phones and
tablets ensures that people can enhance their day to day lifestyle and automate tasks bringing
them more comfort when they are around, conserve resources such as electricity and feel safe
and secure about their places when they are away. Adding to these possible applications is the
possibility of monitoring and taking care of the elderly, their health and social computing.
However, certain challenges are present to fully realize the use of smart environments. One of
them is Security and Privacy. Users have concerns of someone else manipulating their homes,
appliances and daily lives which is a matter of serious concern. Research has been conducted to
introduce security with the technology so that the resident alone has the real control over the
entire premise and he is the only one to make changes and update the system. Another
opportunity available is to provide support for such smart rooms both inside and outside the
premises using smart phones in order to control and monitor the rooms or premises. Innovation
in computing will empower us to go beyond the use of desktop PCs. Routine life objects will be
connected in the environment in different ways within IoT. To meet the needs of IoT,
unnoticeably containing information and communication equipment within the premises, RFID
and sensor networks will play an important role. The structure of a smart environment will
revolve around sensors, actuators and the Internet connected together. The sensors will process
the information which is going to be distributed to various applications for forming a uniform
perspective of the environment in which the automation of some uncontrollable items will be
allowed. The progress of the Internet since static web to the web of social networks to the web of
Ubiquitous Computing requires greater processing and consumption of data with the help of
advanced data processing tools. The intersection of middleware, sensors and actuators, and data
makes up the components for an IoT based solution. Ubiquitous Computing can be practiced
through the following parts of IoT:
(I) Hardware-this includes communication devices and protocols as well as actuating and
sensing devices
(II) Middleware-it has the ability to process and analyze data as per the requirement of the
system
(III) Presentation-consists of multi-platform, diverse, application-specific, and comprehensible
data presentation methods. It is necessary to build and apply scalable and free-of-
dependencies WSNs which provide different services like actuation and control, data
processing, management of data and analysis of gathered data in order to use the current
Internet efficiently. The essential components of an IoT infrastructure include robust
internetworking using current technologies in networking as well as processing of data by
devices within the network based on the context of the environment.
The emergence and popularity of wireless standards like Wi-Fi and 4G-LTE are enabling a future
era of ubiquitous computing. There needs to be a shift in the way technology has been used now
for the complete realization of IoT, a shift that involves moving from portable computing devices
to interweaving objects that are used in daily lives. IoT requires distributed information about the
status of electronic devices and their owners, communication hardware and software components
for delivering accurate and precise information, and a mechanism through which analysis and
automatic control can be achieved for seamless integration of IoT. The stated requirements can
lead to an IoT based smart environment involving smart networking and context-awareness.
Since its introduction the meaning of the term IoT has broadened to add several application
domains like transport, healthcare, education etc. Even with the evolution of ICT the aim of
automatic measure and control has not changed despite an alteration in the concept of the term
Things. The Internet of the future will be able to gather sensed data, control and automate
devices and objects and deliver end user services in analytics, communication and exchange of
information with the help of current standards of the Internet. Because of the abundance of
technologies like Wi-Fi, RFID, Bluetooth, services provided by telecom operators and networks
of actuators and sensors IoT is changing the way we use internet today. The innovation of the
Internet resulted in widespread and instant connectivity among people. Networked objects of
daily use to form a smart environment will result in a new innovation in the Internet. The year
2011 was the first time that networked devices outnumbered individuals on earth. The pace with
which the number of networked devices are growing, it is predicted that the number will climb
up to 24 billion networked devices in the
year 2020. This growth will result in a total business of $1.3 trillion in various sectors:
automotive, utilities, health and consumer electronics. The ubiquitous computing paradigm came
into being in the 1980s aimed at the introduction of technology in the routine life of individuals,
this concept innovated by research was an outcome of the development of technology enabling
the interactivity between people through an interface. In the present scenario, computation is
departing from the desktop environment to the portable devices enhancing communication and
access to information. The founder of the Ubiquitous Computing paradigm, Mark Weiser,
envisioned the smart environment to be a physical world unnoticeably connected with sensors,
actuators, displays and computational elements, embedded seamlessly in the daily objects of our
lives, and connected through a continuous network. For this vision to be reached, the innovation
of the Internet has played a key role allowing worldwide connectivity and interaction of devices.
The power and capabilities of inter-networking allow for countless number of network resources
and storage to be shared and scattered. The creation of small devices potent enough to process,
detect and convey signals through wireless standards within a short range has been possible
because of the interdisciplinary development of wireless technologies, digital electronics and
MEMS. The inter-networking of these small devices known as nodes creates a WSN which has
diverse uses like traffic, environmental, infrastructure monitoring etc.; hence, it is instrumental in
achieving the Ubiquitous Computing vision by giving the power to sense and monitor using
computers. In order for the IoT to reach maturity, it is necessary to take security, efficiency,
scalability and cost of computation and data storage into account.

1.2 Related Work

The Context-aware profiling using Internet of Things project aims at building a smart office
room. It consists of individual profiles of users containing different timings of the day and
preferences for adjusting the devices which are part of a LAN. The project also includes a system
of registering new users and creating new profiles to save or change the preferences. User
identification and authentication is also a part of the project. User login and password details are
encoded with the help of a basic Hashing Algorithm. The appliances which are controlled
through the interface include Lights, fan and windows blends. In order to update the preferences
of
individual users the card with the details has to be swiped. The card includes the details of a
single individual user dumped onto it. The project also comprises of a server machine and a
client machine. The web server allows for the web interface to run and control the appliances
based on individual user preferences set by the user himself.
1.3 Definitions and Terms related to Smart Environment and IoT

Different related disciplines of study have encourage the progress in Smart Environments, there
are similarities as well as noteworthy disparities among them.
1) Context-awareness: Refers to the different timings, seasons, environment and climate
settings in which the system operates.
2) Dynamic: Refers to the way the environment adjusts with respect to the preferences
whenever the preferences are updated.
3) Smart objects: Regular objects or electronic devices capable of communicating, acquiring
and processing information as well as understanding the external environment and
monitoring and controlling it. They have hardware equipment like a CPU, sensing devices,
motors and actuators, and communication hardware.
4) Smart Environment: An environment (open or closed space) that is capable of interpreting
data from a variety of sources due to the augmentation of sensors potent enough to pile and
handle data, capable of communicating with people and comprises of a variety of computing
devices both small and large working together to enhance and automate the inhabitants daily
lives.
5) IoT: It is a network comprising of sensors and actuators which are addressed through
networking protocols with a framework that allows the distribution of data and information
to various applications and services to develop a uniform perspective for the realization of a
smart environment.
6) Secure Data aggregation: A methodology used by WSN to gather data that is authentic and
genuine as well as making sure the network lasts long.
7) Data profiling: It is a technique used to perform analysis on data. It involves collection and
storage of statistics that pertains to the data records as well as searching for minimum and
maximum quantities, occurrences of fields, type of data and its format, and closeness with
the predicted result. Some more sophisticated methods try to find out the relation among
different fields in same or different sets of values.
8) Ambient Intelligence: A smart software system capable of comforting individuals by
helping them rationally.
9) Intelligent Environment: The Environment is termed Intelligent when the various
interconnected devices perform activities that operate various environment parameters and is
planned through proactive self-training means so that a cooperative complete utility can
improve the involvement of the inhabitants with that environment. Also, Intelligent
Environments enable the development of solutions that combine Ambient Intelligence, Smart
Environments and Ubiquitous Computing.
10) Pervasive/Ubiquitous Computing: Involves the exploration of delivering dispersed,
environment-conscious, portable computational facilities to the consumer in a multitude of
settings. Generally, Ubiquitous Computing is perceived to be linked to Human-Computer
Interaction. On the other hand, the focus of Pervasive Computing is computing elements, the
management of data generated by computing elements, and the interconnection between
them.

1.4 Related Projects

1) The Neural Network House

This project was developed at University of Colorado at Boulder and it was designed to manage
the energy usage of a house for conservation purposes by operating a neural network. The system
which was developed was termed Adaptive Control of Home Environments (AHCE). The project
had a couple of aims: preservation of energy and prediction of an individuals requirements. The
system applied a neural network for deducing an individuals consumption habits. Through
examination of an individuals physical modification of location parameters, the system was able
to acquire their preferences about the parameters. The system obtains and stores any changes in
preferences only after observing them. In order to preserve electricity resources, luminosity
levels
are kept on the lowest level in the absence of an individual. For the fulfillment of expected
requirement, the hot water tank is held under the lowest temperature. Additionally, the system is
capable of infrequently examining an inhabitant through reduction of necessary electricity, like
reducing luminous intensity or temperature to observe the response of an individual. If the
individual responds positively, the latest preferences would be used by the neural network for
energy reduction. To demonstrate the working of the system, an ancient school house of 1905
was reconditioned so that a variety of multiple sensing devices could be fitted. The preferred
parameter values were confined to only a single house thus they could not be assigned to each
inhabitant.

2) The iRoom Project

This project is an implementation of a closed smart space-a meeting room which takes into
account the users and their personal levels of comfort, the project also provides user interfaces
for interaction with the system. The project makes use of cameras and microphones and different
embedded devices which are distributed within the intelligent room to demonstrate the principles
of ambient intelligence and adjust with the habits of the inhabitants and the context of the
environment. This project is part of the aire project. The functional roles of the project involve
recognizing and comprehending the moves of the inhabitants as well as tracking them and
communicating with them. The project also provides the inhabitants of the iRoom with
suggestions and news. The three software layers responsible for the control of the iRoom have
the following functionality: the first layer facilitates interaction between the room and the
inhabitants, the second layer provides an agent interface that combines the first layer entities
under one umbrella, the third layer is responsible for higher level functions. The project used
Metaglue and Hyperglue technologies for smooth networking and interoperability between
agents to automate tasks through software. The SodaBot provided implementation of the
software agents; the project was implemented as part of a command center for relief in a post
disaster scenario and for making virtual campus tours to the AI Laboratory of the MIT
interactive. Some other usage of the project include providing information regarding meetings in
an orderly way and assisting people in searching data on the internet.

3) The Greener Buildings Project

The project is backed by the European FP7 initiative and focuses on building a smart space for
the comfort of the user as well as for the purpose of saving energy. The project involved the
construction of a smart office in Holland in which the users themselves can define rules for the
office in order for the environment to adjust in accordance with the desires of the users based on
the data that is available. The project worked on technologies like WSN, smart grid
infrastructure, activity recognition etc.

4) The INERTIA Project (MedPower 2014)

This project involves actuation of parameters that are controllable through a user based profiling
model that monitors user activities and preferences with the help of sensors that provide real time
information about the environment and then adjusts the settings of the environment based on the
sensor data that has been captured and stored. The project has also taken into account the
discomfort probability which is determined from the captured sensor data. In this project, the
users are not directly involved in the decision making loop or the adjustments of parameters. The
findings that the project obtained was a result of deployment of the system in a real office
scenario. They conducted a 10 week recording of the patterns of user comfort and discomfort
preferences based on the context and used them further to accurately predict the comfort settings
of individual users for energy savings in buildings.

5) The AIM project

This project focused on energy conservation and various Universities implemented it. The
project involves controlling electronic devices inside a home with the help of a prediction
algorithm based on the behavioral profiles of the users and their settings. A set of wireless
sensing devices were deployed across a house for perceiving the present condition of the premise
as well as for sensing an individuals existence inside the house. The system also included
construction of a statistical profile about every individual for forecasting their presence inside the
house as well as determining luminosity and thermal comfort values. When there is a change in
behavior patterns the system
takes the data from the sensors in real time and adjusts the profiles of the users based on the
information provided by the sensors and thus the system responds differently next time. The
system applied a computer based model for estimation of the highest error for the forecast of
occupancy which turned out to be 2.55%. The project also constructed a network architecture to
be used in Smart Environments. The term Energy Management Device (EMD) was used to
denote every appliance which the environment operated. The home network comprising of
EMDs was linked with the Internet via some gateway consequently the operators and the utility
corporations were able to distantly manipulate the EMDs. The outcomes of the system evaluation
were moderately beneficial but they were estimated with the help of computer based models.

6) The i-Dorm Project

This research project was developed by the University of Essex and involved the operation of
fuzzy logic controllers for manipulating a usual dormitory. Swift acquisition of individual
preferences as well as creation and saving of rules about attaining them was the emphasis of the
research. It comprised of thermal and illumination comfort preferences for a room. In the case of
complete room vacancy, the rule database of the system included pre-planned actions for
conserving electricity. For vacant spaces, illumination and temperature values were fixed at
certain lowest threshold that are modifiable by the system upon reoccupation thus reinstating
previous values. The Compaq iPAQ wireless controller acts as the hub of the iDorm system. An
individual is fully authorized to modify the parameters of the environment resultantly
implementing the preferred parameter values. In order to deduce the results, an individual
occupied a room for 5 days during which the systems ability to acquire an individuals preferred
values was computed. The outcome of the test demonstration exhibited the systems proficiency
in making rules matching the inhabitants preferred values inside 3 days. Subsequently, there was
a significant reduction in the rate of production of fresh rules since the system previously
acquired a majority of an individuals actions.

7) The EBBITS Project

The EBBITS project is another part of FP7 EU project, which has worked on the improvement of
the LinkSmart middleware and added functionalities like better interoperability and better
networking capabilities. Based on this improved semantic middleware, the objective of the
project is to develop a general architecture for IoT based solutions. The project aims to bring IoT
to enterprises and businesses by providing information and services.

8) The ELLIOT Project

This project has constructed a prototype of a Smart Office as part of the ELLIOT project under
the FP7 EU initiative. The ELLIOT project is designed to provide users with their desired
preferences and adjustments and has used the LinkSmart middleware to do it in an IoT based
smart office solution. This automation effort involves providing services to the business
community that operates their businesses through small and large offices by automating certain
tasks which are performed within the office on a regular basis by the employees. The project
incorporated its own customized system architecture and networking technologies to adjust
different office parameters to desirable values by monitoring the users regularly. The project
highlights the application of IoT in the Smart Office domain by incorporating intelligence in
offices. The parameters which are acquired, measured and controlled within the office setting
include: humidity, vibrations, noise level, light intensity, temperature etc. This control is
achieved through the combination of various specialized hardware, actuators and sensing devices
with consideration to the preferences of office users. The networking between the different
devices within the smart office ensures that data can be exchanged, also each device is
independent and can adapt to changes in the preferences of the office employee because of the
capabilities that the device contains. The information is stored and updated for future reaction to
external environment. The project also involves linking with the databases, management and
information systems that are involved with the workflow of the office. The project balances the
comfort of employees and functional roles of the office like efficiency, keeping track of progress
of a project, conservation of energy and honoring the deadlines etc. The system is deployed in an
open Living Lab environment communicating with a fundamental IoT setup and continuously
monitors and evaluates the user experience. The ELLIOT project was used
to establish a tradeoff between comfort preferences, energy savings, optimum settings for work
environment and efficiency of the work within the office. The project also provided a website
portal for employees so that they could communicate with the Smart Office equipment like
sensors, modify the parameters of the Smart Office, apply custom settings for the portal and the
system, remember schedules and reminders for important tasks and events that have to be done,
get a representation of patterns of energy usage, and know about the CO 2 footprints. The web
interface provided by the Smart Office solution is also capable of giving suggestions to
individual employees about better conservation of electricity by comparing actual measure of
preferences and user defined values in order to provide energy efficiently. This project was based
on a middleware and evaluation of the users. The presented prototype of the Smart Office
solution, integrating features of modular IoT middleware and continuous evaluation of user
experience, was developed as a pilot use case of the ELLIOT project. The prototype of the
project was implemented in a Living Lab environment in different situations:

(I) Determination of which sensor or method was most appropriate for detecting presence by
taking into account their utility and user friendliness. The sensors and methods that were
contrasted are motion sensors, RFID cards and tracking of electricity usage.
(II) The change of smart office environment in accordance with the requirement of work that
is to be done by making a comparison between the schedules, the personal plans related
to work and leaves.
(III) The conservation of energy achieved by the use of a simulation game tournament aided
by the provided web portal for Smart Office.
The test demonstrations emphasized on proving the appropriateness of the solution as well as its
adoption for regular use by people. The project used an architecture for the network which
proved to be appropriate and beneficial for the system taking into account the network expansion
and flexibility of connected objects. In order to determine the measure of adoption of the system
by users, the frequency of average use of the given devices was determined which turned out to
be 80%. The project claims to have positive outcome but also emphasizes on the betterment of
the prototype demonstration by implementing it on different groups of people as well as on
different
office types.

9) User Profiling and Micro-accounting for Smart Energy Management

Under this project the participants devised a method for micro-accounting the amount of energy
used by different appliances with the help of single power line enabling automation of those
appliances resulting in a smart energy application. Contrarily, information about the everyday
practices of users is needed for the proficient utilization of electricity resources. The provided
solution infers about the usual activities of the inhabitants considering their use of energy by
observing the pattern of energy usage. The micro-accounting technique was claimed to be non-
intrusive and avoided the use and deployment of sensing devices however there was a drawback
concerning the correctness and response of the system.

10) The Syndesi Project

The Syndesi Project provides a framework that develops a customizable smart environment with
the help of different technologies including WSNs and networking protocols like 6LoWPAN and
NFC. The project rectifies the drawbacks of previous frameworks for WSNs and provides a
complete solution. The project incorporates recognition of individuals and recognizes the need of
providing customary settings for the environment in their framework. For the control of
electronic appliances, the project developed an interface so that the appliances can interact with
the environment. The project also provides a method for finding the location of a service with the
help of the Internet by mapping the location with the web service. The project when employed in
a demonstration responded quickly to the actions performed by the user and the external
variations but it was not efficient in terms of memory utilization. The framework could be
employed in any type of public building or infrastructure like schools, parking lots etc. The
project has provided a framework that could be scaled up or down as per requirement, if there is
a requirement to add more devices then they could be combined without difficulty. The project is
focused on aspects such as comfort of individuals, conservation of electricity and an
unambiguous web interface for people. For further work, the project plans to enhance the
framework for optimum usage of electricity in the environment and connect it with social media
platforms in order to get a better
understanding of a person and their preferences, reactions and evaluations.

11) The UbiComp Project

The project is part of another project named Dynamic Ambient Intelligent Systems Unit (DAISy)
and is basically a middleware solution providing interoperability and communication between
different smart objects and makes use of a sophisticated Graphical interface to accumulate them.
The work that was done in the GAS (Gadget ware Architectural Style) project has been extended
through the UbiComp project. As part of the distributed system, every smart object shall run the
middleware. The smart objects utilize the Interfaces which are a collection of functions to know
about the external conditions and environment. UbiComp provides services on the basis of
components, artifact which is regarded as a smart object, being the most significant component
of the UbiComp middleware. The artifacts possess processing, actuation, networking and sensing
capabilities. The middleware makes possible the deployment of UbiComp solutions and the
usage of wireless sensor and communication networks. The system was demonstrated in an
environment consisting of a smart objects like book, chair, lamp and desk.

12) The IoT-A Project

The IoT-A project describes and presents a general architecture for IoT based solutions,
developed by the IERC. This architecture can be treated as a reference and generalization of
previous work in the area. The architecture has different roles or functions separated and ordered
in different layers having a modular skeleton. The Management and Security modules are placed
on either side of the middleware layer which contains the Communication module (gateway)
responsible for interacting with the physical devices. The modules named IoT Service and
Service Organization serve the purpose of processing the interfaces and data into services. The
module named IoT Business Process Management is responsible for interacting with other
applications and providing services which can be integrated with business processes hence
increasing complexity. IoT services and data are bundled together by the Virtual Entity module
which acts as a virtualization mechanism and it also modifies the services and the data gathered
by using semantic models that convey a certain business logic. The IoT Information Model
which is part of the Virtual Entity
propels the virtualization and represents related ideas like actual data values, metadata, attributes
and descriptors etc. The Communication Module which interacts with the IoT Information Model
is responsible for allowing the different parts of the IoT-A architecture to provide proper
functionaity like for example networking of sensors, devices and data generated from systems,
also the interoperability between devices, services and resources is depicted semantically by the
Communication Module. Independent of the device responsible for hosting any particular
service, the 6LoWPAN technology is used for adressing each device or service. Protocol
technologies like Constrained Application Protocol (CoAP) can be used for managing issues
related to device addressing. This reference architecture has been used in other projects related to
networking and automation of premises as well as for enterprises in providing assistance in
business processes.

F
igure 1: IoT-A reference architecture
13) Service Oriented Architecture for Smart Environments

The project worked on a Service Oriented Architecture for smart environments. In the proposed
solution, the main objective was to satisfy the comfort of the user by distributing the information
to different portions of the system. The system built using the Service Oriented Architecture
approach ensured that the users were in complete control of the system and the system was still
capable of providing control of the appliances. The project demonstration of the smart office
built using the proposed solution was evaluated as expandable, flexible and reactive proving to
be another option for the management of buildings.

14) Real-time Information Profiling for Smart Objects

This project implements a mechanism that collects real-time data and build profiles of smart
objects allowing better communication and management of the smart objects. The prototype of
the project for testing was applied with the help of standard smart phone devices together with a
cross-platform framework and web based tools. The techniques used in the project on actual
situations and the outcomes from those tests reflect the useful and spontaneous nature of the
techniques employed in several environments. As part of further improvement strategy,
additional complicated assistive and analysis services would be incorporated with the existing
solution. Also, the project plans to incorporate control of devices to a small degree. This will
ensure that the commands and profiles set as desired by the users are dealt with a response by
smart objects hence refining the way communication occurs.

15) The MASBO Project

This software agent system named MASBO (Multi Agent System for Building control) was
designed by the University of Reading at UK. The MASBO applied software agents for
regulating the HVAC (Heating, Ventilation and Air Conditioning) system inside a home premise.
This project was based upon the ISES system architecture. The system employed various agent
categories, every single one was dedicated for a separate environment feature. A certain room
was supposed to be observed by Local Agent which served to be an intermediary amongst
opposing choices of an individual and presented him/her the data concerning the room. The
system also comprised of a Monitor and Control Agent in order to fix an environment in
correspondence with the choices of the Local Agent and for understanding and performing
operations on data from sensing devices as well as implementing services demanded by an
individual. The desired settings of an individual are absorbed by the Personal Agent (PA) through
automatic observation of exchanges between an
individual and the surroundings. The services demanded by an individual are dispatched by the
PA which also delivers responses to an individual. Rather than requiring continuous
reprogramming, the PA absorbs the desired settings automatically. The PA is also responsible for
supplying response that is decipherable by an individual and it is about their present electricity
consumption. Combining choices as well as linking with intramural and peripheral services
which the agents demand are the main roles of the Central Agent, which served to be a main
router for information in order to deliver to the agents which are part of the environment the
information that was demanded by them. The distinct characteristics of the MASBO was its
ability to absorb individual likings without human intervention. Moreover, the MASBO employs
intramural information demands which are created to be decipherable by people for giving a
clearly comprehensible response to an individual. The single emphasis of the system was HVAC
temperature parameters and it was a prototype rather than being a truly commercial product.

16) The SPOT Project

The project has developed and demonstrated a system for maintaining the thermal comfort of
office employees called SPOT using the smart environment concept. The project developed a
model for user comfort by enhancing ISO 7730 which aided in the development of a system
called SPOT that manages HVAC parameters to provide comfort for the inhabitant. The project
integrates three concepts: The numerical value of individual comfort is determined from the
modification of the PMV model called the PPV model, the individual comfort of an employee is
predicted by sensing the parameters of the PPV model, PPV settings are kept consistent on the
basis of detecting the presence of an individual and responding accordingly regardless of
modifications in the surroundings. The project employed extensive sensing to achieve their goals
of providing individual comfort. The solution claims to set up a limited version for sustaining
customized thermal comfort of an entire building with ease and promises conservation of
electricity. The project was used in a real life scenario to test for its ability of providing each
individual with their desired preferences correctly regardless of the changes in the external
surroundings and reaching a tradeoff between conservation and desires. The project was
developed with certain assumptions
in mind:
1. Every room is separate from the other and so there it is believed that there will be no thermal
exchange however it is not practical because offices could be constructed differently like
open-plan.
2. Every employee is assumed to be confined to a single limited area for work and there is little
or no mobility between places from time to time however in reality there could be work
places where employees use multiple offices and work in multiple roles.

17) Cloud based Framework for IoT

The project makers presented an expandable cloud based framework in order to make the most
of IoT while also considering the required suppleness to cater for different opposing desires of
stakeholders. The capabilities of the framework include processing, storing, networking and
presentation which are discrete hence enabling individual progress of each section. However
they are all supplementing organs of the framework because they are using a common
environment. Since the Cloud is the focus of the whole system the adjustments of every single
idea wont be negatively impacted. There are quite a few relevant issues emphasized by the novel
Framework like proper presentation and clarification of huge quantity of data, confidentiality,
safety, and administration of data for strengthening the platform so that it is realistically feasible.

1.5 Initiatives and efforts around the Globe

Numerous work in IoT all over the globe reflects that this technology is trending, different
sectors of the society like government, academics and industry are committed to stepping
forward in the IoT domain, so that important stakeholders chalk out a plan to combine efforts
unleashing this technological innovation. Great work is being done by European bodies
dedicated for IoT research combining interdisciplinary areas of study involving WSNs, RFID
and M2M for the establishment of a single standard framework in IoT. The European
Commission 7th Framework program (EU-FP7) is the driving force behind these initiatives and it
also backs the Internet of Things European Research Cluster (IERC). The IERC embodies
projects entrusted by the EU FP7 and is aiming at setting a direction for future research in the
IoT domain as well as taking the role of a central body
for coordination of work in IoT for Europe and the rest of the world. As part of one of the
projects named CASAGRAS2 under the IERC, a group of people from different regions
including Europe, USA, Japan, Korea and China are investigating about the disadvantages and
potential of RFID with regard to its usage in the IoT. The IoT-A reference architecture is another
project under the IERC which was developed as a standard architecture for IoT applications so
that the system as a whole can interact, respond and communicate efficiently. For the purpose of
aiding the progress of the IoT community in Europe, IoT Initiative (IoT-i) emerged with the help
of an organized plan around the same period as IERC. A group of members are cooperating
under the IoT-i project for drafting a unified technical and tactical plan for the realization of IoT
in Europe which will fully integrate all the disjointed areas of IoT. At the same time, an
implementation of a smart city project named Smart Santander is being constructed in Santander,
Spain with other deployments at Germany, Serbia, Australia and UK aiming at research and
delivery of services. Also, there are other substantial activities that have started simultaneously in
USA, Australia, japan and Korea, allowing for exchanges between the government, industry and
related bodies for different programs that are crucial for the development of technologies
necessary for the realization of the IoT vision; such projects covering a wider audience are smart
city and smart grid infrastructures which embody the development of smart metering and
widespread adoption of super-fast broadband internet. The Auto-ID lab which was originally
established at the MIT together with the use of satellite to establish further such labs at top
tertiary educational institutes of UK, Korea, Switzerland, Australia, Japan and China is a result of
the commitment by different groups and industries towards the constant advancement of
technologies linked with RFID and implementation of IoT with the help of WSNs and RFID. The
creation of a new protocol called the Internet Protocol for Smart Objects (IPSO) is an outcome of
the necessity for agreement about the technical aspects of IoT. The partnership and cooperation
between 60 top commercial organizations belonging to IT, energy and communication sectors
and organizations like IEEE, ITU and IETF which maintain standards is bringing forward the
idea to devise applications utilizing the Internet Protocol and endorsing agreement between
industrial organizations on compiling IoT components. There are also a lot of IoT related events
happening in China where they have enunciated a plan for the years 2011 to 2015. As part of this
plan, the money will be
spent in the following arenas of IoT applications: smart home, smart grid, smart transportation
and logistics, finance and services, smart agriculture, industrial control and automation,
environmental monitoring and safety testing, healthcare, and defense. Along with this
expenditure there is also a center for IoT worth US $100 million which is to be set up in the city
of Shanghai for the purpose of educating about standards used in industry and the existing
technologies. The main industrial contributors comprising of institutes, commercial organizations
and telecom companies have enabled the establishment of a deposit by industry for IoT and an
IoT Union named Sensing China in Wuxi.

1.6 Motivation

The reason behind our project was that a lot of time is wasted in turning on electronic appliances
suited and to attune them according to our needs and desires. Also, every person has their own
preferences concerning the environment in which they harbor. We also believe that other
solutions that exist in literature are complicated and difficult to implement at a commercial level
so we wanted to develop a simplified implementation of a smart environment.

1.7 Objectives

We aimed at diving into the Internet of Things paradigm in order to add intelligence to devices
within an office environment because it is an emerging area of research and development and is
also one of the top technological trends in the world currently. We also wanted to develop
profiles for individual employees so they can utilize that profile to adjust the office environment
parameters for their comfort considering different timings of the day as well for electricity
consumption. Moreover, we also aimed at ensuring that employees are recognized and
authenticated so that the right person adjusts their settings.

1.8 Report Structure and Organization

This Report is organized in the following manner: Chapter 1 begins with the background and
gives
an introduction to the world of Internet of Things and then presents the related projects in this
area along with international initiatives taken by various countries for the Internet of Things
followed by our motivation and objectives about the project that we have made. Chapter 2
presents the literature review stating the different aiding technologies, protocols and overlapping
areas of the IoT as well as its applications in different domains, the chapter ends with the
challenges and difficulties faced in implementing IoT. Chapter 3 focuses on the requirements of
the developed system that we have implemented as our Final Year Project including both
Functional as well as Non-functional requirements. Chapter 4 describes the software and
hardware components used in the Project with detail, their specifications and features and the
necessary background about the employed technologies. Chapter 5 gives a pictorial
representation of the control flow and architecture of the developed system. Chapter 6 describes
how we have implemented the Project along with pictures of the networked hardware and
software system. Chapter 7 concludes the report and project and gives a list of areas where
improvement could be made.
CHAPTER 2:

LITERATURE REVIEW

2.1 Desired System Characteristics

In order to measure the impact of the system on the environment, it is vital to be aware of the
associated environment as well as considering the possibility of automatically accomplishing
different tasks. Maintaining an equilibrium among provision of necessary help when the occasion
is appropriate and simultaneously recognizing the need to be non-intrusive is essential for a
system. To be a truly rational system, it must be adept of acquiring and absorbing individual
choices, identifying individuals, and understanding individual dispositions as well as the
complete existing condition. Each individual likes a distinct chosen method of communication, it
is influenced by various factors like reasoning and bodily strengths or learning and training. It is
essential to have a fine equilibrium between the mentioned rules so that the technology is
extensively adopted. In order to transform artificial systems into suitable mates, they must
become proficient with fine expertise which characterizes flourishing personal assistants. There
are certain important characteristics that each Smart Environment must possess, these
characteristics then define Smart Environments. These characteristics are discussed below:
1) Unambiguity: This characteristic refers to the ease with which a user can use the system
without falling into any complexities and problems with the system and be at the same level of
ease when he was not using the system to control the appliances settings.
2) It is able to assist the user in a personal manner: The main purpose of such a system is to
give the user as much comfort as possible and with his own desires being fully implemented as
quickly as possible so that it acts as a personal assistant in some way. The system will have
preferences that the user can customize himself. Any environment that is regarded as smart must
be able to automate certain tasks within the space that it is deployed. A Smart Environment must
be capable of taking initiatives and incessantly deciding about assisting the inhabitants of the
environment. Individuals must be helped in different ways by the system so that they are
successfully involved with the system. At times it is very challenging to appropriately recognize
the moment assistance is required because there is immense reliance on sensing devices to
deliver the gathered data from which meaning is extracted about the individual. Also, before
offering any assistance, the system must identify if there is a need for assisting an individual, it
must also rationally determine if it is permitted to provide assistance to an individual, it must
provide assistance based on individual choices and requirements, and optionally it can
accomplish its objectives of providing comfort and assistance exclusive of the expert wisdom of
an individual.
3) User centric control: The user will operate the system whenever he wants and it would not be
the other way around that the system operates in a way that is unpleasant to the user so the user
will make the choices when and how he wants the system and appliances to be set. Any
environment that is regarded as smart must be able to identify individual users and allow them to
control the environment with the help of certain services and based on the preferences that are set
by the user. In providing support, the system must not overpower the individual, it must not
provide aid incorrectly, it must not provide aid untimely or in a manner the individual would not
appreciate otherwise an individual would be dissatisfied with the system and remove it. At all
times, an individual must be in charge of the system as it is a central rule that must be followed.
Moreover, the individual must make the final decision about refusing or accepting the systems
recommendations, enforcing desired choices, nullifying prior choices and activities performed by
the system, as well as detaching it if he/she feels more comfortable without it. This characteristic
highlights the fact that the individual is the authority while the system only follows and not
otherwise.
4) Interaction between user and the system: The user is able to communicate with the system
through the choices he makes on the web interface and so the system performs the necessary
actions in accordance with the desire of the user. This type of interaction is one way of
interacting. If the user inputs a wrong value or an unacceptable value the system prevents the
user and prompts
him to give another value, thus the system interacts with the user in a bidirectional way.
5) The system should be scalable: The system should be scalable. The system should be
designed and deployed in such a way that if it has to change in a certain way in accordance with
the requirements of the user it is capable of adapting to that change. The change could be in the
number of devices or appliances that are controlled by the system or it could be even a change in
the parameters of the devices already involved with the system or it could be the adding of
additional services provided by the system.
6) The system must protect individual privacy: There is a diversity in the mindsets of people
about privacy however, it is considered to be a delicate matter by a majority of individuals
therefore caution must be taken to manage it, and furthermore the system must be applied
supposing that privacy is precious to individuals authorizing them to configure their privacy
settings through the system.
7) The system must give importance to safety of individuals: The system must be safe and
secure because its main objective is to provide help to individuals, if the system is unsuccessful
in safeguarding the people then it would be considered ineffectual and useless.
8) The system should be independent: The independence of systems is essential because they
are anticipated to be as such except if their independence hinders important rules such as privacy
or security. With the help of prior encounters, the system must update its knowledge. Also, the
smart system must be capable of adjusting with changes in the environment avoiding the need of
constant programming.
9) The system must be invisibly interwoven in the environment: It is required that such
systems are inconspicuously engrossed within the surroundings inhabited regularly by people;
the surroundings and the individuals shall not modify their vital communications and actions for
the establishment of the system.

2.2 Different types of individual Preferences

Thermal: The Thermal preference indicates the temperature level with which the user is
comfortable inside the smart office environment, there is also an ANSI standard for the thermal
comfort. The maintenance of this temperature level for the user of the office is one of the main
goals of the smart office environment. The models present in literature for controlling the
thermal preferences interact with the user constantly and control the temperature levels by taking
into account the temperature of the clothing or by opening or closing the window. Therefore
controlling the thermal preferences involves controlling the temperature and humidity in an
adaptive way.
Visual: The visual preference of an individual user here refers to the amount of light or light
intensity that he or she would like to set in order to make sure that everything is visible in a
comfortable way and if a user is working inside the office he could adjust that visual setting by
varying the intensity of light or by opening or closing the blinds. The variance in the visual
preference depends on the comfort level of each user and also on the outside environment
varying from sunny days to cloudy or foggy days. Also, there will be differences in the visual
preferences with respect to day and night time as well as when it is summer season to when it is
winters.

2.3 Goals of a Smart Office Environment

A Smart Office solution can aim at conserving energy by ensuring optimum use of electronic
devices, appliances and other room objects. In trying to achieve this objective, the environment
of the Smart Office can provide assistance with business processes like scheduled task,
reminders of project related achievements and progress, etc. Moreover, it may also be capable of
providing the employees the facility to create a customary profile of their preferences for
parameters like light, humidity, temperature etc.

2.4 Technologies making IoT viable

Progress in the Smart Environments domain has been possible because of growth and
accomplishments reached in other popular and linked disciplines within Computer Science. The
role played by these relevant disciplines for the fulfillment of Smart Environments is elaborated
in this section:
1. The computation abilities of processors and other hardware have enhanced but their sizes
have shrunk providing improved functioning, dependability, and storing capacity
2. The availability of several dependable protocols for wireless networking that can be easily
implemented with the help of the necessary setup.
3. The extensive consumption of data from various sources such as pictures taken by cameras,
RFID tags, coordinates of geographical location through GPS, and profiles of individuals
created, managed and saved in social networks, as well as the mining of useful information to
identify actions and forecast the purpose, and the organization and abundance of technologies
like semantic web have resulted in a huge quantity of accessible information.
4. There has been a progress towards nascent areas in software including social networking,
smart grid, cloud computing, web 2.0, relevant middleware layer to provide interoperability
between different types of devices, and other technologies that are needed for production of
software solutions.
5. It is now feasible to utilize Artificial Intelligence, give a correct depiction of the environment,
make adjustments to the actions being performed and have access to the data regarding
pervasive environment.
6. With the maturity of disciplines like Human Computer Interaction, instinctive interfaces are
emerging which rely on motions of the organs, symbols, speech recognition as well as human
feelings creating the possibility of a straight brain-computer interface.

2.4.1 Sensors and Actuators

An extensive collection of sensing devices having different functionalities is available for the
quantification of numerous quantities such as:
1. Temperature
2. Force
3. Biometric data
4. Pressure
5. Location
6. Path
7. Luminous intensity
8. Solids
9. Radioactivity
10. Fluids
11. Auditory data
12. Distance
13. Pictures
14. Motion
These sensing devices supply an array of diverse data values covering Boolean data, numbers
and fractional values like weight and temperature, as well as data values from surveillance and
identification like auditory data, videos, hand impressions and images. As of now, sensing
devices can only be linked through unplanned/informal means for a particular purpose and there
is a lack of a standard methodology to blend them within a location to provide a certain solution.
2.4.2 Middleware and Networking

In order to comprehend about the present condition of a location, a range of sensing devices are
spread within that location. The data gathered using the sensing devices is directed towards a
central system via a network which could either be wired or wireless. There are certain initial
problems posed by following this procedure for the designers of the system:
1. Instantaneous fusion of a bulk of information
2. Managing degraded and partial information gathered by faulty sensing devices
3. Providing valuable information for the upper layers of the system
4. Controlling a plethora of sensing devices and other connected appliances
A layer of software named middleware is responsible for resolving the stated issues and
additional ones as well as processing the influx of information amassed by sensing devices for
increasing its utility for upper layers of the system. The middleware also deals with another
crucial function of simplifying the ability of the system to work as a whole by assisting system
components such as the network and devices manufactured by uncommon vendors so that the
components could recognize and communicate with one another and create a comprehensible
interpretation for the higher system stages. Plenty of effort is required even now for the
establishment of a middleware that is commonly acceptable in order to bring the technology to a
level that it is universally
implemented by the people and prepare an advantageous middleware.

2.4.3 Ubiquitous and Pervasive Computing

The focus of this concept of Computer Science is the scattering of a diversity of devices which
occasionally possess limited processing power. The Ubiquitous/Pervasive Computing concept
investigates about creating systems that deviate from traditional computing devices such as
desktop computers and reinforces moving in the direction of individual-centric portable
computing technology which will be evidently present throughout various real places. The
concept belongs in the category of computing that concentrates on humans. Also, it stresses on
the importance of ideas such as Context-awareness which can be defined as the potential
possessed by a system for determining the present state of an environment, maintaining the
imprints about the progress of the environment, and linking the information to system
components responsible for delivering pre-emptive responses.

2.4.4 Protocols

For IoT to be truly viable, the sensing layer protocols are crucial because it is their responsibility
to transfer the data from the sensing devices to the external environment and vice versa. There is
a need to use protocols that utilize less energy like the MAC and routing protocols so that the
system functions smoothly and properly. Plenty of applications use MAC protocols having
different characteristics like collision free (TDMA), low traffic efficiency (CSMA) and those that
require more circuits for nodes (FDMA) but no single one of these is commonly adopted as a
result the availability of additional ones will only make it more complicated and thus pushing for
more research into it. To cope up with the nodes falling out, it is important that the network is
able to adapt accordingly and is capable of routing via different routes. Terrestrial WSN and
mobile networks employ multi-hop routing protocols which are grouped according to their usage
in various applications: hierarchical, focusing on data, and on the basis of location. For those
protocols currently used for routing, energy needs must be taken into account. A practical IoT
implementation will have finite number of hops and the backbone would be accessible therefore
the currently available protocols for routing will be adequate if they are used after making small
changes.

2.5 Important metrics of Smart Environments

The supporting technologies that are prevalent are part of the technical layer for the IoT. The
birth of pervasive computing is supposed as the next generation of computing innovation since
there is a shift towards the use of portable computers leaving behind larger computers. Along
with this trend, there are now several portable computers possessed and operated by a single
individual, instead of several individuals operating a single computer. The area of Smart
Environments needs a multifaceted methodology since it is an outcome of progress in various
disciplines:
1. Magnitude: Smart Environments are estimated to be comprising of heaps of interconnected
computing elements therefore it requires the use of standards such as IEEE 1451 and IPv6 so
that there is widespread acceptance.
2. Size: The involved devices will rapidly shrink into such a tiny size that they will be
unnoticeable like a particle in size.
3. Functioning: Even though there are problems regarding harmonization, administration and
dissimilarity, the overall functionality of the system and different devices are improving.
4. Information: There is a humungous quantity of data that exists for storing, computation and
communication however the quantity of information that is obtainable for computation,
communication and retrieval is also expanding swiftly heading towards a fresh period of
Artificial Intelligence.
5. Pro-activeness: Devices are now steadily changing from being responsive to pre-emptive
and then being intelligent.
6. Reliability: It reflects the steady rise in belief that users are expressing towards this
technological innovation which is an essential ingredient for its acceptance because the
highly dispersed systems are independent and reliable.

2.6 User adoption of IoT related Technologies

For any technology to become a daily part of the lives of people it is necessary that they are
comfortable with that technology and are prepared to adopt it in any way. Also it must be
unobtrusive to the people. There is ample evidence available that suggests that users would be
comfortable with IoT because there is a widespread use of technologies that are related with IoT.
People are using technologies linked with IoT which suggests that they are accustomed to having
it in their daily lives. There may be worries however considering secrecy and confidentiality of
data. A few elements of the IoT technology like cameras, sensing devices, smart phones, social
networks and cloud storage platforms have achieved popularity and financial rewards and there
is constant money flowing into these technologies because of government and private
organizations taking more interest. While considering the reaction of the users to the technology,
its influence on different segments of people must also be taken into account like entertainment,
jobs, healthcare, environment, energy resources, agriculture, and education as well as other novel
roles like semantic engineer, smart home engineer, ambient assisted living expert etc.

2.7 Applications of IoT

There is great potential in the development of feasible products related to Smart Environments
and Ambient Intelligence and there is immense belief and anticipation about the field in the time
ahead in which there might be a variety of different products accessible for daily use. The IoT
evolution is expected to affect a lot of areas and walk of life. These areas can be categorized on
the basis of area of coverage, size, type of network, variation, the effect on the end user and
repeatability. The areas of applications of IoT are namely:
(I) Personal and Home
(II) Enterprise
(III) Utilities
(IV) Transportation
The category of Personal and Home relates to the use at the level of a single person or a house,
the Enterprise category is at the level of a larger group of people like town, city or any other
community, the category of Utility is for the level of a nation or region, and the Mobile category
is mixed with the other three categories because of the size and range of usage.

2.7.1 Home and Personal Level IoT Applications

In these applications the gathered data produced by the sensing devices is intended for use by a
single person. Since Wi-Fi is part of most households now, it is commonly employed as
backbone for the transmission of data of a higher bandwidth and for greater sampling rates. The
vision of Ubiquitous healthcare was conceptualized 20 years ago and has gone under
development since then. Body area network of sensors and backend technologies which aid in
uploading data contribute to the substantiation of the Ubiquitous healthcare vision through IoT.
As an example, sensing devices used for collecting physiological data are interfaced using
Bluetooth technology and can interact with the Smartphone. Different OS platforms are
providing plentiful apps for gauging different body parameters. There is still a need to deliver
this data to the physician through some centralization mechanism. One application in this domain
involves the development of a monitoring system, an enhancement of a PAN that enables the
doctor to maintain a watch over old people and the diseased inside the premises in which they
live so that the expenses of hospitalization can be curtailed with the help of remote cure and
prevention. Optimum usage, monitoring and actuation of electronic appliances like fans, light
bulbs, TV etc. within the home environment ensures efficient management of electricity
resources. In this way, the users will feel part and parcel of the system and the IoT the same way
they were part of the Internet. It is expected that there will be a change in the way social
networks are used as the number of networked devices increases exponentially. As an example,
networked devices inside a premise may be able to tweet measurements on specified intervals
that could be accessed from any place having access to the Internet. It is essential to provide a
secure method to implement this despite the availability of a central information source like the
cloud. The quality of facilities provided at hospitals could be refined by observing a persons
condition and improvement with the help of mechanized scrutiny of individual behaviors inside
allotted rooms. At hospitals greater protection could be achieved by permitting merely the
hospital staff and the deceased to enter and use certain equipment and zones within the hospital.
Telecare and telehealth facilities collectively named Ambient Assisted Living could be utilized to
aid in the devolution of healthcare services by making them available in households.
Entertainment plays a significant role in daily activities. In order to amuse people of various
backgrounds and age groups, several residences presently encompass numerous gadgets.
Moreover, complex gaming could be extremely improved with the use of equipment that is
capable of involving the gamer into the game environment to a greater extent which is
imperative for contemporary gamers.
Figure 2: A picture highlighting different applications of IoT

2.7.2 IoT Applications at the Enterprise Level

The Enterprise category comprises of the set of applications that are employed within a work or
office scenario. These applications ensure that the gathered data is utilized by the correct user
and the older data is disposed of. One of the initial and popular usage of IoT in this domain
involves the monitoring of an Environment for keeping check of the inhabitants present and for
the manipulation of different devices and resources at disposal for optimum usage and energy
savings. The factory setup comprises of the inseparable sensing devices to perform various
functions for climate control, security, etc. The use of wireless technology will enhance the
system enabling the necessary modification to the setup. This IoT subnet serves the purpose of
maintaining the factory. The Smart Environment is currently the popular application area of the
IoT and is gaining interests among people. A lot of prototypes of Smart Environments have been
deployed and plenty of them would be deployed in the future. A Smart Environment comprises
of many subsystem or smaller
systems. Some other areas of Enterprise applications relate to healthcare, transport, productivity,
pollution, and services delivered to the people by local governments. IoT can also be applied in
the education sector by converting ordinary classrooms or labs into smart places so that there is
an improvement in the way concepts are taught to students, moreover this will also assist the
teachers in their profession. Also related to enterprise applications, RFID devices could be
employed labelling various items in order to trace the location from manufacturing to selling of
the items. Such usage of RFID will enable the detection of route taken by the various items
between manufacturer and customer additionally it will assist in refining procedures by
delivering useful data to an enterprise about the most required items and the necessary
procedures that must be undertaken to fulfil the requirement of customers as well as notifying
about items which are not popular and hence are not bought by the customers. Another
application which is part of enterprise category is Smart Offices, these Smart Offices are
becoming increasingly popular and certain fascinating suggestions involve providing methods to
support workers in performing routine duties proficiently at workplaces. Research is underway
for the establishment of next generation superstores so that items will be able to swap as a result
of aural and graphical data about their features coming from a consumer, this will explain about
the passage of an item when it is with the consumer through symbols communicated from
consumers to the place where the item rests.

2.7.3 IoT applications for Utilities

In this area of IoT applications, the data that is produced is utilized by those who provide
services and not intended for individual users, so that the services are efficiently utilized. In
practice the technology is currently employed for smart metering for better utilization of
electricity resources and higher profits. Such applications demand a multitude of large networks
spanning an entire country or state in order to track the usage of utility resources and allow for
their better management by utility companies. Wi-Fi, cellular networks and satellites can be part
of the main network in such applications. Applications such as smart metering and smart grid
infrastructure are gaining worldwide acceptance and offer tremendous opportunity. In order to
save energy, all areas of a premise can be tracked for the amount of energy used and then
implement a usage policy with the help of this data for better utilization of energy. Inside a smart
grid infrastructure, the data
regarding energy usage for the whole city enables balancing of load for providing better services.
Another possible IoT application area in this domain could be Video based. This could merge
networking technologies, computer vision and digital processing of images creating an emerging
research paradigm which will incorporate infrared, Bluetooth, microphones, networks and
videos, etc. The prevalent camera over IP application is surveillance which assists in recognizing
suspects, tracing targets, identifying isolated luggage and preventing intrusion by disallowed
people. Applications such as event prediction and automatic gesture analysis are just starting out
but much development is forecasted in the near future. IoT has also found usage in the
maintenance of water resources and their quality by keeping check of water content and
deploying a network of sensors for gauging different characteristics of water on critical
junctures; Theses measures ensures that water for consumption is safe from mixing with sewage
or storm water drains by accident. These kind of networks made up of sensors can also be
employed for irrigation monitoring and checking of soil characteristics ensuring that decisions
regarding agriculture are taken judiciously. The highly noticeable initial specimens publicized as
Smart Environment applications were smart homes whose main purpose is to assist inhabitants
of the residence in controlling illumination and heat parameters without human intervention
inside the residence. This promotion of smart homes suggested that it will be able to deliver an
optimized usage of the involved resources.

2.7.4 IoT applications in the Transportation Domain

Because of the way data and backbone are used in smart transportation and logistics, applications
relating to them are discussed in a different heading. Noise and air pollution and spread of
greenhouse gases is mainly due to the traffic of urban areas. In urban areas, the overcrowding of
vehicles increases the expenses of social and economic activities. Such overcrowded vehicles
affect manufacturing and supply chains resulting in inability to deliver on time and freights being
late. If there is availability of real-time data about traffic then it would allow for enhanced freight
mobility and timely implementation of plans and schedules. The application of IoT in the
transport domain would be made up of WSNs spanning greater geographical area in order to
keep check of decisions regarding paths taken between origin and destination, travelling times,
air and noise pollution, and the number of vehicles in a queue through a browser. The IoT in the
transportation
domain will be used instead of the current informing mechanism of sensors like the inductive
loop vehicle detectors on current traffic control signals. Different models of use cases will be
considered for the creation of traffic lifting plans, also algorithms will be refined to enhance the
control of traffic in urban areas. Also, people will be able to gain access to desired information
about traffic with the help of data from traffic control signals. The presence of IoT in our lives is
evident from the widespread use of Bluetooth enabled digital devices like navigation systems,
smart phones, hands-free set in vehicles etc. Devices that use Bluetooth technology transmit
MAC-ID through signals which the Bluetooth sensors can detect over a particular range. The
Bluetooth sensors spread over an area are capable of tracking the devices motion. With the use
of data from traffic signals and GPS, it is possible to solve issues like determining the time taken
during the journey when moving through the motorways and narrow streets, real-time
information about the origin to destination coordinates through the network, recognition of
important intersections, and precise and timely delivery of information about the condition of
transportation. In these sort of applications privacy of users is a major problem. To address this
issue, researchers in IoT are focusing on the concept of digital forgetting. IoT in the field of
transport can also be used for better management of logistics by implementing a better plan for
vehicle transport and keeping check of all the goods that are to be moved. The checking of goods
is done locally whereas a bigger network of IoT is responsible for handling transportation details.
Presently, technologies such as GPS, image processing, vehicle recognition, satellite
communication etc. are being employed to facilitate the smoothness in transport as well as
rendering it secure and effectual. Application of IoT in the transport sector is becoming evident
from the introduction of Smart Vehicles and Smart Road Network infrastructure including the
birth of concept like vehicle to vehicle and vehicle to infrastructure communication.
Table 2: Areas of application of smart environment

Smart Smart Smart Smart Smart


home/o city agriculture/ water
transport
ffice forest
ation
Network Small Medium Medium/large Large Large
Size

Users Very few, Many, Few, Few, Large,


family policy landowners government general
members makers, public
Energy Recharge Recharge Energy Energy Rechargeab
able able harvesting harvesting le battery,
battery battery, energy
energy harvesting
harvestin
g
Internet Wi-Fi, 3G, Wi-Fi, 3G, Wi-Fi, Satellite Wi-Fi,
connecti 4G LTE 4G LTE satellite communica satellite
vity backbone backbone communicati tion, communica
on microwave tion
links
Data Local Shared Local server, Shared Shared
manage server server shared server server server
ment
Table 3: Potential IoT applications identified by different focus groups

Citizens
Triage, patient monitoring, personnel
Healthcare monitoring.

Remote personnel monitoring


Emergency Services (health, location); resource
and Defence management and distribution.

Crowd flow monitoring for


Crowd monitoring emergency management; efficient
use of public and retail spaces.

Transport
Intelligent transportation through
Traffic management real-time traffic information and path
optimization.

Sensors built into infrastructure to


Infrastructure monitor structural fatigue and other
monitoring maintenance.

Services
Water quality, leakage, usage,
Water distribution, waste management.

Temperature, humidity control,


Building activity monitoring for energy usage
management management, D heating, Ventilation
and Air Conditioning (HVAC)
Figure 3: Roadmap of key technological developments

2.8 Short Comings and Challenges of a Smart Environment

Within the last ten years, the field of Smart Environments and IoT has gained a lot of attention,
work and investment. Nevertheless, difficulties linked to technical organization constraints as
well as their connection with numerous individuals who are expected to be helped is substantial.
In this section, various shortcomings, challenges, difficulties and limitations are discussed. It is a
difficult task to design a system that takes into account all users and their preferences so that all
of them feel comfortable inside the automated space under all conditions and factors because all
of the users will have differences in their preferences with regard to what is comfortable for each
one of them. Since different interconnected devices follow different standards of communication,
it is quite challenging to construct a smart environment system and deploy it. Also, for the
construction of a smart environment solution in the IoT domain the system that is developed
should be flexible
and scalable which is capable of adapting and has such devices in the network that can easily
adapt and has a robust network of interconnected devices, a standard middleware that provides
services and open interfaces. The smart office solution shall be capable of providing services to a
variety of offices and businesses with the help of evaluation and monitoring of office employees.
The focus of Smart Environments are individuals therefore the Smart Environments domain
intersects with work in User-Focused Computation. Regardless of the age of individuals, their
scholastic qualifications, and more significantly their familiarity with Information Technology,
the system must provide assistance to individuals. The stated viewpoint is conflicting to the
prevalent viewpoint in this domain which states that sheer buildup of technology can overpower
individuals. Before inducting technology, it must be ensured that it is thoughtful of the individual
and accepts the rule: control must be in the hands of individuals. The accentuation of such rules
since the start stresses upon the value of being low-profile and clear for the realization of certain
services. Additionally, it is appropriate to distinguish System-Oriented or Persistent Smartness, in
which the system enforces choices such as a smart refrigerator bringing food items unreasonably,
from People-Oriented or Aiding Smartness in which the system can only make recommendations
such as a smart refrigerator informing about available food items matching the contents of the
refrigerator. Another challenge in the Smart Environments area is that it has to be cognizant and
perceptive of several individuals present in the same location. If there are several people within
the same location then they can either harmonize, communicate, collaborate, or contradict with
each other and have a diverse set of preferences and likings. In order to manage the unanticipated
consumption of the system by individuals as well as the intensity and unevenness of their regular
actions, the system should be flexible and robust. There is great variation in the areas the smart
environment systems may be installed. The locations where such systems are applicable range
from bounded premises that have a definitive structure and limits to places that are exposed
locations with no explicit limitations. These locations are approximately outlined with the help of
geographical coverage to which the sensing devices can detect. Premises which could be
categorized under the bounded category include offices, classrooms, homes, vehicles and
hospitals. Exposed locations may include the following places: sea for determination of
contamination of sea water or for initial tsunami alerting system, fields relevant to agriculture,
streets, car parking lots for observation purposes, air utilized by airplanes and bridges. Generally,
such exposed locations can be characterized as random, complicated, fertile, shapeless, at times
constantly fluctuating and boisterous. Smart Environments are implanted within a space where
they must operate. The capacity and characteristics of a systems sensing proficiency determines
its conception about the environment. This conception depends upon the number of sensors
attached with the network in contemporary systems. The network of sensors notifies about the
actual depiction of the environment however sometimes it develops a broader view of the
perceived environment. The group of connected sensors enormously influences a Smart
Environment. Intelligent software agents which are central to the Smart Environment establish
their judgements largely relying upon the observed existing state constituting of the apparent,
instantaneous representation available via the sensing devices. In the absence of an individual,
sensing devices facilitate the system in picturizing the occurrences that take place inside an
environment. However, there are doubts with regard to the correctness and value of the observed
depiction communicated by sensing devices. Very frequently, the correct interpretation about the
basic features of an environment requires the amalgamation of numerous sensing devices. The
real challenge is to fulfil the objectives for which the system was designed and at the same time
reducing the expenditure and sophistication of the system. Data can also be collected through
more vivid input methods such as a collection consisting of video cameras spread across a
premise at several spots or may be a group of mobile cameras or additional sensors navigating
within a premise supplying instantaneous interpretation about a constantly changing environment
which is analogous to an observation made by an individual. Nevertheless, even such an
endeavor would be expensive and will demand additional processing power for managing such
intense and heavy data inputs, reasonable to only a limited number of people and in spite of
persistent growth in the field is yet unattainable for general public. Simultaneously, as the
information obtained per unit time by the sensors gets heavier and intense the system becomes
increasingly avoidable and intrusive with regard to privacy. The occupant of a Smart
Environment is expected to be aided by the choices which it renders. Such choices should
logically consider the present context of the environment. In technical terms, the word context
might denote linkage between the devices within the network, communication expenses, and the
obtainability of resources. The context of an
individual might comprise of his/her gender, choices, behaviors, demographic, existing position,
job, and marital status under a single profile. In-house parameters like illumination and heat
intensity together with the present condition of the external surroundings might be obtained
under the environment context. Moreover, another significant type of context is the time context
which comprises of hour of the day, day of the week, season and year. In order to adjust the
existing condition, diverse data sources comprising of stored behavior patterns, position of an
individual, and data from social networks can be merged by a Smart Environment to construct
and employ the circumstantial representation about the state so that the Smart Environment could
analyze and operate accordingly. Although, a critical part of Smart Environments is the use of
knowledge about the situation in order to deliver accurate results and assistance, one threating
problem involves concentrating towards a limited perception of the actual representation of an
environment. Distinct data sources may be coalesced to form a succinct, serviceable
circumstantial depiction by employing methods to merge the data generated by sensing devices.
On all communal ranks: singular, societal group, or public, a varying situation must trigger the
modification of a Smart Environment. Smart Environments manage a substantial quantity of data
as well as extremely complicated scenarios. Consequently, the Smart Environments are required
to execute choices on the footing of deficient, partial and deteriorated collection of data. There
are differences between the likings of individuals, like for example about food, fun, and internal
situation of the premise, and their necessities like for example timetables and medication that
differentiates them and there is at times variation among the likings and necessities because of
unexpected situations like weather or the choices made by an individual such as if there is a
necessity of becoming flatter. It is unfeasible to conceive a separate system every time for a
different individual informally. Conversely, the design of a universal system for Smart
Environments may not obviously tackle peculiar likings and necessities concerning separate
individuals completely. The most suitable solution could be to construct an all-purpose system
and later allow for its customization. Preferably, the system must be capable of learning so that it
could assist an individual more efficiently. The critical obstacle which is yet to be overcome
nonetheless is to equip the system with functionalities such as identification, absorption and
revision of likings and necessities continuously. In linkage with the issues discussed previously,
there is a problem regarding the
system acquiring the latest knowledge about the likings and necessities of an individual at a
particular instant. Certain individuals might not feel eager about communicating with the system
through the keyboard or another input device for clearly signifying about the existing condition
which may recommend not to intervene or which may appreciate the offers provided by the
system. There is a lack of a methodology through which the system could comprehend about the
present disposition of an individual who may be in an approachable or reclusive disposition.
There lies a question that is it possible to determine the existing mood of an individual through
the monitoring of actions executed recently, the manner in which those actions are executed like
banging the gate, data from biometrics such as sweating or beat measured with the help of a
watch or the calculation of an ECG using a shirt, as well as the recording of bodily gestures
using digital cameras concentrating at facial expressions. Until now each of the research areas
covering the mentioned questions is conveying a certain degree of feat regarding attainment of
particular technological objectives however, these objectives are still to be completely and
methodically employed in order to ensure its beneficial usage in the discipline and businesses. In
order to manufacture dependable and inexpensive systems that are able to assist an individual,
there is a need to involve more than a single individual without which it would be more
problematic. The progress that is currently going on is evident from a few improvements that
have occurred as well as specific models which are implemented and presently they are being
analyzed nevertheless there is still need for further progress. It becomes increasingly problematic
as the system tries to provide discerned assistances for multiple individuals cohabiting a specific
location. Always recognizing every individual cohabitant is the initial difficulty. The separate
recognition of every individual increases the expenditures and complications in designing a
recognition system using the exiting technology. There is an option that an individual can carry
an identification label such as RFID tags detectable by RFID sensors in close proximity of
important junctures within a premise. The use of such an option suggests that the sensors capable
of detecting the tags have to be deployed throughout the premise so that the exact location of an
individual is obtained and the system is able to offer beneficial assistance to an individual in
correspondence with the situation such as time of the day or the position. There is however a
drawback of such a strategy because every individual might mix up different tags consequently
the system will provide assistance to some other individual
instead of the correct one. Some additional options which are available include identification
based on appearance with the use of cameras however this too has its drawbacks such as privacy
concerns. For the recognition of different people within a premise, a Smart Environment may
also use biometric methods. Another option involves the use of behaviometrics in which an
environment distinguishes every person with the help of their actions and samples of conduct
which are peculiarly linked with a certain person. Every person is capable of categorizing others
into the following categories: enemies, acquaintances or salesman, according to their conduct. In
order to create Smart Environments which are capable of delivering comparable anticipations,
there is a need for an effortless expansion of systems that rely on sensing devices. Although
plenty of resemblances exist among individuals however finding multiple individuals possessing
identical likings and necessities is nearly impossible. On different matters of choice, there will
always be minor differences. The system has to decide about the method in which it would
respond in such scenarios so that it serves as an acceptable arbitrator between individuals. An
important question that arises is how to tackle a situation where every option is exhausted for
making a settlement. Shall the precedence be awarded to a single individual by the system on the
footing of communal status? It is yet another significant concern since when a specific individual
or set of individuals discovers that mostly their likings and necessities are ignored in comparison
to other co-existing individuals therefore they will undoubtedly be discontented and deem the
system as ineffectual.
The purpose of creating a Smart Environment is to provide help and sustain individuals as well
as monitoring the elderly for healthcare therefore if such a system collapses there is a greater
probability of an adversity. It is unwise to suppose that a system is constructed to be flawless.
The corporate sector is taking advantage of the demand, as part of the finest strategy procedures
and devices could be manufactured and supplied so that they are effortlessly combined with the
course of progress accelerating the acceptance by the industrial sector. The intricacies involving
the software required for controlling the system may effortlessly build unseen complicated
connections that produces variability in the system performance as articulately expounded by
certain narratives. It is quite unprincipled to neglect such a situation blaming the individual who
lacks the scientific knowledge to comprehend and evaluate the system that is embedded within a
location. The Smart Environment research field must genuinely consider these attributes because
of their capacity in endangering peoples lives. The field of Software Engineering had already
put in noticeable efforts towards the solution of such problems however the Smart Environment
system is a combination consisting of networks, intelligent software agents, sensing devices,
human-computer interfaces and operators that causes systematic analysis and validation to
become extremely complicated which could not be managed by conventional methods and
instruments. The evaluation of context-aware software is more challenging than usual software
since there is a requirement that context-aware software should be evaluated inside the
environment for which it was built so that the created systems are dependable. One approach
involves operating context-aware software through different contexts like places and LANs via
matching context or transferring the software at a specific place. Furthermore, in order to
evaluate and test Smart Environments for checking their ability in meeting the requirements,
there is frequently a demand for appropriate procedures. For efficient delivery of assistance,
systems that are intended for common people should provide services perceptively. The Smart
Environments field that seeks a close link in the routine existences of individuals must earnestly
consider such aspects. The ability of a system to assist an individual is proportional to its
information concerning an individual. Among the different existing sensors for collecting
information, the highly useful are video cameras because it is capable of giving extensive and
decisive information regarding the section of an environment under surveillance. Although
additional valuable information is available through video cameras, they could acquire
information that an individual will usually not permit. As an assumption, suppose there lies a
camera inside someones washroom or sleeping quarters. Whether something is permissible for
distribution depends largely on traditional norms as well as on the monitored setting. Certain
individuals feel quite content conceding certain amount of privacy in favor of enhanced security,
on the contrary, certain individuals would under no circumstances permit filming of their routine
tasks and behaviors. For introducing technology in the routine activities of individuals, systems
that are capable of adjusting with changes in the level of sensitivity of an individual should be
originated. Various bodies or individuals can possess and operate the sensing devices present in a
Smart Environment. The data about individuals collected by sensing devices within a location is
either kept with the individuals or managers of the building instead of the vendors or
manufacturers of the sensing devices. Therefore, a Smart Environment
may involve numerous stakeholders. There is a need to guard the benefits of every possible
stakeholder ahead of manipulating the data available through Smart Environments. The trouble
aggravates if the Smart Environments are employed within a shared area such as an office or a
road. Moreover, it is essential that free riders are eliminated from a Smart Environment, a free
rider is a person benefiting from a service and not compensating for its utilization or giving a
smaller amount. The delivery of facilities to individuals will be immensely impacted with greater
numbers of free riders. In the case of a crisis such as a calamity or inferno a Smart Environment
must dedicate a greater amount of resources and facilities to certain individuals such as fire
fighters. Considering the upcoming role of Smart Environments, scientist and architects should
disentangle the challenges related to numerous stakeholders and free riders. The data concerning
the routine actions of individuals is stored by sensing devices afterwards the existing tools may
aid in taking out the stored data for obtaining behavioral repetitions. The main purpose of this is
to distinguish between undesirable and desirable behaviors as well as promoting the desirable
and opposing the undesirable behaviors. Confidential and personal information may also be
forgotten or misplaced as a result the daily practices and diseases of an individual could reach in
the hands of companies that may exploit that information for their own benefit. If confidential
private information is accessible to people with malicious intent then private and financial
security will be lost. Therefore, additional steps should be taken for ensuring that the privacy and
security concerns of individuals who are going to utilize the technology are nullified. Branding
the product to be hazardous for individuals would mean failing to take advantage of an incredible
chance for profiting the public. Such systems would inevitably flop intermittently and variably
because of the characteristic natural intricacy of these systems and the extrinsic intricacy of the
anticipations about such technology that an individual has. For providing a greater degree of
security, the involved stakeholders should highlight its importance and give it priority. The initial
procedure that could be followed includes:
a) The systems should be developed with a smarter methodology for software engineering
b) Improved grasp about Human-Computer Interaction
c) Cooperation among various levels such as technological and personal
CHAPTER 3

SYSTEM REQUIREMENT SPECIFICATION

This Chapter is about the requirements of the whole system that will allow it to function
properly. The chapter will provide details of the hardware and software components used for
each module of the project. Each requirement as part of System Requirement Specifications
(SRS) is elaborated and discussed clearly. Functional as well as Non-functional requirements are
also discussed in this chapter.

Table 4: Summaries of SRS

Functional Construction of individual user Profiles.


Authentication of users to access their
profiles.
Registration of users to add them to the
Non- Functional The system is designed to be simple, non-
system.
linear and capable of being deployed across
different rooms.
External interface RFID reader and RFID card

Attributes Profile Creation, Profile Management,


Authentication, and Automation.

3.1 SRS for Context-aware Profiling using Internet of Things

3.1.1 Functional Requirements

Functional Requirements specify the characteristics and behavior of the system when different
inputs are applied to it, they are part of the overall requirements of the system. These
requirements vary from one system to another and are one of the metrics to determine the
success of a project that is if it functions correctly in accordance with the specified functions
supposed to be delivered. Functional Requirements could involve calculation, computation,
analytics, and manipulation of data or any other specified function. In our Project Context-
aware Profiling using Internet of Things the functional requirements are detailed as follows:

1. For the user to be able to use the system, he would have to register himself using the
provided interface.
2. The user would have to fill in the fields for the preferences provided by the system for
storing those preferences.
3. If the user login and password details are not registered the user would not be able to use the
system.
4. The preferences of the user would only be updated once the user swipes the card with the
details on the RFID reader.
5. The user can only provide a certain range of values for the preferences, outside the range of
the allowed values the system will prompt the user to enter another value. The
Attributes are: Profile Creation, Profile Management, Authentication, and Automation.

3.1.2 Non-Functional Requirements

The Non-Functional requirements do not relate to the operations performed by the system but
rather they are related with other properties like response time, storing capacity, availability and
that how much load the system can bear. The non-functional requirements can also outline the
limitations of the system like the potency of Input and Output devices as well as the formats of
data that are applicable for the system. Mostly, the non-functional requirements are linked with
the entire system instead of specific system components. At times, the non-functional
requirements
are more crucial as compared to the functional requirements of the system. The non-functional
requirement that concern our project of Context-aware Profiling using the Internet of Things
are discussed below:
1. Simple: The designed system interface must be simple to use and does not require special
training for any individual, also it can operate in different rooms.
2. Non-linear: The system gives a non-linear output as the control is not very precise.

CHAPTER 4

PROJECT SOFTWARE AND HARDWARE COMPONENTS

4.1 Software Components

The Software Components used within the Project Context-aware Profiling using the Internet of
Things are described in detail in this section. The software technologies used in the project
include: HTML5, CSS3, JavaScript, PHP, and MySQL.

4.1.1 HTML5

HTML is an abbreviation for Hyper Text Markup Language which tells the web browser how to
display the data on the web page. HTML5 is the latest version of the HTML. This latest version
was introduced in October 2014 by the World Wide Web Consortium (W3C) for enhancing the
capability of the language to handle multimedia content at the same time maintaining the clarity
and cleanliness for making it easily comprehensible for developers as well as having it regularly
comprehended by computers and applications like web browsers, parsers, etc. Both HTML4 as
well as XHTML1 and DOM Level2 HTML are incorporated in HTML5. In order to foster
interoperable executions to a greater degree, HTML5 comprises of comprehensive processing
models. HTML5 broadens, advances and streamlines the existing markups relating to documents
and adds markups and APIs to handle intricate web applications. These characteristics aid
HTML5 in developing platform independent mobile applications as the technology comprises of
attributes tailor made for portable computers. HTML5 also comprises of additional syntax
elements. For native insertion and management of multimedia and visual data, there was an
addition of elements such as <video>, <audio> and <canvas> and incorporation of support for
scalable vector graphics
(SVG) data as well as MathML to deal with numerical formulae. Additional page layout
elements like <main>, <section>, <article>, <header>, <footer>, <aside>, <nav> and <figure>
were introduced for enhancing semantic data related to documents. Moreover, HTML5 also
comprised of additional attributes, certain elements and attributes were eliminated, while certain
remaining ones like <a>, <cite> and <menu> were modified, made consistent and restructured.
HTML5 standard currently comprises of APIs and Document Object Model (DOM) as its
primary components and explains the handling of unacceptable documents more efficiently.

4.1.2 CSS3

Cascading Style Sheets (CSS) is a scripting language that determines the style and appearance of
a web page designed using markups. The CSS could be used with every XML document such as
plain XML, SVG or XUL, though it is typically employed for adjusting the appearance of web
documents and user interfaces coded using HTML or XHTML and it is appropriate for
representing aural data or other media. HTML, CSS and JavaScript are the foundation upon
which a majority of graphically appealing websites, user interfaces for applications based on
web, and user interfaces for mobile applications are designed. The main purpose behind
formulation of CSS was to split the data and presentation, comprising of properties like layout,
colors and fonts, of a document. Splitting data and representation could enhance availability,
offer greater suppleness and power in the requirement of presentation features, and allow several
HTML pages to use the same formatting through distinctly stating in a .css file the pertinent CSS
thus decreasing the intricacy and recurrence within the structural content. Splitting layout and
data enables portraying a single markup page in various styles for various depiction techniques
like in print, through monitor, through audio, and via Braille-based sensitive-to-touch devices.
Moreover, using this method the web sites could be presented according to the dimensions of the
screen device varying as the dimensions change from device to device. The viewers may give a
separate style sheet, for example a CSS file saved within the PC for replacing the default CSS
file created by the author. The graphics of a single or multiple documents may be modified
swiftly and effortlessly through correction of a limited amount of code inside the CSS file under
usage instead of altering markups inside the documents. The CSS standard explains a precedence
pattern for deciding on the
applicability of style guidelines when multiple guidelines correspond to a specific element.
Additionally, precedence is computed and allocated for guidelines consequently the outcomes
could be estimated. The World Wide Web Consortium (W3C) is responsible for supporting the
CSS standard. The RFC 2318 dated back to March 1998 recorded the application of internet
media type text/css with CSS. The CSS validation service was provided without cost aimed at
CSS documents by the W3C. Almost every HTML presentational feature was available inside
HTML markups prior to the introduction of CSS. Every style, element alignment, color, size and
border was supposed to be clearly defined recurrently at times inside the HTML. CSS allows the
developers to shift a majority of this information in a different file which is a style sheet
consequently the HTML is significantly minimal. As an example, headings (h1 elements), sub-
headings (h2), sub-headings (h3), etc. are labelled structurally by applying HTML. The options
with regard to size, color, emphasis and font for such elements are presentational whether it be in
print form or on the monitor. Prior to the introduction of CSS, the document writers desiring the
allocation of typographic features for every h2 heading were required to replicate HTML
presentational markup for every existence of the heading type. Such an approach rendered the
documents increasingly complicated, bulkier, increasingly inclined to be faulty, and hardly
sustainable. CSS enables the segregation between presentation and structure. Typographic
features such as font, size, color, borders, layout, spacing, and text arrangement as well as
additional ones could be described separately for on-screen and printed outlooks by CSS.
Additionally, non-graphic styles like highlighting for auditory text readers and reading pace can
be described by CSS. Presently, the application of every presentational HTML markup has been
discontinued by W3C. As an example, in the HTML prior to CSS introduction, a heading
element described by red text was expressed using the following syntax: <h1><font
color=red> Chapter 1. </font></h1>. By applying CSS, this element could be described with
the help of style properties rather than HTML presentational attributes: <h1 style=color: red;>
Chapter 1. </h1>. By applying this code an outside CSS file might be linked to an HTML
document: <link href=path/to/file.css rel=stylesheet>. The head portion of the code may
contain the internal CSS. The style tag begins the code. As an example, <style>.CSS information
might be supplied by different sources. Such sources include the individual, the writer and the
web browser. The supplied information by writer
could be additionally categorized into media type, importance, inline, rule order, inheritance,
property definition, and selector specificity. The CSS style information might be placed either
inside a distinct document or implanted inside an HTML document. Several style sheets may
also be imported. The style being employed varies as the output device varies. Suppose, there is a
variety between the screen and printed forms, resultantly writers will be able to shape the
presentation properly for every form. The data which is to be shown is managed by the style
sheet having the greatest precedence. The statements which are not allotted among the greatest
precedence source are transferred towards the source of lesser precedence like the user agent
style. Such a methodology is termed cascading. Another objective of CSS involves permitting
individuals to have additional command on presentation. A separate style sheet might be used by
anyone considering red italic headings illegible. Variation in the browser and website being
accessed allows an individual to opt between numerous style sheets which the designer supplies,
or an individual can delete every style thus observing the site by means of a browsers typical
styling, or can even overrule only the red italic heading style with no modification.

4.1.3 JavaScript

JavaScript was designed to be an interpreted programming language. JavaScript is made into a


standard in the ECMA Script language description. Together with HTML and CSS, JavaScript is
also among the main tools for developing websites. Plenty of websites use JavaScript and every
contemporary browser application can run JavaScript even in the absence of a plug-in. JavaScript
supports prototypical, functional, object-oriented, multi-paradigm, and imperative coding
approaches. JavaScript contains an API for handling text, regular expressions, arrays, and dates
however it is lacking I/O like storage, graphic features, networking, depending on the host
environment inside which it is entrenched to access such features. Even though Java and
JavaScript have clear apparent resemblances such as the name of the language, the syntax, and
corresponding standard libraries, they are separate languages and vary immensely when it comes
to the way they are created. Programming languages like self and Scheme inspired the creation
of JavaScript. Apart from its application in web sites, it is employed in situations that does not
require any web development like site-exclusive browsers, desktop widgets, and PDF
documents. The introduction
of latest and more responsive JavaScript virtual machines (VMs) and platforms intensified the
adoption of JavaScript in order to develop server-side web applications. JavaScript is usually
applied as an interpreted language at the client side, however some modern browser applications
execute just-in-time compilation. Additionally, JavaScript is employed for game development,
design of mobile and desktop applications, and server-side network programming alongside run-
time environments like Node.js.

4.1.4 PHP

Another server-side scripting language mainly created and employed in building web sites is
PHP which is additionally capable of being applied for general-purpose programming. In 1994,
Erasmus Lerdorf invented PHP but the PHP development team presently handles its reference
operation. Initially Personal Home Page was abbreviated as PHP however presently PHP denotes
the recursive contraction: Hypertext Preprocessor. HTML can contain PHP code, PHP might also
be applied together with numerous web template systems, web frameworks, and web content
management systems. The code written in PHP is normally handled with the help of a PHP
interpreter is applied either as a module within the web server or as a Common Gateway
Interface (CGI) executable. The outcomes of the interpreted and executed PHP code comprising
of a variety of data types such as pictures are merged with the produced web page by the web
server. Command-line interface (CLI) can be utilized for implementing the PHP code thus
enabling the operation of individual graphical applications. The Zend Engine drives the standard
PHP interpreter which is a software licensed by the PHP license. Plenty of ports are available for
the PHP language which could be implemented using all web servers and nearly all operating
systems and platforms without any cost. Before 2014, the PHP advanced lacking any authored
official standard or specification allowing the official PHP interpreter to be the existing standard.
After 2014, a collective effort has resulted in an official PHP standard. There were considerable
attempts made in order to achieve standardization and code distribution among PHP applications
in 2010 by projects like PHP-FIG through PSR schemes, packages repository, and composer
dependency manager.

4.1.5 MySQL

MySQL is the most widely used, popular, open source, relational database management system
(RDBMS) in the world. An RDBMS is an accumulation of structured data. A relational database
is capable of storing data in different tables instead of accumulating entire data inside a single
massive store. SQL is the most common standard language employed for retrieving data from
databases. SQL is described by the ANSI/ISO SQL Standard. The SQL standard has been
developing from 1986 and a lot of versions are available. The structures of the MySQL database
are built into physical files improved in consideration of speed. The logical model consisting of
objects like databases, tables, views, rows and columns provides a programming environment
that is flexible. This data varies from an image gallery to large quantities of data on a corporate
network. In order to process, edit, add, and store data, a database management system like
MySQL is required. A database management system is important both as a single individual
utility and as part of a larger application. The database allows the establishment of rules for
administrating the relationships among various data fields like one-to-many, one-to-one,
required, optional or unique and pointers between various tables. These rules are strictly
implemented by the database consequently the database is appropriately designed and the
application does not encounters any varying, duplicate, missing or obsolete data. The MySQL
project has distributed its source code through the conditions of the General Public License
(GPL) and many other commercial agreements which describes how and when to use the
software in various scenarios. The MySQL server software and the client libraries are distributed
under following two different licensing distributions: GPL version 2 and commercial license. The
MySQL Server is provided through two distinct editions: the open source MySQL Community
Server and the commercial Enterprise Server. The MySQL Enterprise Server can be
discriminated from the Community Server edition because it possesses a set of exclusive
extensions that can be installed as server plugins however it has the same version number system
and is developed using the same code base. MySQL is capable of delivering high performance
and is reliable as well as simple and easy to apply. The rapidity, safety and connectivity of
MySQL Server makes it ideal for accessing databases through the Internet hence it is the first
choice database for web applications and is used by famous web
applications such as Facebook, Google, Twitter, YouTube, Flickr, Yahoo, TYPO3, MODx,
Joomla, WordPress, phpBB, MyBB, Drupal as well as several others. Originally, the Swedish
corporation named MySQL AB initiated by David Axmark, Allan Larsson and Michael Widenius
possessed, developed and supported MySQL but currently it is owned by the Oracle Corporation
which is in charge for the development, distribution and support of MySQL, enhancing the
database to create the web, cloud, mobile and embedded applications of the future. In 1994,
Widenius and Axmark started the development of MySQL. On 23 May 1995, the initial version
of MySQL emerged. This initial version was originally crafted for private usage using mSQL
created from a low-level language called ISAM which the developers believed to be very
sluggish and rigid. The developers of this initial version then developed another SQL interface
using the unchanged API from mSQL. Constantly using the same API with the mSQL system
allowed several developers to apply MySQL rather than using the commercially licensed mSQL
predecessor. In order to use MySQL for commercial purposes, many purchasable versions are
obtainable that provide extra features. The LAMP open source web application software stack as
well as several different AMP stacks contain MySQL as its main constituent. The MySQL
database is coded in C and C++. The SQL parser of the database is written in yacc however the
database utilizes a lexical analyzer. The MySQL database is also a cross platform database
capable of being run on the following platforms: AIX, BSDi, FreeBSD, HP-UX, eComStation,
i5/OS, IRIX, Linux, macOS, Microsoft Windows, NetBSD, Novell NetWare, OpenBSD,
OpenSolaris, OS/2 Warp, QNX, Oracle Solaris, Symbian, SunOS, SCO OpenServer,
SCOUnixWare, Sanos and Tru64. There is also a port available for OpenVMS in MySQL. There
is support available within the official manual moreover free support is also obtainable from
various IRC channels and forums. The Oracle Corporation also provides paid support through
the MySQL Enterprise products. These products vary in the type and number of services they
provide as well as their cost. Furthermore, quite a few third party groups also offer support and
services such as MariaDB and Percona. The MySQL database obtained optimistic appraisals and
critics observed that it does tremendously fine in a typical situation and also that there are
developer interfaces available and the documentation as well as feedback in a practical scenario
through Web sites is also extremely suitable. MySQL was also evaluated as a swift, steady,
multi-user, and multi-threaded SQL database server. Varying
from one programming environment to another, the SQL can be directly used to produce reports,
embed SQL statements into a different programming language or utilize a language specific API
that conceals the SQL code. The MySQL database is open source which allows any person to
employ and alter the software. Any person may download MySQL software and utilize it free of
cost. The source code can be examined and modified according to the requirement. The software
can operate smoothly on a desktop or laptop computer in parallel with a number of different
applications, web servers, etc. Reserving the whole computer for MySQL allows the alteration of
settings for exploiting resources such as CPU power, I/O capacity and memory. The MySQL
database is capable of scaling up to many clusters which may be interconnected through
networking. The MySQL Server was designed for managing voluminous databases more rapidly
than other available options and has been effectively employed inside extremely requiring
production environments for a long time. The MySQL Server provides plenty of valuable utilities
despite going through continuous changes. The MySQL Server operates inside client/server or
embedded systems comprising of a multi-threaded SQL server which helps various backend, a
number of distinct client side programs and libraries, administrative tools as well as a broad
variety of application programming interfaces (APIs). The name of the GUI tool that we
employed in our project was MySQL Workbench which is used for CRUD (Create, Read,
Update, and Delete) operations in databases and their table.

Figure 4: Executing simple query on Workbench

4.1.6 Arduino IDE for Development and Interfacing of devices


Arduino IDE is an open source platform that enables uses to program in a C like language for
different Arduino boards such as Arduino Uno, Arduino Nano, Arduino Leonardo, Arduino Yun,
and Arduino Gamebuino etc. Different libraries can be added to the Arduino IDE to further
enhance the features of the IDE. This IDE enables the users to directly burn the program into the
Arduino via the USB 2.0 interface. Therefore the user does not need to burn a separate file using
the burner or ISP programmer. Several modifications can also be made to this IDE so that it can
be used as an assembler for ARM based boards.

4.2 Hardware Components

The Hardware Components section elaborates and explains the hardware used within the Project
Context-aware Profiling using the Internet of Things. The Hardware Components used within
the Project include: Arduino Boards, Ethernet Shields, Router, RFID reader and RFID card,
Driver IC, LED and Fan Devices, Battery, and Connecting Wires.

4.2.1 Arduino Boards

The Arduino platform which includes hardware, software and documentation is open source and
freely obtainable. This allows anyone to gain knowledge about its internal structure and employ
its design for self-made circuits. Arduino devices are based on the ARM microcontrollers
therefore these devices are very effective. Instead of allowing the user to program in Assembly or
C, the Arduino has its own language that is derived from C language which can even enable a
layman programmer to write effective code in a matter of minutes. The Arduino family has the
following variants such as Arduino Uno, Arduino Leonardo, and Arduino wearables etc. All of
the Arduino controllers use the same language but have different additional features such as extra
RAM, extra processing power, and greater number of ports. Moreover, certain shields have also
been integrated with the Arduino such as the Arduino Uno that not only enable hardware
interfacing but also enable the Arduino to be part of the network. Two Arduino boards have been
used in the Project, one of them is Arduino Leonardo and the other one is Arduino Uno. The
Arduino Uno is considered to be an excellent board to get up to speed with electronics and
coding, it is powerful and the most commonly used and documented board of the Arduino
family. The Arduino Uno microcontroller is founded on the ATmega328P. Arduino Uno contains
a USB connection, a power jack, an ICSP header and a reset button. In order to begin using this
board, it has to be connected through a USB cable of the computer or an AC-to-DC adapter or
battery for powering it. The name Uno meaning one was picked to indicate the announcement
of the Arduino IDE 1.0. The Uno board and the version 1.0 of Arduino IDE were the reference
versions of Arduino. The Arduino Uno is the first among a number of USB Arduino boards. The
Arduino Uno can be programmed using the Arduino IDE. The ATmega328 of the Arduino Uno is
preprogrammed using a bootloader which enables uploading of different codes to it without
requiring an external hardware programmer; it communicates using the original STK500
protocol.
Table 5: Technical Specifications of Arduino Uno

Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 7-12 V
Input Voltage (limit) 6-20 V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P), 0.5 KB is used by
bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P) r/w using EEPROM library
Clock Speed 16 MHz
LED_BUILTIN 13
Length 68.6 mm
Width 53.4 mm
Weight 25 g

The microcontroller may also be programmed using the ICSP (In-Circuit Serial Programming)
header with the help of Arduino ISP thus avoiding the bootloader. The Arduino repository
contains the firmware source code of the ATmega16U2 and earlier versions. The
ATmega16U2/8U2 is loaded with a DFU bootloader. Different software depending on the
Operating System can then be utilized to load a new firmware. Alternatively, an ISP header and
external programmer can be employed overwriting the DFU bootloader. The Arduino Uno board
is distinguished from other previous boards as it avoids the FTDI USB-to-serial driver chip and
uses the ATmega16U2 programmed as a USB-to-serial converter. The USB port or the external
power supply may be used to provide power to the Arduino Uno board and the power source is
automatically chosen.
The external source of power may be an AC-to-DC adapter or a battery. The adapter could be
used by pushing the 2.1mm center-positive plug inside the power jack of the Arduino board.
When using a battery as a power source, the leads of the battery could be put into the GND and
Vin pin headers of the POWER connector. The function of the power pins is described below:
1. Vin: This pin serves as the input voltage to the Arduino board in the case of provision of
power from an outside source. This pin may be used to provide voltage. Alternatively, when
using the power jack to provide voltage, this pin can access the voltage.
2. 5V: This pin is responsible for delivering 5V output coming from the board regulator. The
power can be delivered to the board using a DC power jack (7-12V), the USB connector
(5V), or the Vin pin of the board (7-12V). When delivering voltage using the 5V or 3.3V pins,
the regulator is evaded which may harm the board.
3. 3V3: This pin provides the voltage supply produced by the boards regulator. The maximum
current drawn is 50 mA.
4. GND: These are the ground pins.
5. IOREF: This power pin indicates the voltage reference using which the microcontroller
functions. A correctly organized shield may take the IOREF pin voltage and chose the correct
power source or allow the voltage interpreters at the outputs to function using the 5V or 3.3V.
Providing lesser than 7V results in the 5V pin delivering a smaller voltage than 5V making the
board unsteady. Supplying greater than 12V results in overheating and mutilation of the board.
The pinMode(), digitalWriter(), and digitalRead() functions allow all the fourteen digital pins to
be utilized as either an input or output pin on the Arduino Uno. These pins function at 5 Volts.
Every I/O pin possesses an internal pull-up resistor of 20 to 50k ohm which is detached by
default. The limit of the current that can pass through every I/O pin is 40mA to prevent the
microcontroller from being perpetually mutilated. Certain pins on the board have dedicated roles:
1. Serial: 0 (RX) and 1 (TX). These pins are applied for receiving (RX) and transmitting (TX)
serial data. They are linked to the conforming pins of the ATmega8U2 USB-to-TTL Serial
chip.
2. External Interrupts: 2 and 3. These pins can be adjusted for generating an interrupt when the
value is small, on a leading or trailing edge, or on an alteration in value.
3. PWM: 3, 5, 6, 9, 10 and 11. These pins produce 8-bit PWM output using the analogWrite()
function.
4. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins assist in SPI communication
with the help of SPI library.
5. LED: 13. This pin operates the built-in LED. If the value of this pin is HIGH, the LED is
switched on and if it is LOW, it is switched off.
6. TWI: A4 or SDA pin and A5 or SCL pin. These pins assist in TWI communication with the
help of Wire library.
7. Analog Inputs: The six analog inputs of the Arduino Uno are named A0 toA5, every pin
offers 10 bits of resolution (1024 distinct quantities). These pins measure between ground
and 5V by default, however the upper limit of the Voltage can be modified with the help of
AREF pin and analogReference() function.
Some additional pins on the board have the following functions:
1. AREF: Serves as the Reference Voltage for analog inputs and analogReference() is applied in
conjunction with it.
2. Reset: Microcontroller is reset by making this pin LOW. Commonly, a reset button is inserted
to the shields that obstructs HIGH value on the board.
There are several capabilities of Arduino Uno with regard to communication which enables it to
communicate with a computer, another Arduino board, or a different microcontroller. The
ATmega328 has UARTTTL (5V) available for serial communication through the digital pins 0
(RX) and 1 (TX). The serial communication is controlled by the ATmega16U2 on the board
through a USB and it is shown as a virtual com port on the computer software. The standard
USB COM drivers are the only drivers utilized by the 16U2 firmware but an a.inf file is needed
on Windows. There is a serial monitor available in the Arduino IDE that enables plain textual
data to be transmitted to and received from the board. Whenever data is sent through the USB-to-
serial chip or USB interface to a computer, the RX and TX LEDs will sparkle on the board.
Every Uno digital pin could be used for serial communication using the SoftwareSerial library.
Using ATmega328, communication through I2C (TWI) and SPI are also possible. The Wire
library which makes it easy to utilize the I 2C bus is also contained in the Arduino IDE however
the SPI library
should be applied for SPI communication. Instead of needing a mechanical push on the reset
button prior to an upload, the Arduino Uno board could be reset using a software operating on
the computer to which it is linked. Through a 100 Nano-farad capacitor, a single hardware flow
control line (DTR) of the ATmega8U2/16U2 is linked with the reset line of the ATmega328. The
reset line falls for an ample amount of time to reset the chip if the hardware flow control line is
taken to be LOW. This feature is utilized by the Arduino IDE for uploading the code by clicking
the upload button of the interface toolbar. The Arduino Uno resets on every instance it is
connected using a software through the USB if it is linked with a computer operating Mac OS X
or Linux. The bootloader then starts operating on the Uno for approximately half a second.
Although the bootloader is programmed to disregard distorted data, it will seize certain initial
bytes of data transmitted to the board when a linked is formed. The auto-reset feature of the Uno
board may be inactivated by disconnecting the trace that it encompasses. In order to reactivate
this feature, the pad on one side of the trace is soldered to the pad on the other side. Alternatively,
by joining a 110 ohm resistor between 5V and the reset line, the auto-reset feature can be
inactivated.
The Arduino Leonardo is a combined USB HID board of the Arduino family. The Arduino
Leonardo can be perfectly applied to projects needing the board to work like a USB human
interface instrument. The microcontroller of the Leonardo board is built upon the ATmega32u4.
The Leonardo contains a micro USB link, a power jack, an ICSP header, a reset button and many
other necessary microcontroller features. In order to operate the Arduino Leonardo, it has to be
either linked with a computer using USB cable or powered by an AC-to-DC adapter or a battery.
The distinguishing feature of Arduino Leonardo is the fact that ATmega32u contains built-in
USB communication thus it doesnt require another processor. Consequently, the Leonardo is
shown as a mouse and a keyboard to the computer with which it is linked, as well as a virtual
(CDC) serial/COM port.
Table 6: Technical Specifications of Arduino Leonardo

Microcontroller ATmega32u4
Operating Voltage 5V
Input Voltage (Recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 20
PWM Channels 7
Analog Input Channels 12
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega32u4), 4 KB is used by bootloader
SRAM 2.5 KB (ATmega32u4)
EEPROM 1 KB (ATmega32u4) r/w using EEPROM library
Clock Speed 16 MHz
Length 68.6 mm
Width 53.3 mm
Weight 20 g

Power can be supplied to the Arduino Leonardo through the micro USB link or using an external
power source. The source of power is automatically chosen. Either an AC-to-DC adapter or a
battery may be used as the external power source. A 2.1 mm center-positive plug can be inserted
inside the power jack of the board to use the adapter. The GND and Vin pin headers of the power
connector can then take in the leads of the battery. The Arduino Leonardo has exactly the same
power pins as the Arduino Uno and their functions are also the same as with the Arduino Uno.
With the help of pinMode(), digitalWrite(), and digitalRead() functions, any of the twenty digital
I/O pins of the Leonardo may be applied as an input or output pin. These pins function using 5V.
Every pin contains an internal pull-up resistor with a 20-50 kilo-ohm range which is detached by
default. Moreover, certain pins possess dedicated functions:

1. Serial: 0 (RX) and 1 (TX). These pins are employed for sending (TX) and obtaining (RX)
TTL data with the help of the hardware serial proficiency of ATmega32U4. The Serial class
denotes the USB (CDC) communication on Leonardo therefore the Serial1 class has to be
applied for TTL serial communication through pins 0 and 1.
2. TWI: 2 (SDA) and 3 (SCL). These pins enable communication through TWI with the help of
Wire library.
3. External Interrupts: 3 (interrupt 0), 2(interrupt 1), 0 (interrupt 2), 1 (interrupt 3) and 7
(interrupt 4). In order to generate an interrupt at a low value, a leading or trailing edge, or an
alteration in value, these pins are set appropriately.
4. PWM: 3, 5, 6, 9, 10, 11 and 13. These pins supply with an eight bit PWM output using the
analogWrite() function.
5. SPI: on the ICSP header. With the help of these pins and the SPI library, SPI communication
is possible. Unlike Arduino Uno, there is no connection between the SPI pins and the digital
I/O pins. If there is a shield that contains SPI but lacks a 6-pin ICSP connector which would
be attached to the 6-pin ICSP header of the Leonardo board, then such a shield wont
function.
6. LED: 13. Digital pin 13 operates the attached built-in LED. If the pin has a HIGH value, the
LED is switched on otherwise it is switched off.
7. Analog Inputs: A0-A5, A6-A11 (on digital pins 4, 6, 8, 9, 10, and 12). The Arduino Leonardo
contains twelve analog inputs named A0 to A11, all these may also be applied as digital I/O
pins. The positions of pins A0 to A5 are identical with the Uno board; pins A6 to A11 are
positioned at digital I/O pins 4, 6, 8, 9, 10 and 12 respectively. The resolution offered by
every analog input is 10 bits (1024 distinct quantities). The analog inputs gauge between
ground and 5V by default however the AREF pin together with the analogReference()
function may be applied to modify the upper limit of the Voltage.
There are some additional pins like AREF and Reset that have the same functions as the Arduino
Uno. In order to communicate to a computer, a different microcontroller and another Arduino,
the Leonardo board provides quite a few services. The ATmega32U4 offers UARTTTL (5V)
serial communication via digital pins 0 (RX) and 1 (TX). Serial (CDC) communication is also
provided by 32U4 through the USB and it seems to be a virtual com port on the computer
software.
Moreover, with the help of standard USB COM drivers, the 32U4 behaves like a full speed USB
2.0 device. An a.inf file is needed for Windows OS. There is a serial monitor available through
the Arduino IDE that enables plain textual data to be transmitted to and sent from the Leonardo.
Only at the instance of data being communicated through the USB link to the computer will
sparkle the RX and TX LEDs attached to the Leonardo. Serial communication through the digital
pins of the Leonardo is possible using the SoftwareSerial library. I 2C (TWI) and SPI
communication is also provided by the ATmega32U4. As an assistance in applying the I 2C bus,
the Arduino IDE contains a Wire library. The SPI library is applied in SPI communication. The
Leonardo is displayed as a common keyboard and mouse and may be programmed to manipulate
the input devices with the help of Keyboard and Mouse classes. The Arduino IDE is used to
program the Leonardo. A bootloader is pre-burned on the ATmega32U4 of the Arduino Leonardo
which enables uploading of a fresh code on it without requiring an outer hardware programmer.
The AVR109 Protocol is employed by the ATmega32U4 for communication. Alternatively, the
microcontroller can be programmed with the help of ICSP (In-Circuit Serial Programming)
header and Arduino ISP thus avoiding the bootloader. Instead of using a mechanical push for the
reset button prior to the upload, the software operating on the computer to which the Leonardo is
linked may be used to reset it. The instance at which the virtual (CDC) serial/COM port of the
Leonardo opens at 1200 baud and later closes activates the reset thus resetting the processor and
interrupting the USB link to the computer. The bootloader then begins operating and continues
for approximately eight seconds once the processor resets. Pushing the reset button of the
Leonardo also start the bootloader. If the user sketch exists, the board will directly jump to it
once the board starts operating instead of starting the bootloader. It is recommended to use the
Arduino IDE for activating the reset prior to uploading since the Leonardo doesnt manages the
reset very well. In case the software fails to reset the board, the bootloader may be activated
using the reset button of the board.

4.2.2 Ethernet Shields

Arduino Ethernet shield is an add-on that can be attached to any Arduino for the purpose of
linking it with Internet seamlessly; it is an open source hardware. This enables the Arduino to
communicate with different network devices using standard Internet protocols such as telnet,
HTTP, etc. This device can be used as a server and also as a client. The Ethernet Shield
communicates via a standard RJ-45 link alongside a combined line transformer and Power
supplied through the Ethernet after being attached to the Arduino Board for controlling things
through the Internet. Different libraries have been included in the Arduino that enhances the
shield's capabilities such as communicating with the database. The Arduino Ethernet shield does
not compromise the ports of the Arduino instead there are ports on top of the Arduino Ethernet
shield. The operating voltage of the Ethernet shield is 5V and it is powered by the Arduino
Board. The Ethernet shield also contains the Ethernet Controller W5500 and an internal 32K
buffer. The speed of the Ethernet link formed using the Ethernet shield is 10/100Mb. The
Ethernet shield also allows a linkage to the Arduinos SPI port. The Ethernet shield is built upon
the Wiznet W5500 Ethernet chip which comprises of a network (IP) stack that supports TCP,
UDP Protocols and a maximum of eight concurrent socket links. The Ethernet library could be
utilized for creating sketches which aids in linking with the Internet through the Shield. Extended
wire-wrap headers spread across the Shield are applied for linking the Ethernet Shield with the
Arduino Board thus enabling the pin arrangement to remain unbroken and piling of a second
Shield on the upper portion of the first one. With the help of the Ethernet library, both Arduino
Uno and Mega are well-matched with the Ethernet Shield. The Ethernet Shield also contains a
small space for SD cards allowing files to be saved in order to provide services through the
network. The SD Library assists in accessing the onboard micro-SD card reader. Previously, the
Shield had a full-sized SD card slot which is not available anymore. For correctly resetting the
W5500 Ethernet module upon power-up, the Shield comprises of a reset controller. The reset
button of the Shield resets the W5500 and the Arduino Board. The Arduino Mega was
incompatible with older Shield revisions which required physical resetting upon power-up. The
latest Shield also contains a Power over Ethernet (PoE) module for obtaining power through a
typical twisted pair Category 5 Ethernet cable. The PoE module is a commercial hardware of a
third party and is not an Arduino product. The PoE module is not a built in accessory of the
Shield rather it is a single module which may be additionally attached. The SPI bus connected to
the ICSP header aids Arduino in communicating with W5500 and SD card. The Uno board
utilized the digital pins 10, 11, 12, and 13 for this purpose. The purpose of pin 10 is to choose the
W5500 and pin 4 is applied for the SD card. Therefore, these pins are not available as
general I/O pins. Between W5500 and SD card, only a single device will operate as they use the
same SPI bus. In case both devices are being applied, the corresponding libraries must manage
them. In case one of these two devices is not operating then it has to be removed; for the SD card
this could be done by setting pin 4 to be an output pin and making it HIGH while W5500
requires setting pin 10 to be a HIGH output pin. The Ethernet Shield also includes a few status
LEDs conveying certain information:
1. ON: suggests that the Board and Shield are operating
2. LINK: shows the availability of a network connection and it sparkles if data is being sent or
received by the Shield
3. FDX: specifies the network link to be a full duplex link
4. 100M: denotes that a 100 Mb/s network link is available instead of the 10 Mb/s link.
5. ACT: if there is RX or TX operation being performed, this LED glints

4.2.3 Router

A TP Link router was used in the project for the construction of a simple Local Area Network
(LAN). The router had power cord as well as four Ethernet ports for connecting the Category 5
Ethernet cables with the RJ45 connectors to the Ethernet Shields at the other end which were
attached on top of the Arduino Boards used in the Project. This later allowed the static allocation
of IPs to the shields connected to the network on top of the Arduino Boards.

4.2.4 RFID module and RFID card

Miniature chips capable of transmitting data wirelessly could be developed using revolutionary
RFID communication. These RFID chips behave as barcodes that could be read by electronic
reader for automatically recognizing the items with which they are placed. RFID tags are of two
types Active and Passive. Those RFID tags relying on their own battery power for transmission
of data are called Active RFID tags, while other RFID tags do not have their own battery to
empower them for transmitting ID to the reader so they utilize the power from the signals to
transfer the ID and hence they are called Passive RFID tags. The identification technology has
found usage in supply chain and retail as well as in transport and for controlling access. Some
initial applications
of passive RFID tags include the usage at toll plazas and banks. On the other hand, Active RFID
tags have been used for keeping track of cargo in containers at ports. The passive RFIDs are
susceptible to attackers because they can trace people and devices, also they are not capable of
being incorporated with artificial intelligence. Cryptography can help to solve these kind of
issues and so these RFIDs should be refined with the help of research for them to be adopted for
use. With the help of encryption algorithms data could be kept secret and modification and
corruption of data is prevented by using authentication codes. The MFRC522 RFID module was
used within the Project to identify and authenticate users for the delivery of services. This RFID
module is a passive RFID module. It is easily available at many web stores such as eBay and
also comes with several starter Arduino kits. There was also a card included with it which has an
EEPROM; this card was used to carry the preferences and profile settings of the user which were
dumped on to it. The password and ID used were default. This RFID module was capable of
reading and writing but it was only used for reading purposes within the Project. The card reader
utilizes SPI for communication. The chip supports I2C and UART protocols. The RFID card
reader and the tags communicate with a 13.56MHz electromagnetic field.

4.2.5 L298N Driver IC


This Drive IC enabled switching and PWM (Pulse Width Modulation) functions to be performed
for controlling the intensity of the Fan and LED devices connected to the controller. The L298N
IC enables us to control the speed and direction of only two DC motors or devices or control one
bipolar stepper motor. The L298N IC is operable with motors that operate between a voltage
range of 5V and 35V DC. The L298N module also contains a 5V onboard regulator for sourcing
5V from the board if the voltage supply is around 12V. The L298N dual motor controller
modules are cheap and are easily available. The pinout of the L298N module is as follows and
can be matched against the image:
1. DC motor 1 "+" or stepper motor A+
2. DC motor 1 "-" or stepper motor A-
3. 12V jumper - remove this if using a supply voltage greater than 12V DC. This enables
power to the onboard 5V regulator
4. Connect your motor supply voltage here, maximum of 35V DC. Remove 12V jumper if
>12V DC
5. GND
6. 5V output if 12V jumper in place, ideal for powering your Arduino
7. DC motor 1 enable jumper. Leave this in place when using a stepper motor. Connect to
PWM output for DC motor speed control.
8. IN1
9. IN2
10. IN3
11. IN4
12. DC motor 2 enable jumper. Leave this in place when using a stepper motor. Connect to
PWM output for DC motor speed control.
13. DC motor 2 "+" or stepper motor B+
14. DC motor 2 "-" or stepper motor B-

Figure 5: L298N IC Pinout

4.2.6 LED and Fan Devices

These devices were 12V DC operable and were controlled via switching and PWM (Pulse Width
Modulation) to vary their intensity according to the preferences of the users. The LED lights
were an array of 12 X 12 LEDs and were 12V DC operable. These two devices were dedicated a
name on the web portal.

4.2.7 Battery

The battery was used to supply power to the Arduino boards and the prototype of the Project.
The Battery that was used was a typical battery provided by the local vendor company named
Osaka. The battery was capable of providing 12V DC supply sufficient enough for powering
the Arduino boards and the prototype.
4.2.8 Connecting Wires and Category 5 Ethernet Cables

The connecting wires were used to connect the Fan and LED devices with the Arduino. The
Category 5 Ethernet cables connected the Ethernet Shields and the TP Link Router. A pair of
connecting wires was also attached to either terminals of the 12V Battery for powering the
circuit. The driver L298 Driver IC was also interfaced using the connecting wires.

70
CHAPTER 5

SYSTEM DESIGNING

5.1 Control Flow Diagram

Figure 6: Control Flow Diagram

71
5.2 Architecture Diagram

Figure 7: Architecture Diagram

72
CHAPTER 6

IMPLEMENTATION

6.1 Apache XAMPP

XAMPP is a multi-platform web server software stack package developed to be run as a process
on a system and is free and open source under the Apache License. The stack package comprises
of Maria DB database, Apache HTTP Server, and interpreters to be used by scripts in Perl or
PHP. The acronym XAMPP means Cross-Platform (X), Apache (A), MariaDB (M), PHP (P), and
Perl (P). The XAMPP is a minimal, small Apache product which allows developers to
comfortably make a local web server in order to test and use websites. Within a compressed file,
all components that are required for establishing a web server are contained: server application
(Apache), database (MariaDB), and scripting language (PHP).

6.2 Authentication using RFID and MySQL database


In this Project, we have used the MFRC522 module which is capable of both writing and reading
from the RFID cards. To obtain the password of the RFID cards we have dumped the data
directly on to our serial monitor. For authentication we have used the default password of the
RFID cards and based on the username of the RFID card we have verified the user with MySQL
database server via network created by the Arduino Ethernet shield. The MySQL database server
runs on localhost: 3306 and Apache runs on port 80.

73
Figure 8: RFID Module
6.3 Creating the Network
In order to create the network we have assigned different static IPs to both our server and the
nodes. The database connector is given the port number, IP address, database name, and table
name in order to run the query on MySQL database server. The data received from the server is
transmitted to the Arduino Uno via the Telnet Protocol. This allows the Arduino Leonardo to act
as the Telnet client for the Telnet server which is Arduino Uno.

Figure 9: Implementing the Network

74
Figure 10: Login Page

6.4 Styling of Website using CSS


Using CSS, the selectors describe about the portion of the markup on which the style must be
applied through complementing of tags and attributes inside the markup. Selector might be used
with:
1. Every element of a particular type such as the second level heading h2 Elements detailed
using attribute.
2. ID: a distinct identifier inside a document.
3. Class: It is an identifier which is able to annotate several elements inside a document.
4. Elements which rely upon their comparative position to other elements within the document
tree.
The Classes and IDs begin using letters, may contain alphanumeric characters and underscores
and are case-sensitive. An infinite amount of occurrences of several elements could utilize a class
whereas an ID could be used for just a sole element. In CSS, pseudo-classes are applied for
enabling formatting centered on information which is unavailable within the document tree.
Hover

75
is an instance of a commonly employed pseudo-class which recognizes substance only if the user
directs towards the visible element through pressing of the mouse cursor on it. It is attached to a
selector as in a hover or #elementid: hover. A pseudo-class is responsible for categorizing
elements of the document like link or visited, on the other hand, pseudo-element is responsible
for choosing a collection which might comprise of partial elements like ::first-line or ::first-letter.
It is possible to attain high degree of specificity and flexibility by merging the selectors using
several methods. For specifying elements using location, element type, class, and id or through
other grouping, several selectors might be unified within a spread out list. The sequence of
selectors is significant. As an example, consider div myClass {color: red;} is used with every
element of class myClass which are within div elements, contrarily myClass div {color: red;} is
used with every div element belonging to class myClass.

76
Figure 11: Registration Form

6.5 User Profile Form using HTML5, CSS3 and PHP

In order to identify each user on the computer network a simple web form is created using
HTML, CSS, and PHP. This form serves two purposes: identification and editing of registered
user profiles in order to register a user on the network.

Figure 12: User Profiling Form

77
CHAPTER 7: CONCLUSION AND FUTURE WORK

7.1 Advantages of the Project

The Project Context-aware Profiling using the Internet of Things will enable individuals to
implement their comfort settings inside their office premises, it will also reduce their time and
effort spent in manually adjusting the room settings. Moreover, people with mobility challenges
will be able to benefit from it the most as they would not have to move to customize the room
settings in accordance with their likings and comfort. This will also enable reduction in
electricity bills and conservation of electricity which is an important resource.

7.2 Conclusion
In this project of Context-aware Profiling using the Internet of Things we have conducted our
thorough review of literature about the history, related projects, enabling technologies, possible
applications and their feasibility as well as discussing challenges and limitations of the system
and how they can possibly be overcome. We have defined our own methodology of creating a
smart office solution using Internet of Things by specifying system requirements and then
describing each component used in the software and hardware. We have also represented the
design of the system through architecture and data flow diagrams, after which the entire
prototype implementation is explained and elaborated.

7.3 Future Work

As part of further improvement strategy, the project has to add security for safe access

78
and storage of online preferences.
Also, the website containing the preferences can be made responsive for access by any
portable device.
To view the preferences offline, a mobile application can be developed using appropriate
tools.
The system could also be improved by making its response more linear and precise.

79
REFERENCES AND BIBLIOGRAPHY

[1] O. Akribopoulos and D. Amaxilatis, Making P-Space Smart: Integrating IoT


Technologies in a Multi-office Environment, Oper. Syst. , 2013.

[2] M. Alam, M. Reaz, and M. Ali, A review of smart homesPast, present, and future,
Syst. Man, Cybern. , 2012.

[3] L. Baresi, S. Guinea, and A. Shahzada, SeSaMe: towards a semantic self-adaptive


middleware for smart spaces, Eng. Multi-Agent Syst., 2013.

[4] M. Chaqfeh and N. Mohamed, Challenges in middleware solutions for the internet of
things, Collab. Technol. , 2012.

[5] G. Fortino, A. Guerrieri, W. Russo, and C. Savaglio, Internet of Things Based on Smart
Objects, pp. 127, 2014.

[6] K. Furdk and G. Lukc, Events Processing and Device Interoperability in a Smart Office
IoT Application, Proc. 23rd Cent. Eur. , 2012.

[7] I. Georgievski and V. Degeler, Optimizing energy costs for offices connected to the smart
grid, Smart Grid, IEEE , 2012.

[8] C. Hochleitner and C. Graf, Making Devices Trustworthy: Security and Trust Feedback
in the Internet of Things, Work. Secur. , 2012.

[9] C. Hsu, Ubiquitous Intelligence and Computing: building smart environment in real and
cyber space, J. Ambient Intell. Humaniz. , 2012.

80
[10] K. Kiyokawa and M. Hatanaka, Owens LuisA context-aware multi-modal smart office
chair in an ambient environment, Virtual Real. Short , 2012.

[11] D. Ko, D. Bytschkow, and P. Gupta, Establishing a smart grid node architecture and
demonstrator in an office environment using the soa approach, Smart Grid, 2012.

[12] R. Li, The usage of automation system in smart home to provide a sustainable indoor
environment: a content analysis in Web 1.0, a Sustain. Indoor Environ. A Content
Anal. , 2013.

[13] M. Moreno, Usercentric smart buildings for energy sustainable smart cities, Trans. ,
2014.

[14] M. Nati and A. Gluhak, Smartcampus: A user-centric testbed for internet of things
experimentation, (WPMC), 2013 16th , 2013.

[15] S. Offermans, Breakout 404: a smart space implementation for lighting services in the
office domain, (INSS), 2012 Ninth , 2012.

[16] A. De Paola and G. Re, An intelligent system for energy efficiency in a complex of
buildings, Sustain. Internet , 2012.

[17] N. Petroulakis, Life-logging in smart environments: Challenges and security threats,


(ICC), 2012 IEEE , 2012.

[18] U. Sharma and S. Reddy, Design of home/office automation using wireless sensor
network, Int. J. Comput. , 2012.

[19] L. De Silva, C. Morikawa, and I. Petra, State of the art of smart homes, Eng. Appl.
Artif. , 2012.

81
[20] S. Singhal and A. Gankotiya, An investigation of wireless sensor network: a distributed
approach in smart environment, Adv. Comput. , 2012.

[21] S. Tao, M. Kudo, H. Nonaka, and J. Toyama, Person authentication and activities
analysis in an office environment using a sensor network, Constr. Ambient Intell., 2012.

[22] H. Vahdat-Nejad, Context-aware middleware architecture for smart home environment,


J. Smart Home, 2013.

[23] L. Wang, A. Kusiak, and A. Dounis, Guest editorial special section on intelligent
buildings and home energy management in a smart grid environment, Smart Grid, IEEE
Trans. , 2012.

[24] J. Augusto, V. Callaghan, and D. Cook, Intelligent environments: a manifesto,


-Centric Comput. , 2013.

[25] Z. Wang and X. Xu, Smart home m2m networks architecture, Mob. Ad-hoc Sens.
Networks (MSN), 2013.

[26] M. Yusro, K. Hou, and E. Pissaloux, SEES: Concept and design of a smart environment
explorer stick, (HSI), 2013 6th , 2013.

[27] O. Evangelatos, K. Samarasinghe, and J. Rolim, Syndesi: A Framework for Creating


Personalized Smart Environments Using Wireless Sensor Networks, 2013 IEEE Int.
Conf. Distrib. Comput. Sens. Syst., pp. 325330, 2013.

[28] E. Torunski, R. Othman, M. Orozco, and A. El Saddik, The 3rd International Conference
on Ambient Systems, Networks and Technologies (ANT) A Review of Smart
Environments for Energy Savings, vol. 10, pp. 205214, 2012.

82
[29] D. J. Cook, NIH Public Access, vol. 335, no. 6076, pp. 15791581, 2013.

[30] D. J. Cook and S. K. Das, How Smart are our Environments? An Updated Look at the
State of the Art the Role of Physical Components in Smart Environments, pp. 122.

[31] C. Ramos, G. Marreiros, R. Santos, and C. F. Freitas, Smart Offices and Intelligent
Decision Rooms, pp. 851880, 2010.

[32] M. Caruso, M. Mecella, R. Baldoni, L. Querzoni, S. Universit, and S. Universit, Poster


Abstract: User Profiling and Micro-accounting for Smart Energy Management, pp. 1
2.

[33] T. Software, Data Profiling Basics.

[34] V. Degeler, L. I. L. Gonzalez, M. Leva, P. Shrubsole, S. Bonomi, O. Amft, and A. Lazovik,


Service-Oriented Architecture for Smart Environments (Short Paper), 2013.

[35] P. X. Gao, SPOT: A Smart Personalized Office Thermal Control System, pp. 237246,
2013.

[36] J. Gubbi, R. Buyya, S. Marusic, and M. Palaniswami, Internet of Things (IoT): A vision,
architectural elements, and future directions, Futur. Gener. Comput. Syst., vol. 29, no. 7,
pp. 16451660, 2013.

[37] M. Anuar, M. Isa, N. N. Mohamed, H. Hashim, S. Farid, S. Adnan, J. A. Manan, and R.


Mahmod, A Lightweight and Secure TFTP Protocol for Smart Environment, no. Iscaie,
pp. 302306, 2012.

[38] K. O. Mahony, J. Liang, and K. Delaney, Real-time Information Profiling for Smart
Objects, 2011.

83
[39] C. Malavazos, K. Tsatsakis, and T. Tsitsanis, Towards a context aware flexibility
profiling mechanism for the energy management environment, pp. 18.

[40] K. Furdik, G. Lukac, T. Sabol, and P. Kostelnik, The Network Architecture Designed for
an Adaptable IoT-based Smart Office Solution, vol. 1, no. 6, pp. 216224, 2013.

[41] P. Rashidi, S. Member, D. J. Cook, L. B. Holder, and M. Schmitter-edgecombe,


Discovering Activities to Recognize and Track in a Smart Environment, pp. 114.

84
[42] M. Zaki and P. Forbrig, A Methodology for Generating an Assistive System for Smart
Environments Based on Contextual Activity Patterns, pp. 7580, 2013.

85
APPENDIX A:

ARDUINO MICROCONTROLLER

PROGRAM LISTING

Complete Coding of the Ardino micro-controller is given below

RFID authentication module

#include <SPI.h>
#include <Ethernet.h>
#include <sha1.h>
#include <mysql.h>
#include <MFRC522.h>
#define RST_PIN 47 // Configurable, see typical pin layout above
#define SS_PIN 45 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
MFRC522::MIFARE_Key key;
byte asif[]={0x43,0x64,0x09,0x03};
byte osama[]={0xC4,0xD4,0x05,0x6F};
byte mac_addr[] = { 0xDE, 0xAA, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress arduino_addr(192, 168, 0, 3);
IPAddress server_addr(192, 168, 0, 2);
IPAddress telnet_server(192, 168, 0, 1);
EthernetClient client;
Connector my_conn;
char user[] = "IoT";
char password[] = "iot1234";
//const char q[] = "SELECT curtime()";
String time_string;

void setup() {
Ethernet.begin(mac_addr, arduino_addr);
Serial.begin(9600);
mfrc522.PCD_Init();
while (!Serial);
delay(2000);

86
Serial.print("My IP address is ");
IPAddress myIPAddress = Ethernet.localIP();
Serial.println(myIPAddress);
for (byte i = 0; i < 6; i++) {

key.keyByte[i] = 0xFF;
}
//delay(2000);

void loop() {
char *Query;
String name;
String setting;
String temp;
String Fan_value;
String Curtain_value;
String Saver_value;
String Cur_value;
String dev_name;
//Serial.println("Wating for card......");
if ( ! mfrc522.PICC_IsNewCardPresent())
return;

// Select one of the cards


if ( ! mfrc522.PICC_ReadCardSerial())
return;

Serial.println("Card Dtected......");

if(compare_uid_array( mfrc522.uid.uidByte , mfrc522.uid.size, asif , 4))


{Serial.println(F("Card ID user Asif")); name="asif";}
if(compare_uid_array( mfrc522.uid.uidByte , mfrc522.uid.size, osama , 4))
{ Serial.println(F("Card ID user Osama")); name="osama";}
Serial.println("Connecting to database for devices settings retrieval...");
if (my_conn.mysql_connect(server_addr, 3306, user, password)) {
Serial.println("Success!");
Query="Select curtime()";
my_conn.cmd_query(Query);
my_conn.get_columns();
row_values *row = NULL;

87
do {
row = my_conn.get_next_row();
if (row != NULL) {
time_string = (String)row->values[0];
int time_val = time_string.substring(0,2).toInt();
if(time_val>6 && time_val <13) setting="Morn_setting";
if(time_val>13 && time_val <20) setting="Noon_setting";
if(time_val>20 && time_val <11) setting="Eve_setting";
Serial.println(setting);
}
my_conn.free_row_buffer();
}
while (row != NULL);
my_conn.free_columns_buffer();

name.concat("_device_setting");
Serial.println(name);
temp = "Select ";
temp.concat(setting);
temp.concat(" from ");
temp.concat(name);
temp.concat(" Where dev_name='FAN'");
Query=(char *)temp.c_str();
Serial.println(Query);
my_conn.cmd_query("use internet_of_thingsdb");
my_conn.cmd_query(Query);
my_conn.get_columns();
row_values *row1 = NULL;
do {
row1 = my_conn.get_next_row();
if (row1 != NULL) {
Fan_value = (String)row1->values[0];

}
my_conn.free_row_buffer();
} while (row1 != NULL);
my_conn.free_columns_buffer();

Serial.println(Fan_value);
temp = "Select ";
temp.concat(setting);
temp.concat(" from ");
temp.concat(name);
temp.concat(" Where dev_name='SAV'");
Query=(char *)temp.c_str();

88
Serial.println(Query);
my_conn.cmd_query(Query);
my_conn.get_columns();
row_values *row2 = NULL;
do {
row2 = my_conn.get_next_row();
if (row2 != NULL) {
Saver_value = (String)row2->values[0];
}my_conn.free_row_buffer();
} while (row2 != NULL);
my_conn.free_columns_buffer();
Serial.println(Saver_value);
temp = "Select ";
temp.concat(setting);
temp.concat(" from ");
temp.concat(name);
temp.concat(" Where dev_name='CUR'");
Query=(char *)temp.c_str();
Serial.println(Query);
my_conn.cmd_query(Query);
my_conn.get_columns();
row_values *row3 = NULL;
do {
row3 = my_conn.get_next_row();
if (row3 != NULL) {
Cur_value = (String)row3->values[0];

}
my_conn.free_row_buffer();
} while (row3 != NULL);
my_conn.free_columns_buffer();
Serial.println(Cur_value);

//Start contacting to telnet server

if (client.connect(telnet_server,23 )) {
Serial.println("connected to devices controlling card");
//Send some test data to telnet server
dev_name="Fan:";
dev_name.concat(Fan_value);
Serial.println(dev_name);
client.println(dev_name);
Serial.println("FAN Settings sent to controlling card");

89
delay(2000);

dev_name="Led:";
dev_name.concat(Saver_value);
Serial.println(dev_name);
client.println(dev_name);
Serial.println("LED Settings sent to controlling card");
client.stop();
}
else {
// if you didn't get a connection to the server:
Serial.println("Could not send LED setting,connection to devices controlling card failed");
}
Serial.println("Disconnecting from database");
my_conn.disconnect();

}
}
boolean compare_uid_array(byte *mfrcuidarray, int mfrcuidsize,byte *userarray,int
userarraysize) {

boolean match=true;
for(int i=0;i<mfrcuidsize;++i) {

if (mfrcuidarray[i] != userarray[i]) {
match=false;
break;
}
}
return match;
}
The Code for telnet client
/*
Chat Server
A simple server that distributes any incoming messages to all
connected clients. To use, telnet to your device's IP address and type.
You can see the client's input in the serial monitor as well.
Using an Arduino Wiznet Ethernet shield.
*/
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.


// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {

90
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 0, 1);

// telnet defaults to port 23


EthernetServer server(23);
EthernetClient client=0;

#define textBuffSize 9 //length of longest command string plus two spaces for CR + LF
char textBuff[textBuffSize];
int charindex = 0;
int charsWaiting;
int enB = 6;
int in1 = 5;
int in2 = 4;
int enA = 9;
int in3 = 7;
int in4 = 8;
String value;
String received;
void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();

// Open serial communications and wait for port to open:


Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.print("Chat server address:");


Serial.println(Ethernet.localIP());
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);

91
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}

void loop() {

int c;

//if(server.available()) client=server.available();
client = server.available();

if(client) {

charsWaiting=client.available();

while (charsWaiting>0) {

c=client.read();
if(c=='\n') {
// textBuff[charindex]='\0';
// if(strcmp((char*)textBuff,"quit")==0)
{server.println("GoodBye");client.stop();charindex=0;break;}
server.println(textBuff);
Serial.println((char*)textBuff);
received=(char *)textBuff;
// if (received.equals("quit"))
{server.println("GoodBye");client.stop();charindex=0;break;}
// Serial.println(received.length());
value=received.substring(4);
//Serial.println(value);
if(received.substring(0,3)=="Fan") {Serial.println("Setting Fan
value");analogWrite(enA,value.toInt());}
if(received.substring(0,3)=="Led") {Serial.println("Setting LED
value");analogWrite(enB,value.toInt());}

charindex=0;
//client.stop();
break;

}
else {
textBuff[charindex]=c;
// Serial.println(charindex);
--charsWaiting;
++charindex; }}} }

92
APPENDIX B:

Server-Side using PHP

Login Page

<?php

$msg="";

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

session_start();

$_SESSION['emailaddr']=$_POST['emailaddr'];

//$_SESSION['lname']=$_POST['lname'];

DEFINE ('DB_USER', 'IoT');

DEFINE ('DB_PASSWORD', 'iot1234');

DEFINE ('DB_HOST', 'localhost');

DEFINE ('DB_NAME', 'internet_of_thingsdb');

93
$dbconn = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);

if ($dbconn->connect_errno) $msg="Database connection failed" .


$dbconn>connect_errno;

else {

$q="select email,lname, passwd from users where (email='$_POST[emailaddr]' and


passwd=SHA1('$_POST[password]'))";

$result = $dbconn->query($q,MYSQLI_STORE_RESULT);

//$msg = $msg . " " . $dbconn->affected_rows . "result " . $result;

if($dbconn->affected_rows==1) {

list($email,$lname) = $result->fetch_row();

$_SESSION['lname']=$lname;

$dbconn->close();

header("location: update.php");

else {

$msg = $msg . "Your login and password does not match our record, Try again or You need
to register";

$dbconn->close();

94
}

?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>login</title>

<link rel="stylesheet" type="text/css" href="_css/login.css"/>

<script>

function register() {

window.location.href="register.php";

</script>

</head>

<body bgcolor="cyan">

<div id="loginheader">

<h1> InterNet Of Things A project by Hamdard University Students </h1>

</div>

<div id="loginformdiv">

95
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method ="post" >

<table>

<tr><td></td><td><h1>Login</h1></td></tr>

<tr> <td><label>Email Address :</label></td>

<td><input type="email" value="<?php if (isset($_POST['emailaddr'])) echo


$_POST['emailaddr']; ?>" placeholder="abc@email.com" required=""
name="emailaddr" /> </td>

</tr>

<tr><td><label>Password :</label></td>

<td><input type="password" value="<?php if(isset($_POST['password'])) echo


$_POST['password']; ?>" name="password" maxlength="20"/></td>

</tr>

<tr><td></td><td><input type="submit" value="Login" /><input type="button"


value="Register" onclick="register()" /></td></tr>

</table>

</form>

</div>

<p class="error"><?php echo $msg; ?></p>

<div id="footer">

<p>Copyright &copy; Hamdard University

<a href="http://www.hamdard.edu.pk">Hamdard University </a> Valid image

96
<a href="http://jigsaw.w3.org/css-validator/">CSS</a> &amp; image

<a href="http://validator.w3.org/">HTML5</a></p>

</div>

</body>

</html>

Styling for login page

body {

#loginheader {

border:solid;margin:10px auto 0 auto; min-width:960px; max-width:1200px;

height:175px; background-image: url('../_images/tile-pale.jpg'); background-repeat:


repeat;

padding:0; color:white;

#loginheader>h1 {

font-family: "Arial Black"; text-align:justify; font-size: 35px; text-shadow: 5px 5px


#ff0000;

}#loginformdiv {

position: relative; margin-top: 200px; margin-left: 550px; width: 500px; height: 200px;

97
td { width: 100px;

#footer { clear:both; margin:auto; height: 19px; text-align:center;margin-left: 0px;

}p.error {

color: red;

p{

position:relative; margin-left: 100px;

td { width: 150px; text-align: center;

Registration Page
<?php

$msg="";
$table_name = "";
$dbconn="";
$result="";
$addr_present_in_database="";
if($_SERVER['REQUEST_METHOD']=='POST' ) {

if($_POST['password']!= $_POST['cpassword']) $msg="The two passwords do not match,


Please reenter";

else {
$table_name = "$_POST[lname]" . "_" . "device" . "_" . "setting";
DEFINE('DB_USER', 'IoT');

98
DEFINE('DB_PASSWORD', 'iot1234');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'internet_of_thingsdb');
$dbconn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($dbconn -> connect_errno)
$msg = "Database connection failed" . $dbconn -> connect_errno;
else {

$q = "Select email from users";


$result = $dbconn->query($q, MYSQLI_STORE_RESULT);
if($dbconn->errno) {$msg=$dbconn->errno; $dbconn->close();}
else {
$addr_present_in_database=false;
while (list($emailaddr)=$result->fetch_row()) {
if($emailaddr == $_POST['email']) {
$addr_present_in_database=true;

$msg="This email address is already reistered, please try other address";

$dbconn->close();
break;

}
}
if($addr_present_in_database==false) {

$q="Insert into users set fname='$_POST[fname]',


lname='$_POST[lname]',email='$_POST[email]',passwd=SHA1('$_POST[password]'),regi
stration_date=NOW(),userlevel=1 ";

$result = $dbconn->query($q);
if($dbconn->affected_rows==1) {
$q="Create table $table_name (
ID tinyint(2) NOT NULL AUTO_INCREMENT,
Dev_name varchar(4) NOT NULL,
Morn_setting tinyint(2) NOT NULL,
Noon_setting tinyint(2) NOT NULL,
Eve_setting tinyint(2) NOT NULL,
PRIMARY KEY (ID)
)ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
COMMENT='Device Setting info table for user $_POST[lname]'";
$result = $dbconn->query($q);
if($dbconn->errno) $msg = "Table creation failed with error" . " " . $dbconn->errno;
$q="Insert into $table_name set
dev_name='FAN',Morn_setting=0,Noon_setting=0,Eve_setting=0";
$dbconn->query($q);

99
$q="Insert into $table_name set
dev_name='CUR',Morn_setting=0,Noon_setting=0,Eve_setting=0";
$dbconn->query($q);
$q="Insert into $table_name set
dev_name='CUR',Morn_setting=0,Noon_setting=0,Eve_setting=0";
$dbconn->query($q);
$msg=$msg . "You have been registered successfully <a href=\"login.php\">Try
Login</a>";

}
else $msg="Registration failed with error" . " " . $dbconn->errno;
}}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Update Page</title>
<link rel="stylesheet" type="text/css" href="_css/register.css"/>
</head>
<body bgcolor="cyan">
<div id="header">
<h1>InterNet of things User Register Page</h1>
</div>
<div id="formdiv">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table>
<tr><td></td><th><h1>Register</h1></th>
</tr><tr>
<td><label>First Name:</label></td><td>
<input type="text" name="fname" autofocus="" pattern="[A-Za-z]+"
placeholder="FirstName" required="" value="<?php if(isset($_POST['fname'])) echo
"$_POST[fname]"; ?>" />
</td>
</tr><tr>
<td><label>Last Name:</label></td><td>
<input type="text" name="lname" pattern="[A-Za-z]+" placeholder="LastName"
required="" value="<?php if(isset($_POST['lname'])) echo "$_POST[lname]"; ?>"/>
</td></tr><tr>
<td><label>Email Address:</label></td><td>
<input type="email" name="email" required="" placeholder="abc@email.com"
value="<?php if(isset($_POST['email'])) echo "$_POST[email]"; ?>"/>
</td></tr><tr>
<td><label>Password:</label></td><td>

10
0
<input type="password" name="password" required="" value="<?php
if(isset($_POST['password'])) echo "$_POST[password]"; ?>"/>
</td></tr><tr>
<td><label>Confirm Password:</label></td><td>
<input type="password" name="cpassword" required="" value="<?php
if(isset($_POST['cpassword'])) echo "$_POST[cpassword]"; ?>"/>
</td></tr>
<tr><td></td><td>
<input type="submit" value="Register" />
</td></tr></table></form></div>
<div>
<h1 class="error"><?php echo $msg; ?> </h1>
</div>
<div id="footer">
<p>
Copyright &copy; Hamdard University <a href="http://www.hamdard.edu.pk">Hamdard
University </a> Valid image <a href="http://jigsaw.w3.org/css-validator/">CSS</a>
&amp; image <a href="http://validator.w3.org/">HTML5</a>
</p></div></body></html>

Style for Registration


#header {
border:solid;margin:10px auto 0 auto; min-width:960px; max-width:1200px;
height:175px; background-image: url('../_images/tile-pale.jpg'); background-repeat:
repeat;
padding:0; color:white;
}
#header>h1 {
font-family: "Arial Black"; text-align:justify; font-size: 35px; text-shadow: 5px 5px
#ff0000;margin-left: 130px;
margin-top: 60px;
}
table {
position:relative; margin-left: 550px; margin-top: 50px;
}

#footer {
clear:both; margin:auto; height: 19px; text-align:center;
}
h1.error {
color: red; margin-left: 500px;
}
Update Page
<?php
$msg = "";
$table_name = "";

10
1
$dbconn="";
$result="";
session_start();
if (!isset($_SESSION['emailaddr']))
header("location: login.php");
else {
$table_name = $_SESSION['lname'] . "_" . "device" . "_" . "setting";
DEFINE('DB_USER', 'IoT');
DEFINE('DB_PASSWORD', 'iot1234');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'internet_of_thingsdb');
$dbconn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($dbconn -> connect_errno)
$msg = "Database connection failed" . $dbconn -> connect_errno;
else {
if ($_SERVER['REQUEST_METHOD']=='POST') {

//$q="select count(*) from $table_name";


$q="select ID from $table_name";
$result=$dbconn->query($q);
//$rows = $result->fetch_row();
//$rows[0] = $rows[0] + 1;
while(list($ID)=$result->fetch_row())
{$checkbox = "chkbox" . $ID;
if(isset($_POST[$checkbox])) {
$textbox1_name = "textbox" . $ID . 1;
$textbox2_name = "textbox" . $ID . 2;
$textbox3_name = "textbox" . $ID . 3;
$q="update $table_name set Morn_setting
='$_POST[$textbox1_name]',Noon_setting='$_POST[$textbox2_name]',Eve_setting='$_P
OST[$textbox3_name]' where ID=$ID";
$dbconn->query($q);
if($dbconn->errno) $msg=$dbconn->errno;
else $msg="Record successfully updated";
}}
/**for($i=1;$i <$rows[0];++$i) {
$chkbox_name = "chkbox" . $i;
if(isset($_POST[$chkbox_name])) {
//$msg = $msg . $i;
$textbox1_name = "textbox" . $i . 1;
$textbox2_name = "textbox" . $i . 2;
$textbox3_name = "textbox" . $i . 3;
//$msg = $msg . " " . $_POST[$textbox1_name] . " " . $_POST[$textbox2_name] . " " .
$_POST[$textbox3_name];

10
2
$q="update $table_name set Morn_setting
='$_POST[$textbox1_name]',Noon_setting='$_POST[$textbox2_name]',Eve_setting='$_P
OST[$textbox3_name]' where ID=$i";
//$msg=$msg . " " . $q;
$dbconn->query($q);
if($dbconn->errno) $msg=$dbconn->errno;
else $msg="Record successfully updated";
$q="update $table_name set Noon_setting ='$_POST[$textbox2_name]' where ID=$i";
//$msg=$msg . " " . $q;
$dbconn->query($q);
if($dbconn->errno) $msg=$dbconn->errno;
else $msg="Record successfully updated";
$q="update $table_name set Eve_setting ='$_POST[$textbox3_name]' where ID=$i";
//$msg=$msg . " " . $q;
$dbconn->query($q);
if($dbconn->errno) $msg=$dbconn->errno;
else $msg="Record successfully updated";
}} **/}
}
$q = "select * from $table_name";
$result = $dbconn -> query($q, MYSQLI_STORE_RESULT);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Update Page</title>
<link rel="stylesheet" type="text/css" href="_css/update.css"/>
<script>
function logout() {
window.location.href="logout.php";
}
</script></head>
<body bgcolor="cyan">
<div id="header">
<h1>InterNet of things Device Setting Update Page</h1>
</div>
<div id="formdiv">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table>
<caption><?php printf("<h1>Device Table for %s</h1>", $_SESSION['lname']); ?>
</caption>
<?php printf("<tr><th>Device ID</th><th>Device</th><th>Morning
Setting</th><th>Noon Setting</th><th>Evening Setting</th></tr>");?>
<?php

10
3
if($result) {
$id_index=1;
while(list($ID,$DEVNAME,$MORN_SET,$NOON_SET,$EVE_SET)=$result>fetch_row())
{
printf("<tr><td><input type=\"text\" name=%s readonly=\"\" value=%s /></td>",$ID,
$ID);
printf("<td><input type=\"text\" name=%s readonly=\"\" value=%s /></td>",
$DEVNAME,$DEVNAME);
$name="textbox" . $ID . $id_index;

printf("<td><input type=\"number\" min=1 max=9 step=1 name=%s value=%s /></td>",


$name,$MORN_SET);
++$id_index;
$name="textbox" . $ID . $id_index;
printf("<td><input type=\"number\" min=1 max=9 step=1 name=%s value=%s
/></td>",$name,$NOON_SET);
++$id_index;
$name="textbox" . $ID . $id_index;
printf("<td><input type=\"number\" min=1 max=9 step=1 name=%s value=%s
/></td>",$name,$EVE_SET);
$chkbox_name = "chkbox" . $ID;
printf("<td><input type=\"checkbox\" name=%s value=%s /></td></tr>",
$chkbox_name,$ID);
$id_index=1;
}
printf("<tr><td><input type=\"submit\" value=\"Update\"/>");
printf("<input type=\"button\" value=\"Logout\" onclick=logout() /></td></tr>");
$dbconn->close();
}
?>
</table>
</form>
<p><?php echo "<h1 class=\"error\">$msg</h1>"; ?></p>
</div>
<div id="footer">
<p>Copyright &copy; Hamdard University
<a href="http://www.hamdard.edu.pk">Hamdard University </a> Valid image
<a href="http://jigsaw.w3.org/css-validator/">CSS</a> &amp; image
<a href="http://validator.w3.org/">HTML5</a></p>
</div>
</body>
</html>
Style for update page
#header {
border:solid;margin:10px auto 0 auto; min-width:960px; max-width:1200px;

10
4
height:175px; background-image: url('../_images/tile-pale.jpg'); background-repeat:
repeat;
padding:0; color:white;
}

#header>h1 {

font-family: "Arial Black"; text-align:justify; font-size: 35px; text-shadow: 5px 5px


#ff0000;margin-left: 130px;
margin-top: 60px;
}

#formdiv {

border:solid;margin:50px auto 0 auto; min-width:960px; max-


width:1200px;height:300px;
}

h1.error {

color: red; margin-left: 400px;


}
#footer { clear:both; margin:auto; height: 19px; text-align:center;
}

table {

position: relative; margin-left: 300px; margin-top: 70px;


}

10
5

Vous aimerez peut-être aussi