Sunteți pe pagina 1din 21

i

ABSTRACT
Home automation includes centralized control for lighting, HVAC (heating,
ventilation and air conditioning) and appliance management. Generally, houses are
equipped with an independent control panels to control all of the systems.
Moreover, those control panels are often not related each other. So, a complicated,
reliable and compactable smart home will be presented in this thesis. This Internet
of Things smart home will be integrated with web technologies and the control
system of smart home. A sophisticated framework for smart home is based on
internet of things, building automation and wireless sensor network. The system
was developed to use wireless technologies in order to reduce cost and complexity.
Sensors and wireless sensor networks are being deployed around the world,
measuring local and global environmental conditions. IoT smart home technology
enables to safe human lives, be convenient living cultures enhance the comfort and
reduce energy consumption. The internet of things allows household devices that
live inside smart homes to seamlessly communicate through the internet at the
application level through standardized web technologies and protocols.
Technologies like short-range wireless communication, RFID and real-time
localization are becoming largely common, allowing the internet to penetrate into
the real world of the physical objects. Formulas for an important design parameter
of the system with the Internet of Things will be derived in this thesis. Web-based
smart homes will provide flexible solutions to challenges such as home
automation, energy awareness and energy conversation.
ii

ABSTRACT....................................................................................................................................................... i
LIST OF ABBREVIATIONS ............................................................................................................................... 3
LIST OF EQUATIONS ...................................................................................................................................... 3
LIST OF FIGURES ............................................................................................................................................ 3
LIST OF TABLES .............................................................................................................................................. 3
1 Introduction .......................................................................................................................................... 3
1.1 Motivation..................................................................................................................................... 3
1.2 Objectives of the thesis................................................................................................................. 4
1.3 Organization of Thesis................................................................................................................... 4
2 Background Theory ............................................................................................................................... 5
2.1 Control system .............................................................................................................................. 5
2.2 Wireless sensor network............................................................................................................... 5
2.3 Microcontrollers............................................................................................................................ 6
2.3.1 ESP8266................................................................................................................................. 6
2.3.2 Arduino.................................................................................................................................. 6
2.3.3 Raspberry Pi .......................................................................................................................... 7
2.4 TCP/IP ............................................................................................................................................ 8
2.5 Wi-Fi ............................................................................................................................................ 12
2.6 Bluetooth .................................................................................................................................... 12
2.7 Internet of things ........................................................................................................................ 13
2.8 Sensor devices............................................................................................................................. 13
2.8.1 Ultrasonic Sensor ................................................................................................................ 13
2.8.2 DHT22 Temperature and Humidity Sensor ......................................................................... 14
2.8.3 RFID (RC522) ....................................................................................................................... 15
2.8.4 Gas Sensor(MQ2) ................................................................................................................ 15
2.8.5 LDR ...................................................................................................................................... 16
2.9 Building automation theory ........................................................................................................ 16
2.9.1 Data structures.................................................................................................................... 17
2.9.1.1 Data types ....................................................................................................................... 17
2.9.1.2 Data points ...................................................................................................................... 19
3

LIST OF ABBREVIATIONS

LIST OF EQUATIONS

LIST OF FIGURES

LIST OF TABLES

1 Introduction
Many electronics devices such as household appliances are becoming smarter
and smarter. They are equipped with embedded microprocessors and wireless
transceivers, offering limited communication capabilities and providing smart
behavior. Everyday objects are fitted with small, cheap mobile processors, sensors
and actuators. Sensors and wireless sensor networks are being deployed in smart
home solutions, measuring with precision the environmental conditions inside the
home environment. Their advanced sensing functionalities and their increasing
accuracy enable the development of smart home applications that offer advanced
automation. Residences are transformed into smart homes, incorporating
embedded sensors and actuators, and pervasive technology. Typical computing
devices include smart phones, embedded sensors and actuators, radio-frequency
identification (RFID) chips and smart cards. In the near future, homes will offer
new automation possibilities to their residents, increasing their comfort level. By
now, residential smart meters have been introduced in our lives as sensor devices
that measure in small time intervals the energy consumption of a house. Moreover,
smart power outlets are devices that measure the consumption of individual
electrical appliances and control their operation in real-time. It is expected that
smart appliances would handle automatically their function optimally in order to
save energy and perform their task effectively. Smart home equipment with smart
meter, smart appliances and smart power outlets enable the extension of smart
homes into energy-aware environments.
1.1 Motivation
In this thesis, the main contribution is the development of an application
framework for smart homes and the presentation of an inclusive approach for
developing smart home applications based on reusing Web standards. Even though
a number of energy-related applications are discussed, we do not present a novel
technology for energy efficiency. The main innovation lies in the fact that existing
4

