Vous êtes sur la page 1sur 77

Implementation of smart building using control systems

Control system
1
Table of Contents
Abstract ………………………………………………………………….3
CHAPTER ONE………………………………………………………..4
INTRODUCTION………………………………………………………4
1.1 overview ……………………………………………………………4
1.2 definition of smart building………………………………………4

1.3 Main reasons for using smart buildings………………………

1.4 the goal of smart building……………………………………..


1.5 Objectives ……………………………………………………
1.6 problem handout……………………………………………….
1.7 Methodology …………………………………………………..
1.8 Research Layout …………………………………………………………
CHAPTER TOW …………………………………………………………………
Components and devises……………………………………………………
2.1 RS-232 …………………………………………………………………
2.2 Microcontroller……………………………………………………………
2.2.1 CPU
2.2.2 Memory …………………………………………………………………
RAM…………………………………………………………………
ROM …………………………………………………………………
EPROM…………………………………………………………………
EEPROM………………………………………
Flash EEPROM ………………………………………
2.3 A/D Converter………………………………………
2.3.1 Data acquisition and Control Systems………………………
Transducer………………………………………
Material of transducer………………………………………
ANALOG INTERFACE CIRCUITS………………………………
ADC………………………………………
2.4 Comparator………………………………………
2.5 Oscillator ………………………………………

Control system
2
2.5.1 Types of oscillator ………………………………………
Sine Wave Oscillators………………………………………
LC oscillators………………………………………
RC (or CR) oscillators………………………………………
Crystal oscillators………………………………………
Relaxation oscillators………………………………………
Sweep oscillators………………………………………
2.5.2 Conventional Crystal Oscillator Circuit……………………
Crystal Model…………………………………………………
2.6 Voltage Regulator (7805) ………………………………………
2.7 Liquid Crystal Display
2.8 Serial communications system……………………………………
2.9 Sensor ………………………………………
2.9.1 Light Sensor ………………………………………
2.9.2 Humidity Sensor………………………………………
Types of Humidity / Dew
Sensors………………………………………
2.9.3 Temperature Sensor………………………………………
2.10 DC Motor ………………………………………
CHAPPTER THREE ………………………………………
SMART BUILDINGS TECHNOLOGY APPLICATIONS………………
3.1 Benefits and advantages of smart buildings……………………
3.1.1 The optimal use of energy………………………………………
3.1.2 Monitoring and control from anywhere outside the building
3.1.3 Added a feature to the property………………………………
3.1.4 Provides building automation security system ………………
An integrated alarm system…………………………………...
Protection from the theft………………………………………
Detect leaking water and gas…………………………………
Detect Fire and smoke………………………………………
3.1.5 Home remote management. …………………………………
Connect to the internet server…………………………………
3.2 Examples of applications of smart public buildings……………
3.2.1 Surveillance cameras in public buildings………………………
3.2.2 Fire Alarm System………………………………………

Control system
3
3.2.3 Energy-saving lighting system…………………………………
Chapter four ………………………………………
Implementation………………………………………
4.1 A USE-CASE………………………………………
4.2 methodology………………………………………
Inputs and Outputs………………………………………
Detecting faces from a live videofeed………………………………
Normalizing images………………………………………
Building the Database………………………………………
Recognizing faces from a live videofeed …………………………
4.3 BUILDING THE IMAGE DATABASE…………………………
4.3.1 IMPORTS………………………………………
4.3.2 VIDEO INPUTS AND FRAMES………………………
4.3.3 READING AND WRITING IMAGES……………………
4.3.4 DETECTING FACES………………………………………
Haar-based features ………………………………………
Integral Image………………………………………
Adaboost………………………………………
Cascading ………………………………………
4.3.5 NORMALIZING IMAGES ………………………………
4.3.6 BUILDING THE DATABASE………………………………
4.4 RECOGNIZING FACES FROM LIVE FEED………………

LIST OF FIGURES

Control system
4
Title Page
Fig 2.1 RS-232
Fig 2.2 Microcontroller

Fig 2.3: Analog To Digital Convertor


Fig 2.4: Data flow in the control system
Fig 2.5: Comparator

Fig. 2.6 Frequency Control Networks

Fig 2.7 LC oscillators

Fig 2.8 RC (or CR) oscillators


Fig 2.9 Crystal oscillators

Fig 2.10 Relaxation oscillators


Fig 2.11 Sweep oscillators
Figure 2.12: Schematic of conventional pierce crystal oscillator.

Figure 2.13: The equivalent circuit of crystal


Figure 2.14.A: Voltage Regulator (7805)
Figure 2.14.B: Voltage Regulator (7805)
Figure2.15 Liquid crystal display
Fig. 2.16: Sensor incorporates several transducers
Fig. 2.17 Circuit diagram of a transistor
Fig. 2.18 Circuit diagram of a phototransistor
Fig. 2.19.A: Light Sensor
Fig. 2.20: Humidity Sensor
Fig. 2.21: Temperature Sensor
Figure 4.1 Edge Features
Figure 4.2 Line Features
Figure 4.3 Center surround Features
Figure 4.4 Finding the Integral image

Control system
5
Figure 4.5 Integral Image algorithm
Figure 4.6 Cascading
Figure 4.7: Detecting Faces

Abstract:
This research aims to study smart buildings in general and the
development of methods applied in this area, the study of the necessary

Control system
6
reasons that led to discover this type of buildings, the study of the most
important technologies applied in this field and the study of smart
buildings through the field of control computers.
In recent years, smart building systems have seen rapid changes
according to introduction of various wireless technologies.
The fast progress in the field of wireless technologies has seen the
emergence of many standards, especially in the
industrial, and scientific research.
RF is an IEEE 802.15.4 standard for data communications with business
and consumer devices.
RF Radio frequency (RF) is any of the electromagnetic wave frequencies
that lie in the range extending from around 3 kHz to 300 GHz, which
include those frequencies used for communications or radar signals.
 RF usually refers to electrical rather than mechanical oscillations.
However, mechanical RF systems do exist is purposed at
applications that require long battery life, low data rate, and secure
networking.
RF has a defined rate of 250kbits/s, best suited for random or periodic
data, or a single signal transmission from a sensor or an input device.
The Smart building System will be implemented in built buildings
environments, without making any changes in the infrastructure of the
building.
The automation focuses on discrimination of voice orders and uses low-
power RF wireless communication modules along with a microcontroller.
This system is most suitable for the elderly and the disabled persons
especially those who live alone and since it involves recognition
of voice; it is secure.
The automation system is intended to control all lights and electrical
appliances inside a house or an office using voice orders or another
commands.
In this work a home automation control system based on voice
recognition is designed

CHAPTER ONE

Control system
7
INTRODUCTION

1.1 overview
The term of smart home began in 1991, It is a building that they can
think of, they can take the decision in the best solutions to create the
right environment for users and this style of buildings when the last-the-
art technological and the latest technology for the management of the
elements for the building using a computer is applied so as to achieve
the greatest flexibility and the comfort and safety of the user, be
electrically controlled, temperature, lighting, air conditioning, alarm and
fire systems, audio and video systems, safety and protection systems, it
can get a full building meets the user needs the least amount of energy
is energy saving is the main reason for the use of smart buildings.
The home automation systems provide mutual interoperability between
various electronic, electrical, and power devices as well as interactive
interface for people to control their operation.
These features are very helpful to optimize and to economize energy
consumption whereby saved energy during some few years could make
more money than home automation systems implementation cost.
These technologies make peoples’ life also easier, especially for elderly
persons and persons with disabilities.

 As a result of this effect the emergence of the term "Smart


Architecture", to take advantage of smart technologies in the
development of some of the concepts and applications that have helped
to move automation technologies to the field of architecture in general,
and then the application of the principle of automation of buildings,
because of the increased development of "artificial intelligence" led
techniques related to research in this area and the development of a
prelude to the emergence of terms associated with these technologies in
the field of architecture and at all levels.
The meaning of the terms "Smart City, Earth Smart" is an innovative city
based on the use of information and communication technologies (ICT)
technological means available to improve the quality of life and

Control system
8
efficiency of urban services to ensure that the needs of users
economically, socially, and environmentally.
Smart City planners looked to favor an integrated approach is the
integrated management of cities as a network linking all sectors.

The aim of this application to increase the quality of life users in through
the use of information and communication technology to improve the
performance of sectors such as transport, energy, safety and reducing
the costs of energy consumption.

Skyscrapers smart, smart school, smart office, best practice examples of


smart city and at the level of the outdoor spaces fired the term
"Intelligent workplace" that uses modern techniques in the management
of some building components such as sensors associated with
computers and working on the operation and move the breakers sun,
and adjust the natural lighting level with heat acquired the level of
result, and there is the term "Smart Spaces" which means improving
outdoor spaces such as lighting and machine guns gardens control
automatically based on the data captured by external sensors

