Académique Documents
Professionnel Documents
Culture Documents
Control system
1
Table of Contents
Abstract ………………………………………………………………….3
CHAPTER ONE………………………………………………………..4
INTRODUCTION………………………………………………………4
1.1 overview ……………………………………………………………4
1.2 definition of smart building………………………………………4
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
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.
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.
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
1.7 Methodology
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()
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]
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
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
RAM
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
EEPROM
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
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]
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
transducer
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
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
Control system
24
It has two analog input terminals V+ and V- and one binary digital
output Vo The output is ideally
2.5 Oscillator
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.
Control system
26
Fig. 2.6 Frequency Control Networks
LC oscillators
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.
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.
Crystal oscillators
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.
Relaxation 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.
Sweep oscillators
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
Control system
33
transistor instead of Rf. [10]
Crystal Model
Control system
34
Figure 2.13: The equivalent circuit of crystal
Control system
36
Figure 2.14.B: Voltage Regulator (7805)
Control system
37
2.7 Liquid Crystal Display
Control system
38
Line lengths of 8,16,20,24 and 40 character are all standard, in one, two
and four-line versions. [13]
Control system
39
2.8 Serial communications system
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.
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].
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].
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.
Control system
45
2.9.2 Humidity Sensor
Control system
46
Fig. 2.20: Humidity 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.
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
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:
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.
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.
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.
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
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
The first step will be getting video inputs and frames in the right
formats
3. Normalizing images
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.1 IMPORTS
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.
.jpg .png etc cv2.imread() numpy array cv2.imwrite() .jpg .png etc
RGB → GBR → RGB
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.
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
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)
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
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
Control system
64
Figure 4.7: Detecting Faces
Put your picture with 70% of your face and the rectangle to cut.
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.
recognizer.predict(image,collector)
Control system
66
confidence=collector.getDist()
prediction = collector.getLabel()
Control system
67
Annexes
1. Classes
prerocessImage.py
def __del__(self):
self.video.release()
return picturesNorm
facePlotter.py
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
Control system
70
plt.imshow(picture, cmap="Greys_r")
plt.show()
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 *
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)
eigenRec = cv2.face.createEigenFaceRecognizer()
eigenRec.train(pictures, picLabels)
lbphRec = cv2.face.createLBPHFaceRecognizer()
lbphRec.train(pictures, picLabels)
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()
Control system
74
2- Smart and Sustainable Built Environments - Page 178
https://books.google.com/books?isbn=0470759488
4-Wikipedia https://en.wikipedia.org/wiki/Main_Page
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.
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.
15- dictionary.com.
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