Web technologies are combined to develop a generic smart home application


framework that can be easily adapted to future technological and societal
challenges. To address heterogeneity of home devices and smart home
technologies, this work examines whether the Web, as a highly ubiquitous, reliable
and scalable platform, can constitute an effective and efficient application layer for
future smart home solutions. Due to the huge number of smart home technologies
available on the market it is quite difficult to select the most appropriate system
that satisfies the requirements for a specific scenario. To the best of the author's
knowledge there are not adequate comparisons between the different smart home
approaches that provide a decision criteria in order to easily decide which system
should be adopted or implemented. Nevertheless there are few magazine articles
(3) and supplier reviews that often happen to be subjective. This work tries to
spotlight weaknesses and strenghts for the most popular home automation systems
on the market. Further, the study presents the implementation of a smart home
using Arduino and Android open platforms and Wireless communications
(Bluetooth and Wi-Fi).

1.2 Objectives of the thesis


The objectives of proposed research are as follows:
(a) To enhance the smart home system using Internet of Things, Sensors and
WSN
(b) To prevent the smart home from any burglar/intruder and leaking of raw
gas and fire attack
(c) To fully control the smart home from anywhere on the world.
(d) To develop a reliable and effective smart home system
(e) To reduce the human error and 24 hours monitoring, ease of use,
reliability, efficient and fast response
(f) To replace manual system for smart home with an autonomous smart
home
(g) To design a microcomputer using C++ based on adaptive fuzzy logic
1.3 Organization of Thesis
This research is organized as follows: In chapter One, introduction of reliable
and effective IoT smart home system, motivation and objectives of research work.
Chapter two presents the literature review followed by the related works and a
brief overview of smart control system. It also presents principle of classification
of control systems, characteristics of control systems, basic principle of
microcomputer control and fuzzy control system. It also present sensor devices for
5

IoT, Wi-Fi, microcontroller and building automation. In chapter three, we present


the proposed system by using fuzzy logic and theoretical model of proposed
system.

2 Background Theory
2.1 Control system

2.2 Wireless sensor network


A WSN consists of autonomous sensors, which cooperatively monitor physical or
environmental conditions, such as temperature, humidity, sound, vibration,
pressure, motion, pollutants etc. Each sensor runs a multi-hop routing algorithm,
where intermediary nodes function as forwarders, and relaying data packets to a
base station (sink). Base stations have much more computational, energy and
communication resources and act as gateways between sensor nodes and the end
users. The topology of WSN can vary from a simple star network to an advanced
multi hop wireless mesh network. The propagation technique between the hops of
the network can be routing or flooding. The main characteristics of WSN include:
power consumption constraints for nodes using batteries or energy harvesting;
ability to cope with node and communication failures; node mobility;
heterogeneity of nodes; scalability to large deployments; ability to withstand harsh
environmental conditions; and ease of use. WSN play a key role in enabling high-
precision sensor and actuation systems in houses, buildings and surrounding spaces
by providing a reliable, cost-effective and extensible solution. Their equipment can
be placed in existing as well as new structures, without significant changes in the
current infrastructure. Common applications of WSN involve forest fire detection,
air pollution monitoring, health monitoring, industrial control, agriculture and
greenhouse monitoring. WSN can also be deployed in inaccessible rural areas
where human transition is difficult e.g. forests, jungles and volcano. In this
particular deployment, wireless sensor nodes detect seismic events and route them,
through the wireless network to a base station.
Wireless Communication Technologies
Wireless telecommunications enable the transfer of information between two or
more points that are not physically connected. Distances can vary depending on the
environment and technology used for the data transmission. This work focuses
mainly on short-range technologies such as Bluetooth and Wi-Fi.
Wi-Fi
6

Wireless fidelity or Wi-Fi is based on IEEE 802.11a/b/g/n (10) standards for