1.2 definition of smart building

Smart building is an integrated system that includes hardware


sophisticated control - touch screens installed or portable such as tablets
and buttons control, through which control and monitor all electrical and
electronic devices at home such as lighting, curtains, air conditioning,
television, audio system, cameras, electrical and doors, and protection
systems from incidents such as theft, detect leaking water and gas

1.3 Main reasons for using smart buildings

- Energy used for lighting, heating provision,


- Smart buildings more flexible
Control system
9
- Reduce energy exchange expenses
- Reduce the incidents of fire and theft risks
- Improve the environment surrounding the building Intelligent
The user is the master of intelligent building system, through sensors
and systems to control and using touch screens and control units
enables the
user to:
- Control of the system of protection and prevention of accidents.
- Control the distribution of sound effects and visual effects.
- Comprehensive control in the operation of energy sources (lighting,
heating, cooling).
- Control of security and safety system

1.4 the goal of smart building

The goal of smart buildings is to provide optimal comfort, which enables


users to achieve maximum productivity and provide a system that allows
climate control in terms of heating, ventilation and air conditioning
.(HVAC) while reducing the cost of energy to the building owner
It is economically important goal to reduce energy use necessary to
achieve at the same time bring convenience to the consumer
To achieve these goals was the establishment of a hierarchical control
system consists a three-level hierarchical control system composed of a
supervisor, coordinators, and local controllers was formulated to meet
this objective such that the building control system learns the
.characteristics of the building and determines the best control strategy
This intelligent building system (IBS) contains local controllers that
control the equipment, a supervisor that monitors predicted
disturbances to anticipate control actions, and coordinators that modify
the supervisor's decisions to compensate for unexpected real-time
.disturbances
The supervisor provides an optimistic plant to operate the building
using past information to predict the performance of the building. This
level can learn the building dynamics and formulate a model from

Control system
10
generic units or "building blocks." These generic units are simple models
.that can be identified with data from the building and its HVAC system
Since comfort is needed only when the building is occupied, a technique
.was developed to predict occupancy using motion sensors
This technique requires no prior knowledge and with sufficient data can
create a probability of occupancy. To minimize energy cost while
maintaining comfort, a cost function was formulated. This functional
.relates comfort and energy costs into a unified performance index
An experimental test bed, composed of three offices, was used to verify
portions of the supervisory control. Motion data was converted into
probability of occupancy profiles, weather forecasts were collected, and
the building model was identified. Predicted building block coefficients
and occupancy profiles showed good correlation with the actual data.
This information, with the performance index, was used to determine
analytically optimal time dependent set points for a room of

1.5 Objectives

The main goals of this research are:


- To study how we can design a smart building automation system
using control components.
Control system
11
- To design an embedded wireless controller system for the thesis

1.6 problem handout

Oftentimes some of people are incapable to control home appliances by


moving all over their house especially if double home (duplex).
Definitely they will suffer to control their home appliances if the house
designed control the appliances by switches, also there are many smart
home system products are selling in the market.
Most of them are not suitable and compatible to current life style due to
used old technology, complicated wired system, less task compliment and
extra.

1.7 Methodology

To be able to make a full system security by using smart building


technology , take advantage of the web camera or any camera instilling
in the entrance of the building, laboratory, offices privacy or any
important place.

Control system
12
We will use OpenCV (Open Source Computer Vision) is a popular
computer vision library, this library started by Intel in 1999.
The platform library sets its focus on real-time image processing and
includes patent-free implementations of the latest computer vision
algorithms. OpenCV 2.3.1 now comes with a programming interface to
C, C++, Python and Android.
OpenCv library of bython, binding designed to solve vision problems, we
will use three algorithms.
The currently available algorithms are:
Eigenfaces → createEigenFaceRecognizer()
Fisherfaces → createFisherFaceRecognizer()
Local Binary Patterns Histograms → createLBPHFaceRecognizer()

1.8 Research Layout

This Thesis contains four chapters.


Chapter one is the introduction. It presents the overview, definition of
smart building, main reasons for using smart building, the goal of smart

Control system
13
building, problem handout of the project, the methodology and
objectives.
Chapter two introduces the components and devices using in smart
building in general.
Chapter three presents the smart building technology applications,
advantages of smart building, examples of applications.
Chapter four includes the implementation for the methodology, the
algorithms using in this statement, results and the annexes which
contain the code for capture the image, draw, store and detect the
faces, building the database for the pictures, finally matching between
the capture image and the database and bring the name of the face.

CHAPTER TOW
Components and devises

2.1 RS-232

Control system
14
Monitoring and control of smart building environment play a significant
role in smart building production and management.
To monitor the smart building environment parameters effectively, it is
necessary to design a control system. Here controlling process takes
place effectively by both manual and automatic manner.
For manual control purpose RS232 it is a serial port was once a standard
feature of a personal computer, used for connections to modems,
printers, mice, data storage, uninterruptible power supplies, and other
peripheral devices is used, which will send status of smart building
environment automatic control process, To control room.
There we can control the activities through PC and send to controller
back which is in smart building environment.
There it will activate the actuator according to our wish, The main
objective is to design a simple, easy to install, microcontroller-based
circuit to monitor and record the values of temperature, humidity, and
sunlight of the natural environment that are continuously modified and
controlled in order optimize them to achieve maximum plant growth
and yield. PIC 16F877A controller is used.
It communicates with the a variety of sensor modules in order to
control the light, aeration and drainage process efficiently inside a smart
building by actuating a cooler, fogger, dripper and lights respectively
according to the necessary condition of the crops.[5]

Fig 2.1 RS-232


2.2 Microcontroller

a control device which incorporates a microprocessor, highly integrated


chip that contains all the components comprising a controller.
Typically this includes a CPU, RAM, some form of ROM, I/O ports, and
timers. Unlike a general-purpose computer, which also includes all of

Control system
15
these components, a microcontroller is designed for a very specific task
-- to control a particular system.
As a result[3], the parts can be simplified and reduced, which cuts down
on production costs, is a single-chip computer, micro suggests that the
device is small and controller suggests that it is used in control
applications.
Another term for microcontroller is embedded controller, since most of
the microcontrollers are built into (or embedded in) the devices they
control [5].
A microcontroller is a very important tool that allows a designer to
create sophisticated input-output data manipulation under program
control. Microcontrollers are classified by the number of bits they
process. Microcontrollers with 8 bits are the most popular and are used
in most microcontroller-based applications. Microcontrollers with 16
and 32

Fig 2.2 Microcontroller

2.2.1 CPU

The CPU is the brain of the microcontroller and this is where all of the
arithmetic and logic operations are performed.

Control system
16
The CU controls the internal operations of the microprocessor and sends
out control signals to other parts of the microcontroller to carry out the
required instructions. [6]
central processing unit: the key component of a computer system,which 
contains the circuitry necessary to interpret and executeprogram instruc
tions

2.2.2 Memory

Memory is an important part of a microcontroller system.


Depending upon the type used us can classify memories into two
groups: program memory and data memory, program memory stores
the program written by the programmer and this memory is usually non-
volatile, i.e. data is not lost after the removal of power. 88888888888,
Data memory is where the temporary data used in a program are Stored
and this memory is usually volatile, i.e. data is lost after the removal of
power. [6]

 RAM

RAM means Random Access Memory, It is a general-purpose memory


which usually stores the user data used in a program. RAM is volatile, i.e.
data is lost after the removal of power.
Most microcontrollers have some amount of internal RAM. 256 bytes is
a common amount, although some microcontrollers have more, some
less. In general it is possible to extend the memory by adding external
memory chips. [6].
It is a type of computer memory that can be accessed randomly; that is,
any byte of memory can be accessed without touching the preceding
bytes. RAM is the most common type of memory found
in computers and other devices, such as printers

 ROM

Control system
17
Is a type of non-volatile memory used in computers and other electronic
devices.
Data stored in ROM can only be modified slowly, with difficulty, or not at
all, so it is mainly used to store firmware (software that is closely tied to
specific hardware and unlikely to need frequent updates) or application
software in plug-in cartridges.
ROM is Read Only Memory, This type of memory usually holds program
or fixed user data.
ROM memories are programmed at factory during the manufacturing
process and their contents cannot be changed by the user.
ROM memories are only useful if you have developed a program and
wish to order several thousand copies of it. [6]

 EPROM

EPROM is erasable Programmable Read Only Memory. This is similar to


