arduino based security
arduino based security
Abstract - The article describes design and realization of Unauthorized entry can be detected by motion sensors or
security system based on single-chip microcontrollers. System magnetic contacts that can guard the opening of doors and
includes sensor modules for unauthorized entrance detection windows. As an additional event within the building, a fire
based on magnetic contact, measuring carbon monoxide level, can be considered, which can be watched by temperature
movement detection and measuring temperature and humidity.
sensors or smoke detectors and another event like cracked
System also includes control unit, control panel and
development board Arduino with ethernet interface connected water pipes, which can be indicated by humidity sensors.
for web server implementation. Furthermore, the security system should include elements to
collect and process data about the measured values and states
Keywords - Microcontroller, Security system, Intelligent and provide them to the main control element which
sensors, Smart home processes and evaluates the alarm states of all data. These
elements will be the single chip microcomputers. It will be
I. INTRODUCTION necessary to select specific types according to selected
criteria.
In today’s world, the automation is growing increasingly
not only in industry area, but also in homes. These homes are The development of security system require introduction
called smart and the main advantage is security system with to these single chip microcontrollers, their architecture, type
wide spectrum of sensors to detection movement, series, technical parameters, and the possibilities of
temperature, smoke, vibration, broken glass or for example programming [2].
mechanical changes like opening doors or windows. The use
of security systems is not limited to smart homes only, but Modern security systems are also capable of providing the
also to various industrial and public objects. data to a user remotely using mobile technology. For this
purpose, the web server could be created.
The global market offers whole range of security systems
from different companies. The most common use is relating As a motion detector was chosen a passive infrared
to the already mentioned smart homes. Today, smart homes detector PIR labelled as SB00322A-1 with logic output. An
do not include security system only, but also different types of intelligent MQ-9 sensor with analogue output was selected to
actuators to control some smart home elements. detect gas and carbon monoxide. Additionally, the DHT11
module has been selected with a digital output for temperature
Commercial security systems are offered as wired, and humidity measurement, and the P-MK472 magnetic
wireless or mixed. The wired connection can be further contact can be used for door and window monitoring.
divided into the direct connection of the sensors to the control
unit via the I/O interface or they can be connected to each Since the security system contains a main microprocessor
other and to the unit via a bus. Each of these methods has its that will communicate with microcontrollers processing data
own advantages and choice depends only on the customer's from individual sensors, it will be Master - Slave
priorities [1]. communication. Communications should also not be limited
by distance. The supervised object may not only be a
This article deals with design and implementation of own household but also a large object. These criteria meet the RS-
security system using commonly available features like PIC 485 fieldbus and will be used for communication between
series microcontrollers or Arduino development boards as PIC microprocessors.
elements to process and evaluate data from sensors.
The security system structure can be divided into several
levels - data measurement, data acquisition, data processing
II. SECURITY SYSTEM DESIGN and control, and remote access and data visualization.
The first step in the design of the security system is to
clarify what the security system should contain. The main At the lowest level of measurement are individual system
elements of the security system are the sensors. The system sensors that provide data either analogue or digital to
should ensure not only unauthorized access into the guarded microprocessors at the data collection level. The measurement
object but should also monitor events within that object. level sensor and the microprocessor at the data acquisition
344
level together form a sensor module that is adapted to provide To implement the RS-485 fieldbus, the integrated circuit
data to the control unit via the RS-485 fieldbus, which forms LTC485, which is a low-voltage receiver for the RS-422 / RS-
the interface between the data acquisition level and the data 485 buses, must be integrated into the circuit. To program the
processing and control level. The control unit processes these microcomputers of the security system, the MikroC PRO for
data and evaluates the alarm states. Additionally, this data PIC development environment was used, which has an RS-
provides to the control panels, which are on the same level, 485 communication library implemented. This library has a
and to the web server, which is level above. However, control clearly defined protocol for communication.
panels are not used only to receive data, but also send data
The communication begins by sending the start byte.
containing various commands back to the control unit. The
Another byte contains the target address of the device to
communication interface between the control unit and the
which the data is sent. The next byte contains information
web server is made up of the serial line RS-232 and TTL
about whether Master or Slave data is being sent. It also
logic.
contains information about changing the data and address in
case of equivalency with the start byte or stop byte.
Specifically, XOR with a value of 1 is performed in the case
of equality. In the next step, the data is sent in 3 bytes,
followed by a byte with the CRC checksum. Finally, a stop
byte is sent [3].
345
stuck, the watchdog timer is capable to restart the unit during sends the data request to the first address. If the data transfer
93 milliseconds. is successful, the data is stored, the address is incremented,
and the data request is sent to the new address. If the transfer
Before making the algorithm, it is necessary to sense that
fails, the request is sent back to the same address. If the
the security system is based on the measurement values in
transmission fails twice, the address is incremented and the
real time. Therefore, the algorithm must run in a loop and
data is sent to the new address and at the same time the alarm
must under no circumstances stop. The master control loop
is triggered due to a sensor failure. The next part of the
should be as short as possible for the time and must not
program includes data monitoring in case of active security. If
contain any delays.
the one of values exceed the limit value, an alarm is triggered.
The last important step in the program is to send data to
Arduino web server.
As the control panel microprocessor was selected
PIC18F452. The aim of the control panel is communication
with a user through the keypad and the alphanumeric LCD
display. User can watch not only measured values of the
security system, but also activate or deactivate the system.
User also can change the brightness of the LCD or change the
activation password. These functions are accessible after
entering the password.
The user interface is displayed on the LCD and controlled
by the keypad and divided into sections, which resemble a
tree structure.
346
board, which receives the data from the control unit and deactivate the security system a four-digit password must be
provide them via the web server to the connected client. For entered to textbox and confirmed by the button. Web app is
the control unit communication with Arduino UNO board is responsive. It adapts according to device resolution and it is
designed serial line RS-232. To speed-up the activation and readable also on mobile phones and tablets.
the deactivation, there are separate signals wired to the
control unit, which represent HIGH or LOW logic level.
REFERENCES
[1] KŘEČEK, Stanislav. Příručka zabezpečovací techniky. Vyd. 2.
[S.l.: s.n.], 2003. ISBN 8090293824.
Fig. 7. Final web application [2] HRBÁČEK, J. 2004. Moderní učebnice programování
mikrokontrolérů PIC. Praha. Nakladatelství BEN – technická
literatura. 96 s. ISBN 80-7300-136-5.
To creation of the web page was used mark-up language [3] MikroElektronika [online]. Bělehrad: MikroElektronika, 1998
in HTML5 version and its design was edited using CSS [cit. 2017-02-01]. Dostupné z: https://www.mikroe.com/
technology. The final web application is divided into three [4] W3Schools Online Web Tutorials [online]. W3.CSS, c1999-2017
boxes. The first monitors sensor values and states, the second [cit. 2017-04-14]. Dostupné z: https://www.w3schools.com/
is used for activation or deactivation security, and the last
one is used for watching alarm conditions. To activate or
347