wireless local area networks. It allows wireless connection to the internet at
broadband speeds. The architecture is comprised of several components that
interact with each other to provide a wireless local area network (10) such as the
physical layer and data link layer. Moreover, MAC procedures are defined for
accessing the physical layer. In a Wi-Fi based network each cell is a basic service
set (BSS). BSS comprises of a set of Wi-Fi stations and clients connect to such
stations. Wi-Fi therefore defines a distributed coordination function among the
peers.
2.3 Microcontrollers

2.3.1 ESP8266
Wi-Fi Module (ESP8266): The ESP8266 ESP-01 is a Wi-Fi module that
allows microcontrollers access to a Wi-Fi network. This module is a self-
contained SOC (System on a Chip) that doesnt necessarily need a microcontroller to manipulate
inputs and outputs as you would normally do with an Arduino, for example, because the ESP-01
acts as a small computer. Depending on the version of the ESP8266, it is possible to have up to 9
GPIOs (General Purpose Input Output). Thus, we can give a microcontroller internet access like
the Wi-Fi shield does to the Arduino, or we can simply program the ESP8266 to not only have
access to a Wi-Fi network, but to act as a microcontroller as well. This makes the ESP8266 very
versatile, and it can save you some money and space in your projects.

2.3.2 Arduino
Arduino is an open source single-board microcontrollers for building digital devices and
interactive objects that can sense and control objects in the physical world. Arduino board
designs use a variety of micropro-cessors and controllers. The boards are equipped with sets of
digital and analog input/output (I/O) pins that may be interfaced to various expansion boards
(shields) and other circuits. The boards feature serial communications interfaces, including
Univer-sal Serial Bus (USB) on some models, which are also used for loading programs from
personal computers. The microcontrollers are typically programmed using a dialect of features
7

from the programming languages C and C++. In addition to using traditional compiler
toolchains, the Arduino project provides an integrated development environment (IDE) based on
the Processing language project.

Figure 1. Arduino uno

Arduino is an open-source electronics prototyping platform. It is claimed that


Arduino is based on flexible, easy-to-use hardware and software. Furthermore, it is
intended for artists, designers, hobbyists, and anyone interested in creating
interactive objects or environments. Arduino can sense the environment by
receiving data from a variety of sensors and can also affect its surroundings by
controlling lights, motors, and other actuators. The hardware comprises of a
processor on board with input/output support. The Arduino board can be extended
with a plethora of add-on modules known as "shields." Shields are boards that can
be plugged on top of the Arduino PCB extending its capabilities. To program the
microcontroller one needs to make a sketch. Sketches are software programs that
are created on a computer using the Arduino IDE using C and C++ languages. The
IDE is also used for transferring the code to the Arduino board. Arduino programs
are composed by a structure,vvalues (variables and constants) and functions (8).
Arduino has several advantages when compared to other microcontroller toolkits.
For example, the software development is platform independent and the developer
can use any platform (e.g Windows, Linux, Macintosh) for programming purposes.
The open nature of Arduino has enabled the emergence of a massive community
which provides a plethora of tutorials online, finally, it is relatively cheap
compared to other prototyping platforms. Therefore, it has been pleasantly
welcomed in the DIY community. In addition, since it was initially developed as
an educational prototyping platform it is relatively easy to learn (9).

2.3.3 Raspberry Pi
The set of open source technologies now exist that combine the power of the PC,
the communication and multimedia technologies of the web, the ability to interact
with the environment of a microcontroller, and the portability of a mobile device.
8

This provides the perfect set of factors allowing us to build cheap devices for our
homes that can interface with commercial devices, but can be tailored for our own
needs while also providing a great tool for learning about technology. For those
familiar with Arduino devices, the Raspberry Pi combined with its shields provide
an all-in-one medium for creating devices without the need for a separate PC or
Macgiving us an alternative to solutions that currently exist. Also, thanks to the
Raspberry Pi's mission of providing an educational tool for those interested in
programming, the addition of the Arduino shield will provide a mechanism for
those who wish to move from writing software that manipulates the Raspberry Pi,
to software that manipulates their environment and provides a pathway for learning
about electronics. This could have the positive effect of bolstering the ranks of
home-brew and Maker clubs with an eye towards home automation and lead to an
ever-greater diversity of tools being produced for the public.

Raspberry Pi hardware specifications


We will briefly go over some of the core components that make up the Raspberry Pi to give you a
better feel for what it is capable of.

The Raspberry Pi is built off the back of the Broadcom BCM2835. The BCM2835 is a multimedia
application processor geared towards mobile and embedded devices.