ROM, but the EPROM can be programmed using a suitable programming
device. EPROM memories have a small clear glass window on top of the
chip where the data can be erased under UV light. Many development
versions of microcontrollers are manufactured with EPROM memories
where the user program can be stored. These memories are erased and
re-programmed until the user is satisfied with the program. Some
versions of EPROMs, known as OTP (One Time Programmable), can be
programmed using a suitable programmer device but these memories
cannot be erased. OTP memories cost much less than the EPROMs. OTP
is useful after a project has been developed completely and it is required
to make many copies of the program memory. [6]

 EEPROM

EEPROM is Electrically Erasable Programmable Read Only Memory,


which is a non-volatile memory.
These memories can be erased and also be programmed under program
control.

Control system
18
EEPROMs are used to save configuration information, maximum and
minimum values, identification data, etc. Some microcontrollers have
built-in EEPROM memories (e.g. PIC16F84 contains a 64-byte EEPROM
memory where each byte can be programmed and erased directly by
software). EEPROM memories are usually very slow. [6]

 Flash EEPROM

This is another version of EEPROM-type memory.


This memory has become popular in microcontroller applications and is
used to store the user program.
Flash EEPROM is non-volatile and is usually very fast, the data is erased
and then re-programmed using a programming device.
The entire contents of the memory should be erased and then re-
programmed. [6]

2.3 A/D Converter

Analog to digital convert device used to convert analogy data into digital
data we have seen that in a system uses,

Control system
19
Input /Output devices to interface with the outside world, must be
determine the input for the devices that we use to match with the
information about the external world.
More specifically, we study a technique for the system to mensuration
analog inputs using an analog to digital converter (ADC), we will use
periodic interrupts to sample the ADC at a fixed rate.
We will then combine sensors, the ADC, software, PWM output and
motor interfaces to implement intelligent control on our robot .
Certain PIC pins can be set up as inputs to an analog-to-digital converter
(ADC).
The’ 877 has eight analog inputs, which are connected to Port A and Port
E. When used in this mode, they are referred to as AD0–AD7.
The necessary control registers are initialized in CCS C using a set of
functions that allow the ADC operating mode and inputs to be selected.
An additional “device” directive at the top of the program sets the ADC
resolution.
An analog voltage presented at the input is then converted to binary and
the value assigned to an integer variable when the function to read the
ADC is invoked.
The default input range is set by the supply (nominally 0–5 V), if a
battery supply is used (which drops over time) or additional accuracy is
needed, a separate reference voltage can be fed in at AN2 (_ V ref) and
optionally AN3 (–Vr ef ).
If only _ V ref is used, the lower limit remains 0 V, while the upper is set
by the reference voltage.
This is typically supplied using a zener diode and voltage divider.
The 2.56 V derived from a 2V7 zener gives a conversion factor of 10 mV
per bit for an 8-bit conversion.
For a 10-bit input, a reference of 4.096 V might be convenient, giving a
resolution of 4 mV per bit. [8]
The interpolating and averaging ADC is based on the architecture of the
flash ADC, which is the fastest of all ADC architectures. It tries to
overcome the high power consumption disadvantage of the flash ADC by
using analog preprocessing like pre-amplifying, interpolating, folding and
averaging techniques [6].

Control system
20
As a result, lower input capacitance is seen by the input signal because
the comparators are placed after the analog preprocessing. By making
sure that the interpolation network does not load the preamplifiers,
power can be saved [9].
The basic idea of an interpolating and averaging ADC is that the sampled
input analog signal will go through a number of pre-amplification stages
before the comparison and digitization actually takes place. In between
the pre-amplification stages, interpolation will be done to get the
required resolution of the digital output.
Averaging at the output of the interpolation network with the help of
passive elements can improve the accuracy of the digitization. [7]

Fig 2.3: Analog To Digital Convertor

2.3.1 Data acquisition and Control Systems

The measurement signal from the real world is very interest like sound,
distance, temperature, force, mass, pressure, flow, light and

Control system
21
acceleration. Figure shown below shows the data flow graph for a data
acquisition system or control system.
The control system uses an actuator to drive a measured in the real
world to a desired value while the data acquisition system has no
actuator because it simply measures the measured in a nonintrusive
manner

Fig 2.4: Data flow in the control system

 transducer

A transducer is an electronic device that converts energy from one form


to another form.
Common examples include microphones, position and pressure sensors,
thermometers, loudspeakers, and antenna. Although not generally

Control system
22
thought of as transducers, photocells, LEDs (light-emitting diodes), and
even common light bulbs are transducers.
Efficiency is an important consideration in any transducer.
Transducer efficiency is defined as the ratio of the power output in the
desired form to the total power input.
Mathematically, if P represents the total power input and Q represents
the power output in the desired form, then the efficiency E, as a ratio
between 0 and 1, is given by:
E  = Q/P
If we conceder E% represents the efficiency as a percentage, then:
E % = 100Q/P

 Material of transducer

at the first we must determine what material the transducer should be


composed of.
1- Plastic housings are recommended for fiberglass or metal hulls
2- Stainless Steel housings are recommended for steel or aluminium
hulls
Bronze housings are recommended for fiberglass or wood hulls
3- Bronze is preferable to plastic for wooden hulls because the
expansion of wood could damage a plastic transducer and cause a leak.
Installation of a stainless steel housing in a metal hull requires an
insulating, material
A metal housing should NOT be installed in a vessel with a positive
ground system.

Power refers to the strength with which the transducer sends the sonar .
Higher power increases your chances of getting a return echo in deep
water or poor water conditions. It also lets you see better detail, such as
bait fish and structure. Generally, the more power you have, the deeper
you can reach and the easier it is to separate echoes returning from fish
and bottom structure from all the other noises the transducer detects.

 ANALOG INTERFACE CIRCUITS
Control system
23
An interface circuit for use with process controllers
permits analog signals to be input to a process controller through a
binary interface of the process controller and permits analog signals to
be output from the process controller through the binary interface. The
input analog signal is converted to a digital word of N bits.
An identification or end indication and the N bits of the digital word are
transmitted to the process controller at a rate selected for compatibility
with the scan time of the process controller. The process controller
includes a software routine for recognizing the N bits of the digital word.
An equivalent approach is used for outputting analog signals through a
binary interface of a process controller. The interface circuit can include
multiple channels for inputting or outputting multiple analog signals.

 ADC

Analog to digital convert device used to convert analogy data into digital
data we have seen that in a system uses,
Input /Output devices to interface with the outside world, must be
determine the input for the devices that we use to match with the
information about the external world.
More specifically, we study a technique for the system to mensuration
analog inputs using an analog to digital converter (ADC), we will use
periodic interrupts to sample the ADC at a fixed rate. We will then
combine sensors, the ADC, software, PWM output and motor interfaces
to implement intelligent control on our robot ca.

2.4 Comparator

is a Electronics device that compares two voltages or currents or any


signals as readings of duplicate information stored in a digital computer
and outputs a digital signal indicating which is larger
for giving an indication ofagreement or disagreement between them.

Control system
24
It has two analog input terminals V+ and V- and one binary digital
output Vo The output is ideally

The most pervasive method for ADC conversion is the successive


approximation technique, as illustrated in Figure .

Fig 2.5: Comparator

2.5 Oscillator

An oscillator provides a source of repetitive A.C. signal across its


output terminals without needing any input (except a D.C. supply). The
signal generated by the oscillator is usually of constant amplitude.

Control system
25
The wave shape and amplitude are determined by the design of the
oscillator circuit and choice of component values.
The frequency of the output wave may be fixed or variable, depending
on the oscillator design.

2.5.1 Types of oscillator

 Sine Wave Oscillators.

Control system
26
Fig. 2.6 Frequency Control Networks

These circuits ideally produce a pure sine wave output having a


constant amplitude and stable frequency.
The type of circuit used depends on a number of factors, including the
frequency required.
Designs based on LC resonant circuits or on crystal resonators are used
for ultrasonic and radio frequency applications, but at audio and very
low frequencies the physical size of the resonating components, L and
C would be too big to be practical.
For this reason a combination of R and C is used to a control
frequency.
The circuit symbols used for these frequency control networks are
shown in Fig. 2.6.

 LC oscillators

Inductors and capacitors are combined in a resonating circuit that


produces a very good shape of sine wave and has quite good
frequency stability.

Control system
27
That is, the frequency does not alter very much for changes in the D.C.
supply voltage or in ambient temperature, but it is relatively simple, by
using variable inductors or capacitors, to make a variable frequency
(tune able) oscillator.
LC oscillators are extensively used in generating and receiving RF
signals where a variable frequency is required.

Fig 2.7 LC oscillators

 RC (or CR) oscillators

At low frequencies such as audio the values of L and C needed to


produce a resonating circuit would be too large and bulky to be
practical.

Control system
28
Therefore resistors and capacitors are used in RC filter type
combinations to generate sine waves at these frequencies, however it is
more difficult to produce a pure sine wave shape using R and C.
These low frequency sine wave oscillators are used in many audio
applications and different designs are used having either a fixed or
variable frequency.

Fig 2.8 RC (or CR) oscillators

 Crystal oscillators

At radio frequencies and higher, whenever a fixed frequency with very


high degree of frequency stability is needed, the component that
determines the frequency of oscillation is usually a quartz crystal,

Control system
29
which when subjected to an alternating voltage, vibrates at a very
precise frequency.
The frequency depends on the physical dimensions of the crystal,
therefore once the crystal has been manufactured to specific
dimensions, the frequency of oscillation is extremely accurate.
Crystal oscillator designs can produce either sine wave or square wave
signals, and as well as being used to generate very accurate frequency
carrier waves in radio transmitters, they also form the basis of the very
accurate timing elements in clocks, watches, and computer systems.

Fig 2.9 Crystal oscillators

 Relaxation oscillators

These oscillators work on a different principle to sine wave oscillators.

Control system
30
They produce a square wave or pulsed output and generally use two
amplifiers, and a frequency control network that simply produces a
timing delay between two actions.
The two amplifiers operate in switch mode, switching fully on or fully
off alternately, and as the time, during which the transistors are
actually switching, only lasts for a very small fraction of each cycle of
the wave, the rest of the cycle they "relax" while the timing network
produces the remainder of the wave.
An alternative name for this type of oscillator is an "a stable multi
vibrator", this name comes from the fact that they contain more than
one oscillating element.
There are basically two oscillators, i.e. ''vibrators'', each feeding part of
its signal back to the other, and the output changes from a high to a
low state and back again continually, i.e. it has no stable state, hence it
is a stable. Relaxation oscillators can be built using several different
designs and can work at many different frequencies.
A stables may typically be chosen for such tasks as producing high
frequency digital signals.
They are also used to produce the relatively low frequency on-off
signals for flashing lights.

Fig 2.10 Relaxation oscillators

 Sweep oscillators

A sweep waveform is another name for a saw-tooth wave.

Control system
31
This has a linearly changing (e.g increasing) voltage for almost the whole
of one cycle followed by a fast return to the wave’s original value.
This wave shape is useful for changing (sweeping) the frequency of a
voltage-controlled oscillator, which is an oscillator that can have its
frequency varied over a set range by having a variable ‘sweep’ voltage
applied to its control input.
Sweep oscillators often consist of a ramp generator that is basically a
capacitor charged by a constant value of current.
Keeping the charging current constant whilst the charging voltage
increases, causes the capacitor to charge in a linear fashion rather than
its normal exponential curve.
At a given point the capacitor is rapidly discharged to return the signal
voltage to its original value. These two sections of a saw-tooth wave
cycle are called the sweep and the fly-back.
Crystal oscillators are widely used to generate accurate reference
frequency in electronic systems. However, constant frequency comes at
the expense of higher power consumption and thereby affecting the life
of battery, especially in low-power microcontroller unit (MCU) and
watch system. This issue is extremely important in the node of electronic
system in mobile society. [10]
Low power CMOS crystal oscillators have either been optimized for low
current or for have low supply voltage .But in most cases, low supply
voltage cannot satisfy with applications, on the other hand LDO
additional will also Cause the additional current.
So the most important point for a low current consumption is an
amplitude control, which reduces the supply current as soon as the
oscillator amplitude reaches a reasonable value. [10]

Control system
32
Fig 2.11 Sweep oscillators

2.5.2 Conventional Crystal Oscillator Circuit

The conventional crystal oscillator circuit widely used in electronic


system is based on structure of pierce.
The schematic is shown in the Fig.2.12 The conventional pierce crystal
oscillator consists of two parts.
One is an inverting amplifier that supplies a voltage gain and 180 degree
phase shift.
The other is a frequency selective feedback path, which is out of the
chip.
The crystal Combined with C1 and C2 to form a feedback network that
tends to stabilize the frequency and supply 180 degree phase shift to the
feedback path because of the π network.
These conditions conform with the Barkhausen criterion of Oscillation
that overall phase shifts is zero and a closed loop gain should be over or
equal to one.
The feedback resistance Rf, is used to bias the inverting Amplifier to
stabilize the static operating point of amplifier.
Generally the feedback resistance doesn’t require precise resistor but
large numerical value, and so we can use large length and small width

Control system
33
transistor instead of Rf. [10]

Figure 2.12: Schematic of conventional pierce crystal oscillator.

 Crystal Model

Crystal is the main component of generating oscillation clock signal.


However, in simulation we only use its equivalent circuit instead of a crystal.
Fig shows the equivalent circuit of crystal.
R is the effective series resistance in the crystal, as well as L and Cs are the
motional inductance and capacitance of the crystal.
Cp is the parasitic shunt capacitance due to the electrodes.
In parallel resonant mode, the crystal will look and perform like a low
resistance. For generating 32.768 kHz signal, we set L =47.22H, Cs=0.5pF,
Cp=100Pf. [10]

Control system
34
Figure 2.13: The equivalent circuit of crystal

When the crystal is operating at series resonance, it looks. Purely


resistive and the series resonance frequency is given by
Fs = 1/2Π√LC 2.1
When the crystal is operating at parallel resonance, it looks inductive.
And the parallel resonance frequency is given by
Fs =1/2Π√L Cs Cp/Cs+Cp 2.2 [10]

2.6 Voltage Regulator (7805)


Control system
35
7805 is a voltage regulator integrated circuit.
It is a member of 78xx series of fixed linear voltage regulator ICs.
The voltage source in a circuit may have fluctuations and would not give
the fixed voltage output.
The voltage regulator IC maintains the output voltage at a constant
value.
The xx in 78xx indicates the fixed output voltage it is designed to
provide. 7805 provides +5V regulated power supply. Capacitors of
suitable values can be connected at input and output pins depending
upon the respective voltage levels.
Industry is pushing towards complete system-on-chip (SoC) design
solutions that include power management. The study of power
management techniques has increased spectacularly within the last few
years corresponding to a vast increase in the use of portable, handheld
battery operated devices. Power management seeks to improve the
device’s power efficiency resulting
In prolonged battery life and operating time for the device. Power
management system contains several subsystems including linear
regulators, switching regulators, and control logic. The control logic
changes the attributes of each subsystem; turning the outputs on and off
as well as changing the output voltage levels, to optimize the power
consumption of the device. [6]

Figure 2.14.A: Voltage Regulator (7805)

Control system
36
Figure 2.14.B: Voltage Regulator (7805)

Control system
37
2.7 Liquid Crystal Display

LCD (liquid crystal display) is the technology used for displays in


notebook and other smaller computers. Like light-emitting diode (LED)
and gas-plasma technologies, LCDs allow displays to be much thinner
than cathode ray tube (CRT) technology.
LCDs consume much less power than LED and gas-display displays
because they work on the principle of blocking light rather than emitting
it.
Liquid Crystal Display (LCD) has given a new demarcation to the display
devices.
The liquid crystals are used to display image in thin, light computer.
LCD screens are used in most laptop computers as well as in flat panel
monitors.
It has replaced conventional cathode ray tube (CRT) monitors.
The CRTs were preferred for their superior color presentation by
graphics and photography professionals. The constant improvements in
LCDs technology have, however, made the performance nearly
comparable and the differences less noticeable. [12]
LCD panels are trans missive and could not emit light on their own and
therefore require backlights to generate colors on LCD screen, backlight
structure is different in various applications.
Edge type backlights are used for notebooks and monitors, whereas,
direct types are used for LCD TVs.
Light sources used in backlight are also various, which include cold
cathode fluorescent lamp (CCFL), external electrode fluorescent lamp
(EEFL), hot cathode fluorescent lamp (HCFL), flat fluorescent lamp (FFL)
and light emitting diode (LED).
CCFLs, employed in backlighting units (BLU) of LCD, have many
drawbacks including high power consumption, using mercury to create
vapor discharges etc. In tube based technology, CCFLs are usually
susceptible to failures.
The space occupied by CCFLs also constrains in slimming down the
thickness of the LCD panel. [12]
Event limited to character-based modules, there is still wide variety of
shapes and sizes available.

Control system
38
Line lengths of 8,16,20,24 and 40 character are all standard, in one, two
and four-line versions. [13]

Fig. 2.15 Liquid crystal display

Control system
39
2.8 Serial communications system

In telecommunication and computer science, serial communication is


the process of sending data one bit at a time, sequentially, over a
communication channel or computer bus.
This is in contrast to parallel communication, where several bits are sent
as a whole, on a link with several parallel channels.

Serial communication is used for all long-haul communication and most