On top of this, several other components have been included to support USB, RCA, and SD card
storage.
www.it-ebooks.info

2.4 TCP/IP

Fuzzy control system Transmission Control Protocol (TCP) and Internet Protocol (IP) are two
distinct computer network protocols. A protocol is an agreed-upon set of procedures and rules.
When two computers follow the same protocolsthe same set of rulesthey can understand
each other and exchange data. TCP and IP are so commonly used together, however, that TCP/IP
has become standard terminology for referring to this suite of protocols.

Transmission Control Protocol divides a message or file into packets that are transmitted over the
internet and then reassembled when they reach their destination. Internet Protocol is responsible
for the address of each packet so it is sent to the correct destination. TCP/IP functionality is
divided into four layers, each with its own set of agreed-upon protocols:

The Datalink layer consists of methods and protocols that operate only on a link, which
is the network component that interconnects nodes or hosts in the network. Protocols in
the layer include Ethernet and ARP.
The Internet or Networking layer connects independent networks to transport the
packets containing the data across network boundaries. Protocols are IP and ICMP.
9

The Transport layer handles communications between hosts and is responsible for flow
control, reliability and multiplexing. Protocols include TCP and UDP.
The Application layer standardizes data exchange for applications. Protocols
include HTTP, FTP, POP3, SMTP, and SNMP.

TCP/IP technically applies to network communications where the TCP transport is used to
deliver data across IP networks. A so-called "connection-oriented" protocol, TCP works by
establishing a virtual connection between two devices via a series of request and reply messages
sent across the physical network.

Most computers users have heard the term TCP/IP even if they don't know what it means. The
average person on the internet works in a predominately TCP/IP environment. Web browsers, for
example, use TCP/IP to communicate with Web servers. Millions of people use TCP/IP every
day to send email, chat online and play online games without knowing how it works.
10

An Introduction to the Raspberry Pi, Arduino, and Home Automation


We will now look at some of the core-components of the Raspberry Pi board. The following figure
highlights some of these with a description of each provided:

GPIO Pins CPU/GPU SD card port Micro USB Power USB Ethernet Audio RCA HDMI

Dimensions
The Raspberry Pi is a small device coming in at 85.60mm x 53.98mm x 17mm and weighing only
45g. This makes it perfect for home automation, where a small device can be placed in a case and
mounted inside an electrical box, or replace an existing thermostat device on a wall.

3.5mm analog audio jack


The 3.5mm analog audio jack allows you to connect headphones and speakers to the Raspberry Pi.
This is especially useful for audio and media player based projects.

Composite RCA port


You are probably familiar with the composite cables used to hook up your DVD player to the TV.
They usually come in the red, white, and yellow plug variety. The Raspberry Pi has a port for
attaching the yellow video cable from your TV to it, allowing you to use your TV as a monitor.

Two USB 2.0 ports plus one micro USB


USB is one of the most common methods for connecting peripherals and storage devices to a
computer. The Raspberry Pi comes equipped with two of them, allowing you to hook up a keyboard
and mouse when you get started and a micro USB port for powering your device. [ 10 ]
www.it-ebooks.info Chapter 1 [ 11 ]
11

HDMI port
The High Definition Multi-media Interface (HDMI) port allows the Raspberry Pi to be hooked up
to high-definition televisions and monitors that support the technology. This provides an additional
option to the composite RCA port for video and additionally supports audio.
Should you wish to stream video and audio from the web to your TV, this is the port you would
want to use.

SD card port
The main storage mechanism of the Raspberry Pi is via the SD card port. The SD card will be where
we install our operating system and will act as our basic hard disk. Of course, this storage can be
expanded upon using the USB ports.

256 MB/512 MB SDRAM shared with GPU


The Raspberry Pi comes equipped with 256 MB of SDRAM on older versions of the model B and 512
MB on the newer revisions. This isn't a huge amount, and much less than you would expect on a PC,
where RAM is available in gigabytes. However, for the type of applications we will be building, 256
MB or 512 MB of RAM will be more than enough.

CPU
Early in this chapter we touched upon ARM the British manufacturers of central processor unit
(CPU) cores. The Raspberry Pi comes equipped with a 700 MHz, ARM1176JZF-S core part of the
ARM 11 32-bit multi-processor core family.
The CPU is the main component of the Raspberry Pi, responsible for carrying out the instructions of
a computer program via mathematical and logical operations.
The Raspberry Pi is in good company using the ARM 11 series and has joined the ranks of the
iPhone, Amazon Kindle, and Samsung Galaxy.

GPU
The graphics-processing unit (GPU) is a specialized chip designed to speed up the manipulation of
image calculations.
In the case of our Raspberry Pi, it comes equipped with a Broadcom VideoCore IV capable of
hardware accelerated playback and support for OpenGL.
www.it-ebooks.info
12

An Introduction to the Raspberry Pi, Arduino, and Home Automation


This is especially useful if you want to run games or video via your Raspberry Pi, or work on 3D
graphics in an open source application such as Blender.

Ethernet port
The Ethernet port is the Raspberry Pi's main gateway to communicating with other devices and the
Internet. You will be able to use the Ethernet port to plug your Raspberry Pi into a home router such
as the one you currently use to access the Internet, or a network switch if you have one set up.

GPIO pins
The General Purpose Input/Output (GPIO) pins on the Raspberry Pi are the main way of connecting
with other electronic boards such as the Arduino.
As the name suggests, the GPIO pins can accept input and output commands and thus can be
programmed on the Raspberry Pi.
The Arduino shields will be attached to the GPIO via a bridge shield allowing us to transfer data
from sensors soldered to the device back to the Raspberry Pi. This is especially useful in home
automation projects, where we may wish to store sensor data or manipulate motors based upon a
program running on the Raspberry Pi's operating system.

Having touched upon the technical capabilities of the Raspberry Pi, we will now look at the Arduino and the
Raspberry Pi to Arduino shield, a way to connect the two technologies via the GPIO pins. [ 12 ]

2.5 Wi-Fi
Wireless _delity or Wi-Fi is based on IEEE 802.11a/b/g/n (10) standards for
wireless local area networks. It allows wireless connection to the internet at
broadband speeds. The architecture is comprised of several components that
interact with each other to provide a wireless local area network (10) such as the
physical layer and data link layer. Moreover, MAC procedures are de_ned for
accessing the physical layer. In a Wi-Fi based network each cell is a basic service
set(BSS). BSS comprises of a set of Wi-Fi stations and clients connect to such
stations. Wi-Fi therefore de_nes a distributed coordination function (11) among
the peers.

2.6 Bluetooth
Bluetooth is based on a wireless radio system that is designed to remove the need
for cables for short-range devices, such as mice, printers etc. A network that
includes such devices is called a wireless personal area network. Topologies that
are de_ned in Bluetooth are named Piconet and Scatternet. A Piconet is a WPAN
that consists of two or more devices. One of them serves as a master and the
other are slaves. All of the devices in a Piconet are synchronized with each other
using the clock of the master. Slaves communicate only to the master. Master
can communicate with any device. Further, Scatternet comprises of di_erent
Piconets that overlap time and space. Two or more Piconets can be connected
with each other to form a Scatternet. A Bluetooth device can be a part of di_erent
13

Piconets at the same time. This allows the data to ow beyond the range of a
single Piconet. A device can only be a master in one Piconet, but a slave in many
Piconets (10).

2.7 Internet of things


Internet of Things (IoT) is extension of current internet to provide communication, connection,
and internetworking between various devices or physical objects also known as "Things". IoT
term represents a general concept for the ability of network devices to sense and collect data
from the world around us, and then share that data across the Internet where it can be processed
and utilized for various interesting purposes. The Internet of things can be defined as connecting
the various types of objects like smart phones, personal computer and tablets to internet, which
brings in new and useful type of communication between things and people and also between
things [2]. With the introduction of IoT, the research and development of home automation are
becoming popular in the recent days. Home automation system represents and reports the status
of the connected devices in an intuitive, user-friendly interface allowing the user to interact and
control various devices with the touch of a few buttons. Some of the major communication
technologies used by todays home automation system include Bluetooth, Wi-MAX and
Wireless LAN (Wi-Fi), ZigBee, and Global System for Mobile Communication (GSM) [3].Here
we are using Wi-Fi and Bluetooth. It offers the user complete access control of the appliances
through a remote interface. Automation is the use of control systems and information technology
to control equipment, industrial machinery and processes, reducing the need for the human
intervention [4].
The wide variety of potential IoT applications need a software development environment
that ties together the applications, the command, control and routing process and the security of
the node and system. While the importance of software in MCU solutions has increased during
the past few years, for MCUs supporting the IoT, even more software, tools and enablement will
be needed. [4] A broad ecosystem with easily accessible support is the key to enable the
development of embedded processing nodes and IoT applications. [5]