computer networks, where the cost of cable and synchronization
difficulties make parallel communication impractical.
Serial computer buses are becoming more common even at shorter
distances, as improved signal integrity and transmission speeds in newer
serial technologies have begun to outweigh the parallel bus's advantage
of simplicity (no need for serializer and deserializer, or SerDes) and to
outstrip its disadvantages (clock skew, interconnect density).
The migration from PCI to PCI Express is an example.[4]

Here have been several communication protocols in the embedded


systems like RS-232, Serial Peripheral Interface (SPI), Inter-Integrated
Circuit (I2C), Controller Area Network (CAN) and many more.
But most of these protocols require prerequisite hardware and
sometimes license for the copyrighted Code for the protocol.
Hence in simple applications where this amount of complexity in terms
of communication as well as rights to use is not essential and only some
kind of basic communication is essential, there is a need to develop a
simpler interface to overcome this existing complexity.
The best Alternative would be to develop a new protocol which may not
be the fastest or most efficient, but definitely the simplest, cheapest and
open source. Making this protocol independent of the hardware
platform/requirement would increase the flexibility of the protocol to a
great extent.
The development of such protocol has been brought out in this paper
which elaborates the details of the protocol, the advantages, the
limitations and further possible improvements of the protocol. [14]

Control system
40
 2.9 Sensor

a mechanical device sensitive to light, temperature, radiation level, ort
he like, that transmits a signal to a measuring or control instrument.
Sensor is a device which is used to convert physical quantity into
electrical signal.
A sensor is a device, which responds to an input quantity by generating a
functionally related output usually in the form of an electrical or optical
signal. Sensor's sensitivity indicates how much the sensor's output
changes when the measured quantity changes.
For instance, if the mercury in a thermometer moves 1 cm when the
temperature changes by 1 °C, the sensitivity is 1 cm/°C (it is basically the
slope Dy/Dx assuming a linear characteristic). Sensors that measure very
small changes must have very High sensitivities.
Sensors also have an impact on what they measure; for instance, a room
temperature thermometer inserted into a hot cup of liquid cools the
liquid while the liquid heats the thermometer.
Sensors need to be designed to have a small effect on what is measured;
making the sensor smaller often improves this and may introduce other
advantages. [16]
The purpose of a sensor is to respond to some kind of an input physical
property (stimulus) and to convert it into an electrical signal that is
compatible with electronic circuits.
We may say that a sensor is a translator of a generally nonelectrical
value into an electrical value. When we say “electrical,” we mean a
signal, which can be channeled, amplified, and modified by electronic
devices.
The sensor’s output signal may be in the form of voltage, current, or
charge. These may be further described in terms of amplitude, polarity,
frequency, phase, or digital code.
This set of characteristics is called the output signal format. Therefore, a
sensor has input properties (of any kind) and electrical output
properties.
Any sensor is an energy converter, no matter what you try to measure,
you always deal with energy transfer from the object of measurement to
the sensor.
The process of sensing is a particular case of information transfer, and
any transmission of information requires transmission of energy.
Of course, one should not be confused by an obvious fact that
transmission of energy cans flow both ways.

Control system
41
It may be with a positive sign as well as with a negative sign; that is,
energy flows either from an object to the sensor or from the sensor to
the object.
A special case is when the net energy flow is zero, which also carries
information about existence of that particular case.

For example, a thermopile infrared radiation sensor will produce a


positive voltage when the object is warmer than the sensor (infrared flux
is flowing to the sensor) or the voltage is negative when the object is
cooler than the sensor (infrared flux flows from the sensor to the
object).
When both the sensor and the object are at the same temperature, the
flux is zero and the output voltage is zero. This carries a message that
the temperatures are the same, the term sensor should be distinguished
from transducer.
The latter is a converter of any one type of energy into another, whereas
the former converts any type of energy into electrical energy. An
example of a transducer is a loudspeaker which converts an electrical
signal into a variable magnetic field and subsequently into acoustic
waves [4].
This is nothing to do with perception or sensing.
Transducers may be used as actuators in various systems, an actuator
may be described as an opposite to a sensor; it converts electrical signal
into generally nonelectrical energy.
For example, an electric motor is an actuator it converts electric energy
into mechanical action. Another example is a pneumatic actuator that is
enabled by an electric signal. Transducers may be parts of complex
sensors as shown in Figure. 2.9.
For example, a chemical sensor may have a part, which converts the
energy of a chemical reaction into heat (transducer) and another part, a
thermopile, which converts heat into an electrical signal. The
combination of the two makes a chemical sensor, a device which
produces electrical signal in response to a chemical reagent.
Note that in the above example a chemical sensor is a complex sensor; it
is comprised of a nonelectrical transducer and a simple sensor
converting heat to electricity [4].
This suggests that many sensors incorporate at least one direct-type
sensor and it effects to make a direct energy conversion into an
electrical signal generation or modification. Examples of such physical

Control system
42
effects are photo-effect and See-beck effect in summary, there are two
types of sensors; direct and complex.
A direct sensor converts a stimulus into an electrical signal or modifies
an electrical signal by using an appropriate physical effect, whereas a
complex sensor in addition needs one or more transducers of energy
before a direct sensor can be employed to generate an electrical output.
The direct sensors are those that employ certain physical [5].

Fig. 2.16: Sensor incorporates several transducers

A sensor does not function by itself it is always a part of a larger system


that may incorporate many other detectors, signal conditioners, signal
processors, memory devices, data recorders, and actuators.
The sensor’s place in a device is either intrinsic or extrinsic.
It may be positioned at the input of a device to perceive the outside
effects and to signal the system about variations in the outside stimuli.
Also, it may be an internal part of a device that monitors the devices’
own state to cause the appropriate performance.
A sensor is always a part of some kind of a data acquisition system,
often, such a system may be a part of a larger control system that
includes various feedback mechanisms.
To illustrate the place of sensors in a larger system as in Figure 2.3 shows
a block diagram of a data acquisition and control device.
An object can be anything: a car, space ship, animal or human, liquid, or
gas. Any material object may become a subject of some kind of a
measurement. Data are collected from an object by a number of
sensors.
Some of them (2, 3, and 4) are positioned directly on or inside the
object. Sensor 1 perceives the object without a physical contact and,
therefore, is called a noncontact sensor.
Examples of such a sensor are a radiation detector and a TV camera,
even if we say “noncontact,” remember that energy transfer always
occurs between any sensor and an object.
Sensor 5 serves a different purpose, it monitors internal conditions of a
data acquisition system itself.

Control system
43
Some sensors (1 and 3) cannot be directly connected to standard
electronic circuits because of inappropriate output signal formats.
They require the use of interface devices (signal conditioners).
Sensors 1, 2, 3, and 5 are passive, they generate electric signals without
energy consumption from the electronic circuits.
Sensor 4 is active, it requires an operating signal, which is provided by an
excitation circuit.
This signal is modified by the sensor in accordance with the converted
information [5].

 2.9.1 Light Sensor


A Light Sensor is something that a robot can use to detect the current
ambient light level - i.e. how bright/dark it is. There are a range of
different types of light sensors, including 'Photoresistors', 'Photodiodes',
and 'Phototransistors'. The sensor included in the BOE Shield-Bot kit, and
the one we will be using, is called a Phototransistor.
Basically, a regular transistor is an electrical component that limits the
flow of current by a certain amount dependent on current applied to
itself through another pin - so there is the collector, emitter, and 'base',
which controls how much current can pass through the collector through
to the emitter.

Fig. 2.17 Circuit diagram of a transistor


 

Control system
44
A phototransistor, on the other hand, uses the level of light it detects to
determine how much current can pass through the circuit. So, if the
sensor is in a dark room, it only lets a small amount of current through. If
it detects a bright light, it lets a larger amount of current through.

Fig. 2.18 Circuit diagram of a phototransistor

Light Dependent Resistor (LDR) also known as photoconductor or


photocell, is a device which has a resistance which varies according to
the amount of light falling on its surface.
Since LDR is extremely sensitive in visible light range, it is well suited for
the proposed application. [17]

Fig. 2.19.A: Light Sensor

Control system
45
 2.9.2 Humidity Sensor

A humidity sensor (or hygrometer) senses, measures and reports the


relative humidity in the air.
It therefore measures both moisture and air temperature.
Relative humidity is the ratio of actual moisture in the air to the highest
amount of moisture that can be held at that air temperature.
The warmer the air temperature is, the more moisture it can hold.
Humidity / dew sensors use capacitive measurement, which relies on
electrical capacitance.
Electrical capacity is the ability of two nearby electrical conductors to
create an electrical field between them.
The sensor is composed of two metal plates and contains a non-
conductive polymer film between them. This film collects moisture from
the air, which causes the voltage between the two plates to change,
these voltage changes are converted into digital readings showing the
level of moisture in the air.

 Types of Humidity / Dew Sensors


There are many different kinds of humidity / dew sensors and at Future
Electronics we stock many of the most common types categorized by
accuracy, operating temperature range, humidity range, supply voltage,
packaging type and supply current. The parametric filters on our website
can help refine your search results depending on the required
specifications.
The most common sizes for supply voltage are 3 to 5.5 V and 4.75 to
5.25 V. We also carry humidity / dew sensors with supply voltage as high
as 15 V. Supply current can be between 100 µA and 15 mA, with the
most common humidity / dew sensor chips using a supply current of 100
µA, 500 µA and 2.8 to 4 mA.
The humidity sensor HIH4000, manufactured by Honeywell is used for
sensing the humidity.
It delivers instrumentation quality RH (Relative Humidity) sensing
performance in a low cost, solder able SIP (Single In-line Package)
Relative humidity is a measure, in percentage, of the vapour in the air
compared to the total amount of vapour that could be held in the air at
a given temperature.[17]

Control system
46
Fig. 2.20: Humidity Sensor

2.9.3 Temperature Sensor

Control system
47
A temperature sensor is a device, typically, a thermocouple or RTD, that
provides for temperature measurement through an electrical signal.
A thermocouple (T/C) is made from two dissimilar metals that generate
electrical voltage in direct proportion to changes in temperature.
An RTD (Resistance Temperature Detector) is a variable resistor that will
change its electrical resistance in direct proportion to changes in
temperature in a precise, repeatable and nearly linear manner.

Fig. 2.21: Temperature Sensor

National Semiconductor’s LM35 IC has been used for sensing the


temperature. It is an integrated circuit sensor that can be used to
measure temperature with an electrical output proportional to the
temperature.
The temperature can be measured more accurately with it than using a
thermistor.
The sensor circuitry is sealed and not subject to oxidation, etc. [17]

2.10 DC Motor

Control system
48
A DC motor is any of a class of electrical machines that converts direct
current electrical power into mechanical power.
The most common types rely on the forces produced by magnetic fields.
Nearly all types of DC motors have some internal mechanism, either
electromechanical or electronic, to periodically change the direction of
current flow in part of the motor. Most types produce rotary motion; a
linear motor directly produces force and motion in a straight line.
DC motors were the first type widely used, since they could be powered
from existing direct-current lighting power distribution systems.
A DC motor's speed can be controlled over a wide range, using either a
variable supply voltage or by changing the strength of current in its field
windings.
Small DC motors are used in tools, toys, and appliances, the universal
motor can operate on direct current but is a lightweight motor used for
portable power tools and appliances.
Larger DC motors are used in propulsion of electric vehicles, elevator
and hoists, or in drives for steel rolling mills. The advent of power
electronics has made replacement of DC motors with AC
motors possible in many applications.[4]
Speed control of dc motor could be achieved using mechanical or
electrical techniques.
In the past, speed controls of dc drives are mostly mechanical and
requiring large size hardware to implement.
The development has launched these drives back to a position of
formidable relevance, which were predicted to give way to ac drives.
Some important applications are rolling mills, paper mills mine winders,
hoists, machine tools, traction, printing presses, textile mills, excavators
and cranes.
This paper provides a system that can utilized to use DC motor for
various applications.
We can utilize the DC Motor for various applications by controlling the
speed and orientation according to the field of interest.
Pulse Width Modulation (PWM) is the technique of utilizing switching
devices to produce. [18]
The effect of a continuously varying analog signal.

Control system
49
This PWM conversion generally has very high electrical efficiency and
can be used in controlling either a three-phase synchronous motor or a
three-phase induction motor .
It is desirable to create three perfectly sinusoidal current waveforms in
the motor windings, with relative phase displacements of 120°.
The production of sine wave power using a linear amplifier system would
have low efficiency, maximum of 64%, efficiency can be increase up to
95% if instead of the linear circuitry, fast electronic switching devices are
used, depending on the properties of the semiconductor power switch.
The result is a load current waveform that depends mainly on the
modulation of the duty ratio. [18]

Control system
50
CHAPPTER THREE
SMART BUILDINGS TECHNOLOGY APPLICATIONS

3.3 Benefits and advantages of smart buildings

3.1.1 The optimal use of energy:


This feature is achieved through automatic control of home lighting
(running light - light switch off - dim lighting), heating and cooling
systems while away from home, and this leads to provide a large amount
.of monies spent on consumption
Although the installation of home automation systems requires some
Expenditures, however, that if the system is designed with greater
accuracy the user will benefit some advantages over the long term and
which outweigh those costs, including the decline in electricity and
heating bills, and the security system, which is part of a home
automation system installation will provide your home insurance costs.

3.1.2 Monitoring and control from anywhere outside the


building:
Home user can monitor and control all the systems in play through any
way connected to the Internet, such as a personal computer or smart
.phone devices

3.3.1 Added a feature to the property:


There is no doubt that the house if it contains intelligent systems will be
more attractive for the customer and raise the value of the material

Control system
51
3.3.2 Provides building automation security system
 An integrated alarm system:
 Security systems characterized by multi-range automation system
solutions have been adopted at the technical level and to approve the
integrated into the units warning receiver (Alarm Reception) using
special protocols.
In this case it is controlled alarms (protection devices from theft, fire
detection, water leak) using the unit receiving the alarm related to the
console and the user is informed by phone.
Prove controllers and receiver units by accredited professionals in this
area.
Building automation system and provides installation and system alarms,
which are departments through a phone line option.
You can enter more than one phone number in the system to be
contacted in cases of warning, as the user can connect the system to any
of these numbers for remote control of any of its components.
Control on more than one scenario using the audio menu Smoke sensors
This solution consists of a central panel with illuminated keys and the
necessary hardware to provide the required background cover
(protection devices from theft, fire, water leakage, etc).
The system provides the following protection depending on the settings
specified by the owner of the house which:

 Protection from the theft.

Control system
52
The system relies on sensors movement in the launch of an audible
alarm and warn the user through the phone when it detects an intruder.

 Detect leaking water and gas.


The sensor water leakage close the main water network electrically
activate the valve works to close the main line of water, in the case of
gas leak there are sensors in the kitchen
In some applications to shut down the gas flow through the valve works
electrically activate the sensor leak.

 Detect Fire and smoke.


The system depends on the smoke and heat sensors to detect any fire
inside the building, where it is called an audio alarm and warns the user
by phone

Fire and smoke sensor: The system depends on the smoke and heat
sensors to detect any fire inside the building, where it is called an audio
alarm and warns the user by phone.

3.1.5 Home remote management.

Control system
53
Connect to the Internet server.
This server provides the user to control the installation from any
computer or handheld PDA or any other device with a web browser.
The user can access the system through a local area network, or remote
access via the Internet using the IP address.
The user must log on to the system so that the user can manage all
subsystems in the building (review and control the status of lighting,
control the temperature of each room separately, control and tuned the
blinds or awnings, review the status of the alarm, control the audio to
certain places channels, and plans to activate the system).
Administration program on the iPhone and any device that supports the
Android operating system: This program uses the iPhone on your device
to control all components of home automation.

3.2 Examples of applications of smart public buildings


3.2.1 Surveillance cameras in public buildings

Control system
54
The building is covered with a digital security cameras; and every floor is
covered with cameras to monitor all movements on each floor, and
.depends on the recording cameras motion detection feature

And it is monitoring and control of the garage of the building using


cameras and distributed to cover all entry and exit gates, stairs and
elevators.

It is necessary to the existence of other cameras at the entrances of the


building to control the elevators and visitors coming to the building.

The cameras register every movement and by reservation safely


.recordings in the security management of the building
The person responsible for security can surveillance cameras from his
office, and any camera monitors the movement of a pop-up screen
appears for him to control.

3.2.2 Fire Alarm System.


Must include each floor smoke detector devices to detect any source of
smoke, and points of contact at each ladder to advertise manually fire,
.reviews the existence of the fire to evacuate the building quickly
All connected to the smoke detection motherboard devices on the
ground floor, and the screen is available for the security officer to
monitor the fire alarm system showing the alerts in the form of a pop-up
.window on its own screen to take the necessary action immediately
Either in the garage must inauguration devices to detect heat is used for
the detection of any fire since it can not be used for fire detectors in the
.garage because the car exhaust will give wrong alert system
And it can contain the building on the sprinklers to extinguish the fire to
ensure the highest levels of safety and protection possible against fire.

3.2.3 Energy-saving lighting system


In public buildings it is better to use intelligent lighting to save energy
and avoid wasted and the goal of the objectives of smart buildings
Control system
55
Possible application of energy-saving put sensitive devices each floor of
the movement-sensitive (PIR) lighting operates automatically when you
exit the elevators of any individual or his rise to international peace and
lighting continue for a certain period after the end of the movement and
then turns off to save energy.
And using motion sensors (PIR) on each floor to light up the peace users