2.8 Sensor devices

2.8.1 Ultrasonic Sensor


An Ultrasonic sensor is a device that can measure the distance to an object by using
sound waves. It measures distance by sending out a sound wave at a specific frequency and
listening for that sound wave to bounce back. By recording the elapsed time between the sound
wave being generated and the sound wave bouncing back, it is possible to calculate the distance
between the sonar sensor and the object.
14

Since it is known that sound travels through air at about 344 m/s (1129 ft/s), you can take the
time for the sound wave to return and multiply it by 344 meters (or 1129 feet) to find the total
round-trip distance of the sound wave. Round-trip means that the sound wave traveled 2 times
the distance to the object before it was detected by the sensor; it includes the 'trip' from the sonar
sensor to the object AND the 'trip' from the object to the Ultrasonic sensor

2.8.2 DHT22 Temperature and Humidity Sensor


We will also need a sensor to measure the temperature and humidity. I used a DHT
sensor which is a digital temperature and humidity sensor. Inside the sensor, there are two parts:
a thermistor to measure the temperature and a humidity sensor. A chip inside the sensor does all
the analog-to-digital conversion. It is really convenient to use with Arduino and comes with a
nice Arduino library. The DHT22 is a basic, low-cost digital temperature and humidity sensor. It
uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a
digital signal on the data pin (no analog input pins needed). It is fairly simple to use, but requires
careful timing to grab data. The only real downside of this sensor is you can only get new data
from it once every 2 seconds, so when using library, sensor readings can be up to 2 seconds old.
Simply connect the first pin on the left to 3-5V power, the second pin to your data input pin and
the right most pin to ground.
15

Figure 3. DHT22 sensor

2.8.3 RFID (RC522)


RFID-RC522 (MF-RC522). The microcontroller and card reader uses SPI for communication
(chip supports I2C and UART protocols but not implemented on library) (Maybe someone
implements?). The card reader and the tags communicate using a 13.56MHz electromagnetic
field. (ISO 14443A standard tags)

2.8.4 Gas Sensor(MQ2)


Gas Sensor (MQ2) module is useful for gas leakage detection (in home and industry). It is
suitable for detecting H2, LPG, CH4, CO, Alcohol, Smoke or Propane. Due to its high sensitivity
and fast response time, measurements can be taken as soon as possible. The sensitivity of the
sensor can be adjusted by using the potentiometer.
16

Fig. 4 GAS sensor (MQ-2)

2.8.5 LDR
A Light Dependent Resistor (LDR) or a photo resistor is a device whose
resistivityis a function of the incident electromagnetic radiation. Hence, they are
light sensitive devices. They are also called as photo conductors, photo conductive
cells or simply photocells.
They are made up of semiconductor materials having high resistance. There are
many different symbols used to indicate a LDR, one of the most commonly used
symbol is shown in the figure below. The arrow indicates light falling on it.

2.9 Building automation theory


1. Physical layer - responsible for sending and receiving commands and data.
2. Medium access control layer - responsible for networking.
3. Network layer - Controls the correct usage of the medium access control
layer.
17

Reliability
Reliability is one of the key factors when one is considering of buying a new device,
vehicle, household item etc. The same applies for home automation systems. If
there is no error detection or correction in a system, there is no way to _nd out if
a command got through to the device it was intended unless you can physically
see or touch the machine. Specially in home automation systems the reliability
in handling some devices is crucial. For instance, a smoke detector managed by
the home automation system required high levels of reliability from the device
and from the system controller.

2.9.1 Data structures


Carefully designed data structures are necessary in order to represent the smart
home in a complex, yet not too complicated fashion.
2.9.1.1 Data types
For correct interpretation of the data, we define a set of data types. Since the
middle layer manages abstract information independent on other layers actual
implementation, but has to be compatible with all possible implementations, those
data types should be generally a flexible superset of commonly used data types.
This means, that for example integer data type has the optional parameter
maximal value, but this parameter does not have to be assigned. We can
represent most data using this set of data types:
Boolean
By default, 0 can also be referred as false and 1 as true. We can also
redefine those strings to represent the real situation better. Therefore, for
some Booleans we can set 0 as off and 1 as on, or no and yes.
This option can make the data more understandable for the end-user, but we
should limit to cases when the meaning is really evident. For a couple such
as left and right wed rather use a List.
Integer
Different systems use different Integer precision. In order to maintain the
precision for all of them, we have to choose the highest one. 21 Middle layer
specification
Optional parameters include:
Unsigned
Minimal Value
Maximal Value
Increment
Real
18

This format is used to represent any number. High precision has to be used
to represent both float and double formats well. The application must also be
careful about real overflow / underflow caused by exceeding precision limit.
Such violations should be reported, but functionality preserved. A possibility
of maintaining some functionality during overflows is rounding to the
precision limit. Optional parameters:
Minimal Value
Maximal Value
Step (indicates maximal precision-rounding while reading the
variable)
Increment (never smaller than step)
The main difference between Step and Increment is that Step is used for
reading, while increment for setting the variable. If Step of temperature is
set to 0.1C, than the real temperature value of 20.73195C appears as
20.7C. Even though the temperature preset for A/C can be modified by
0.1C, we might want to set the Increment to 0.5C so that the user can set
the temperature faster using up/down control.
String
A dynamic implementation is suitable to avoid length limits.
List
A finite ordered list of choices. Loop parameter indicates whether the first
item also follows the last one.
Timestamp
Specifies exact date and time
Percentage

This is not as common data type as the ones above, but Percentage is a very
convenient way of expressing a relative number for example the light is
turned to 30%, laundry machine progress 80% finished and so on.
Percentage is basically a Real value, but we have to be careful about the
conversion. In middle layer, the conversion between Percentage and Real or
Integer is very natural if Minimal / Maximal Values are defined:


= 100%

On the other hand, for mapping between layers we often consider 0=0% and
1=100%.
= 100%
19

2.9.1.2 Data points


Representation of a system variable can be called a data point. There are different
data point structures for different data types. Each data point can have a number of
properties:
Name: serves for data point identification. Full name must be unique within
the whole application, which usually results in repeating area in all the
names such as Living Room Temperature, Bedroom Temperature
Another option would be to enable name unique within the area, so that with
area prefix it is unique in the whole application. The prefix can be invisible
to the user and names therefore shorter. In the second case, however, the
area must be always displayed with name to avoid confusion.
Data Type
Value: of the specified Data Type
Data mapping: Specifies particular connection driver and variable name in
other layer
Description: A brief explanation of what the data point actually represents,
such as Temperature in the living room
Permissions: access information stating which users can read or modify the
Value

Other properties are dependent on the Data type. They include for example:
Min/max value
Increment
Step
Timestamp: time of measurement or last change of the value
Min/max alarm level: exceeding this value causes alarm
others
We will add following optional parameters to all the data points:
Type
Type specifies what kind of object the data point represents. All types are
organized in a customizable hierarchical tree, such as:
ON/OFF
SWITCH LIGHT
DIMMABLE
LIGHTING WINDOW

TYPE SOCKET EMERGENCY

MULTIMEDIA
20

HVAC

We can assign a general object type Light, but if we want to be more


precise we can specify Dimmable. We can also assign the actual model if
its definition library is present. Even then the object is still member of all
Lightning, Light and Dimmable types.
Area
Area parameter indicates the real physical position of the object. The list of
areas is customizable and reflects actual home setting such as: Hall, Living
room, Kitchen, Bathroom, Bed room, Childrens room, Patio, Garage,
Garden Defining those attributes allows us to perform powerful global
action with quantifier like turn off all the appliances and lights in the
kitchen. It can also be used for filtering data points or rules associated with
one room like view all the logic rules connected with lighting and much
more. In middle layer, we will require more functionality from the data
points than just storing data. To avoid timing conflicts in logic, each data
point is equipped with its own timer. Each data point also tracks own history
so that it can raise alarm when a conflict is detected i.e. one rule
systematically turns light on, while another one turns it off. This
functionality can be implemented centrally, or in a distributed manner. In the
later case, we could regard the middle-layer data points as agents.
21

LITERATURE REVIEW AND BACKGROUND THEORY


TCP/IP
Bluetooth
Wifi
WSN wireless sensor network
Building Automation

S-ar putea să vă placă și