Chapter 4
Implementation

Control system
56
4.1 A USE-CASE
For a practical facial recognition use case.
We’ll be using the openCV library in Python to detect from a live web
camera and match them with faces stored in a database.

4.2 METHODOLOGY

This implementation phase will be achieved in the processes


enumerated below:

1. Inputs and Outputs

The first step will be getting video inputs and frames in the right
formats

2. Detecting faces from a live videofeed

This step would involve using specific algorithms to detect and


capture faces from a live video feed.

3. Normalizing images

This step focuses on normalizing the image attributes in terms of


color, size, and intensity.

4. Building the Database

This would involve storing images from different persons in a

database.

Control system
57
5. Recognizing faces from a live videofeed

The final phase would be detecting faces from a live feed and
comparing them (using some algorithms) to the images stored in the
database to get a match.

4.3 BUILDING THE IMAGE DATABASE

4.3.1 IMPORTS

OpenCV is a library in python which is an open source vision and


machine learning software. The library includes a comprehensive set of
robust algorithms. For this scenario, some algorithms we’ll be
considering include detecting faces, recognizing faces, and finding similar
images from an image databases. It has support for many programming
languages and can be run on many operating system platforms.
We’ll be employing other libraries for the development of our program
such as Numpy, matplotlib, math, IPython, and some other custom
classes and functions useful for the program.

4.3.2 VIDEO INPUTS AND FRAMES

We’ll use the builtin camera in a normal computer system to


stream videos to our program.

Control system
58
The web camera is instantiated by calling the VideoCapture() method
(See Annex below for full description of program code).
The quality of the video depends on the resolution (in megapixels) of the
camera we are using. The video feed is displayed in an external window.
To get pictures, the video is split into frames; the consecutive
presentation of frames constitute the video. Each frames in which the
video is split into is a numpy array and can be plotted using the
matplotlib library.
OpenCV, by default, deals with videos and pictures in BGR format. For
consistency, we convert the videos and pictures to RGB.

Image File → OpenCV → Image File

.jpg .png etc cv2.imread() numpy array cv2.imwrite() .jpg .png etc
RGB → GBR → RGB

Table 4.1 OpenCV read and Write

4.3.3 READING AND WRITING IMAGES

The frames can be read or written to file with the cv2.imread and
cv2.imwrite functions respectively.
These values below indicate the modes in which images can be read.
➔ 1 = cv2.IMREAD_COLOR
➔ 0 = cv2.IMREAD_GRAYSCALE
➔ -1 = cv2.IMREAD_UNCHANGED
Images can also be written in different formats as desired.

4.3.4 DETECTING FACES

Control system
59
Detecting face can be done using many algorithms. One
interesting algorithm for object detection is the Viola–Jones object
detection framework used to provide competitive object detection rates
in real-time proposed in 2001 by Paul Viola and Michael Jones.[1] It
can be used to detect different objects although it was primarily
developed to detect faces.
It uses the following features and algorithms.

 Haar-based features

Examples of the features are described below.

Figure 4.1 Edge Features

Figure 4.2 Line Features

Control system
60
Figure 4.3 Center surround Features

The features give high output when the regions are similar.
The output generated is given by the formula:
Output =Σ ( pixels∈¿ area)−Σ( pixels ∈¿ area)

Problems arise though because the number of computations that


need to be carried out are very high. For instance, a 24 by 24” could give
over 160,000 features and the sum of pixel intensities need to be
calculated each time any of these features are applied.

 Integral Image

Control system
61
This algorithm tends to solve the problem described above -
reducing the number of calculations being carried out.
For instance, if we have to find the integral image, S, of a square in the
image below, the formula is given by:

S = ∑C + ∑A − ∑B − ∑D

Figure 4.4 Finding the Integral image

Figure 4.5 Integral Image algorithm

The idea is to convert each pixel intensity by the sum of all pixel
intensities to the left and above it prior to applying the Haar features.

Control system
62
This reduces our computation to just 4 numbers for each square.

 Adaboost

Even after getting the integral image, the features are still quite a
lot. Adaboost solves this problem by reducing the number of features.
This is achieved by the formula below:
F (x)=α 1 f 1( x)+α 2 f 2( x )+ α 3 f 3(x )...+ α nf n( x)

Weak classifiers: f n(x) ,, Strong classifier: F(x), and the bigger the
weight α the more relevant the feature is. If the total amount of
features, for instance, were 160000+, after Adaboost, they can be
reduced 6000 features.

Control system
63
 Cascading

Finally, cascading separates features in different classifiers and


discard features that are not of interest if really sure.

Figure 4.6 Cascading

There are a list of pre-trained models available for detection of


faces.
For this project, we’ll be employing the haarcascade_frontalface_alt
model.

Control system
64
Figure 4.7: Detecting Faces

Put your picture with 70% of your face and the rectangle to cut.

4.3.5 NORMALIZING IMAGES

To get the most out of the images detected, we need to perform


some operations to normalize the images from the videos. First, a

Control system
65
rectangle is cut around the face to get the most of the face while
reducing background noise as shown below. The picture is converted to
grayscale with the complete grayscale spectrum, [0-255], used to
normalize the intensity.
The intensity is also enhanced.
Finally, our pictures are taken to a particular size.

4.3.6 BUILDING THE DATABASE

After detecting and normalizing the images, they are saved in a


directory.
To build the database and to aid learning of the models, each person
takes 20 pictures, which is stored in jpg format.
The faces are detected for every second or so.

4.4 RECOGNIZING FACES FROM LIVE FEED

When our database of images is set, we can now train models to


recognize images from a live feed.
To accomplish that, we employ recognition models.
For this project, we employed the following recognition models - Eigen
Faces, Fisher Faces, and LBPH Faces.
They are instantiated by calling the functions in the OpenCV library.
The models are trained by accessing the pictures that have been stored
in the database created.
A numpy array of images is built by the trainer and a list of labels
corresponding to the saved images is also built.
To make a prediction using OpenCV 3.1.0, the model recognizes a
picture by making a prediction and attaching the corresponding label to
it.
The prediction is made by getting the confidence value. The functions
are described below.
Collector = cv2.face.MinDistancePredictCollector()

recognizer.predict(image,collector)

Control system
66
confidence=collector.getDist()

prediction = collector.getLabel()

The result will be presented in three different numbers along with


the name of the person. Each number correspond to a function (Eigen
Faces, Fisher Faces and LBPH Faces).
The numbers denoted as Confidence, it is the distance between the
object (Face) and the web camera.
The bigger the number the farther the distance.

Control system
67
Annexes

1. Classes

prerocessImage.py

import cv2, cv2.face

#Class to instantiate video capture


class VideoCamera(object):
def __init__(self, index=0):
self.video = cv2.VideoCapture(index)
self.index = index
print self.video.isOpened()

def __del__(self):
self.video.release()

def getFrame(self, inGrayscale=False):


_, frame = self.video.read()
if inGrayscale:
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
return frame

#Cut faces from background to eliminate noise


def cutFaces(picture, faceCoord):
faceArray = []
for (x, y, w, h) in faceCoord:
w_rm = int(0.1 * w / 2)
faceArray.append(picture[y: y + h, x + w_rm: x + w - w_rm])
return faceArray

#Normalize picture color to specific intensities


def normalizeIntensity(pictures):
Control system
68
picturesNorm = []
for picture in pictures:
isColor = len(picture.shape) == 3
if isColor:
picture = cv2.cvtColor(picture,
cv2.COLOR_BGR2GRAY)
picturesNorm.append(cv2.equalizeHist(picture))
return picturesNorm

#Resize faces conform to specific dimensions


def resize(pictures, size=(200, 200)):
picturesNorm = []
for picture in pictures:
if picture.shape < size:
pictureNorm=cv2.resize(picture,size,interpolation=cv2.INTER_
AREA)
Else:
pictureNorm=cv2.resize(picture,size,interpolati
on=cv2.INTER_CUBIC)
picturesNorm.append(pictureNorm)

return picturesNorm

#Getting all the functions together


def normalizeFaces(frame, faceCoord):
faceArray = cutFaces(frame, faceCoord)
faceArray = normalizeIntensity(faceArray)
faceArray = resize(faceArray)
return faceArray

facePlotter.py

from matplotlib import pyplot as plt

Control system
69
import cv2, cv2.face

xmlPath = "xmlFiles/frontal_face.xml"

class FaceDetect(object):
def __init__(self, xmlPath):
self.classifier = cv2.CascadeClassifier(xmlPath)
#Function to detect a face in the live output
def detect(self, picture, biggest_only=True):
scale_factor = 1.2
min_neighbors = 5
min_size = (30, 30)
biggest_only = True
flags = cv2.CASCADE_FIND_BIGGEST_OBJECT |
cv2.CASCADE_DO_ROUGH_SEARCH if biggest_only else
cv2.CASCADE_SCALE_IMAGE
#Getting the coordinates of the picture frame
faceCoord = self.classifier.detectMultiScale(picture,
scaleFactor=scale_factor, minNeighbors=min_neighbors,
minSize=min_size, flags=flags)
return faceCoord

#Define function to draw rectangles around picture frame


def drawRectangle(picture, coords):
for (x, y, w, h) in coords:
w_rm = int(0.1 * w / 2)
cv2.rectangle(picture, (x + w_rm, y), (x + w - w_rm, y + h),
(0, 0, 150), 5)

#Define function to plot picture frames


def showPlot(picture, title=""):
if len(picture.shape) == 3:
picture=cv2.cvtColor(picture, cv2.COLOR_BGR2RGB)
plt.axis("off")
plt.title(title)

Control system
70
plt.imshow(picture, cmap="Greys_r")
plt.show()

2. Building the Database

import numpy as np
from matplotlib import pyplot as plt
import cv2, cv2.face, re, os, math
from IPython.display import clear_output
from IPython import display
from facePlotter import *
from preprocessImage import *

#Instantiate VideoCamera class to get videos in frames


camera = VideoCamera()
#Load the detector type that will be used
detector = FaceDetect("xmlFiles/frontal_face.xml")

#Input name where picture frames will be stored


directory = "PictureDatabase/" + raw_input('Your Name: ').lower()
regexp = re.compile(r'^(PictureDatabase\/)\s*$')

#Instantiate an external window to get videos


cv2.namedWindow("Face Detector", cv2.WINDOW_AUTOSIZE)

#Match input to ensure it isn't an empty string


if regexp.search(directory) is None:
#Check if name already exists
if not os.path.exists(directory):
os.mkdir(directory)
piccounter = 1
timer = 0
#Take 20 pictures
while piccounter < 21:
Control system
71
frame = camera.getFrame()
#Detect a face frame
faceCoord = detector.detect(frame)
#For every second or so
if len(faceCoord) and timer % 700 == 50:
#Normalize pipeline
faceArray = normalizeFaces(frame, faceCoord)
#Save image in directory and show saved image
cv2.imwrite(directory + '/' + str(piccounter) +
'.jpg', faceArray[0])
showPlot(faceArray[0], "Pictures Saved:" +
str(piccounter))
#Saved face in directory
clear_output(wait=True)
piccounter += 1

#Draw rectangle around face frame


drawRectangle(frame, faceCoord)
#Live feed in external window detecting frames
cv2.imshow("Face Detector", frame)
cv2.waitKey(50)
timer += 50
#Close open windows
cv2.destroyAllWindows()
else:
print "This name already exists.\nPlease input another
name.\nOr exit this program."
else: print "There is no input. Please input a name."
del camera

3. Detecting Faces

import numpy as np
from matplotlib import pyplot as plt
import cv2, cv2.face, os

Control system
72
from IPython.display import clear_output
from IPython import display
from facePlotter import *
from preprocessImageimport *

def collect_dataset():
pictures = []
picLabels = []
picLabels_dic = {}
people = [person for person in os.listdir("PictureDatabase/")]
for i, person in enumerate(people):
picLabels_dic[i] = person
for picture in os.listdir("PictureDatabase/" + person):
pictures.append(cv2.imread("PictureDatabase/" +
person + '/' + picture, 0))
picLabels.append(i)
return (pictures, np.array(picLabels), picLabels_dic)

pictures, picLabels, picLabels_dic = collect_dataset()

eigenRec = cv2.face.createEigenFaceRecognizer()
eigenRec.train(pictures, picLabels)

# needs at least two people


fisherRec = cv2.face.createFisherFaceRecognizer()
fisherRec.train(pictures, picLabels)

lbphRec = cv2.face.createLBPHFaceRecognizer()
lbphRec.train(pictures, picLabels)

print "Models have been trained successfully"

Control system
73
camera = VideoCamera()
frame = camera.get_frame()
detector = FaceDetect("xmlFiles/frontal_face.xml")
frame = camera.getFrame()
faceCoord = detector.detect(frame)
faceArray = normalizeFaces(frame, faceCoord)
face = faceArray[0]
showPlot(face)

predCollector = cv2.face.MinDistancePredictCollector()

eigenRec.predict(face, predCollector)
conf = predCollector.getDist()
pred = predCollector.getLabel()
print "Eigen Faces --> Prediction: " + picLabels_dic[pred].capitalize() + "
Confidence: " + str(round(conf))
fisherRec.predict(face, predCollector)
conf = predCollector.getDist()
pred = predCollector.getLabel()
print "Fisher Faces --> Prediction: " + picLabels_dic[pred].capitalize() + "
Confidence: " + str(round(conf))

lbphRec.predict(face, predCollector)
conf = predCollector.getDist()
pred = predCollector.getLabel()

print "LBPH Faces --> Prediction: " + picLabels_dic[pred].capitalize() + "


Confidence: " + str(round(conf))

References and Bibliography

1- Smart Buildings Systems for Architects, Owners and Builders - Page 72


https://books.google.com/books?isbn=0080889697

Control system
74
2- Smart and Sustainable Built Environments - Page 178
https://books.google.com/books?isbn=0470759488

3- Energy Management in Buildings Using Photovoltaics - Page 19


https://books.google.com/books?isbn=1447123832

4-Wikipedia https://en.wikipedia.org/wiki/Main_Page

5- Dogan Ibrahim, 2008, "Advanced PIC Microcontroller Projects in C",


Newness publications, USA.

6- Dogan Ibrahim, 2006, PIC BASIC Projects, Newnes publications, USA

7- Ricky Yuen, 2002," Analog to Digital Converter in Wireless Local Area


Network IEEE 802.11a", November 19, 3-4

8- Martin P.Bates, - ," Programming 8 bit PIC Microcontroller in C"


Newnes publications, USA

9- Dogan Ibrahim, 2008, "Advanced PIC Microcontroller Projects in C",


Newness publications, USA

10- Qichao Zha & Tiejun Lu& Yu Zong & Jianhui Zhang & Shaoxian Qu,
2013, "Design of CMOS Crystal Oscillator with Low Power Consumption",
International Journal of Information and Electronics Engineering, Vol. 3,
No. 6,630-631.

11- Robert J. Milliken&Jose Silva-Martínez& Senior Member& IEEE&


Edgar Sánchez-Sinencio , Fellow, IEEE, 2007," Full On-Chip CMOS Low-
Dropout Voltage Regulator", IEEE TRANSACTIONS ON CIRCUITS AND
SYSTEMS—I: REGULAR PAPERS, VOL. 54, NO. 9,1.

Control system
75
12- Ankita Tyagi1 & Dr. S. Chatterjee, 2013," Liquid Crystal Display:
Environment & Technology, "International Journal of Environmental
Engineering Science and Technology Research, Vol. 1, No. 7, 2.

13- Julyan Ilettm, 1977," How to use Intelligent L.C.D.s", everyday


practical electronic magazine, 4.

14- Chetan Patil, 2011, "Development of a Simple Serial Communication


Protocol for Microcontrollers (SSCPM)", International Journal of
Scientific and Research Publications, Volume 1, Issue 1, ISSN 2250-3153.

15- dictionary.com.

16- S.Thenmozhi1 &M.M.Dhivya2 &R.Sudharsan& K.Nirmalakumari ,


2014," Greenhouse Management Using Embedded System and Zigbee
Technology",International Journal of Advanced Research in Electrical,
Electronics and Instrumentation Engineering, Vol. 3, Issue 2, 3.

17- Purna Prakash Dondapati& K. Govinda Rajulu, 2012" An Automated


Multi Sensored Green House Management, "International Journal of
Technological Exploration and Learning (IJTEL) Volume 1 Issue 1m1-3.

18 - Jeetender Singh Chauhan & Sunil Semwal,2013," Microcontroller


Based Speed Control of DC Geared Motor Through RS-232 Interface
With PC ",.Jeetender Singh Chauhan, Sunil Semwal " ,International
Journal of Engineering Research and Applications (IJERA) ISSN: 2248-
9622

19 - Viola–Jones object detection framework. Visited August 2016, from


Wikipedia: https://en.wikipedia.org/wiki/Viola
%E2%80%93Jones_object_detection_framework

Control system
76
20- Face Detection using Haar Cascades. Visited August 2016, from
OpenCV Website:
http://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html
Haar-like features. Visited August 2016, from Wikipedia:
https://en.wikipedia.org/wiki/Haar-like_features

Control system
77

Vous aimerez peut-être aussi