ANDROID APPLICATION FOR REMOTE DOOR LOCK SYSTEM …ksankaranara/CTDTFinal.pdfSupervisor,...
Transcript of ANDROID APPLICATION FOR REMOTE DOOR LOCK SYSTEM …ksankaranara/CTDTFinal.pdfSupervisor,...
ANDROID APPLICATION FOR REMOTE DOOR
LOCK SYSTEM IN COLLEGES
A PROJECT REPORT
Submitted by
S. KRISHNA PRASAD (2013503514)
HARSHAN SHYAM (2013503509)
A. N. KARTHIKEYAN (2013503511)
in partial fulfillment for the Student Innovation Project
of
CENTRE FOR TECHNOLOGY DEVELOPMENT AND TRANSFER
ANNA UNIVERSITY
MADRAS INSTITUTE OF TECHNOLOGY, CHENNAI
ANNA UNIVERSITY: CHENNAI 600 025
December 2016
ANNA UNIVERSITY: CHENNAI 600 025
ii
BONAFIDE CERTIFICATE
Certified that this project report titled “ANDROID APPLICATION
FOR REMOTE DOOR LOCK SYSTEM IN COLLEGES” is a bonafide
work done by “S. KRISHNA PRASAD (2013503514), HARSHAN SHYAM
(2013503509) and A.N.KARTHIKEYAN (2013503511)” under my
supervision, in partial fulfilment for the Student Innovation Project of Centre for
Technology Development and Transfer, Anna University . Certified further, that
to the best of my knowledge the work reported here in does not form part or full
of any other thesis or dissertation on the basis of which a degree or award was
conferred on an earlier occasion to this or any other candidate.
Date:
Place
SIGNATURE
Dr.S.Thamarai Selvi
SUPERVISOR
Professor,
Department of Computer Technology,
Madras Institute of Technology,
Anna University,
Chennai-600 044.
iii
ACKNOWLEDGEMENT
We are highly indebted to our respectable Dean, Dr. A. RAJADURAI and to
our reputable Head of the Department Dr. P. ANANDHAKUMAR,
Department of Computer Technology, MIT Campus, Anna University for
providing us with sufficient facilities that contributed to success in this
endeavor.
We would like to express my sincere thanks and deep sense of gratitude to our
Supervisor, DR.S.THAMARAI SELVI for her valuable guidance, suggestions
and constant encouragement which paved way for the successful completion of
this phase of project work.
We would be failing in our duty, if we forget to thank all the teaching and non-
teaching staff of our department, for their constant support throughout the
course of our project work.
S.KRISHNA PRASAD
HARSHAN SHYAM
A.N.KARTHIKEYAN
iv
ABSTRACT
This project deals with the design and implementation of a surveillance
system using a security camera to remotely open/close the Raspberry pi door
lock system of laboratories in educational institutions via a mobile application .
The proposed security system captures video footage and transmits it via a WIFI
to a static IP, which is viewed using a web browser from a dedicated a smart
device in the admin console. The camera streams live video and records the
motion detected parts in the cloud and/or in the system shared folder for video
analysis. The video analysis result causes a notification to be sent to the mobile
application which in turn controls the raspberry pi to open/close the door lock
system. A Raspberry pi fitted door lock is used so as remotely control opening
and closing mechanism via the mobile application. A security camera is used
for surveillance of the labs from which live footage is sent to the admin console.
Video analysis is done on the footage using MATLAB to detect motion and
human presence. Notification is sent to the mobile application 24/7 when
presence of motion is detected.
v
CHAPTER
NO.
TITLE PAGE
NO.
ABSTRACT iv
LIST OF ABBREVIATIONS vii
LIST OF FIGURES Viii
1 INTRODUCTION 1
1.1 INTERNET OF THINGS 1
1.2 IoT COMMUNICATION MODELS 2
1.2.1 DEVICE-TO-DEVICE
COMMUNICATIONS
3
1.2.2 DEVICE-TO-GATEWAY MODEL 4
1.2.3 DEVICE-TO-CLOUD
COMMUNICATIONS
5
1.2.4 BACK-END DATA-SHARING
MODEL
6
1.3 RASPBERRY PI 7
1.4 HARDWARE LAYOUT 8
1.4.1 PROCESSOR / SOC (SYSTEM ON CHIP) 8
1.4.2 POWER SOURCE 9
1.4.3 SD CARD 9
1.4.4 GPIO 9
1.4.5 DSI CONNECTOR 11
1.4.6 AUDIO JACK 11
1.4.7 STATUS LEDS 12
1.4.8 USB 2.0 12
1.4.9 ETHERNET 12
1.4.10 CSI CONNECTER 13
1.4.11 JTAG HEADERS 13
vi
1.4.12 HDMI 13
2 LITERATURE SURVEY 14
2.1 MOTION DETECTION SYSTEM 14
2.1.1 BACKGROUND SUBTRACTION
METHOD
15
2.1.2 WIDE AREA MOTION IMAGERY 17
2.2 HOME AUTOMATION SYSTEM 18
3 PROPOSED WORK 20
3.1 OVERVIEW 20
3.2 ARCHITECTURE 21
3.3 DESCRIPTION OF MODULES 22
3.3.1 USER INTERFACE 22
3.3.2 WIFI ROUTER CONFIGURATION 22
3.3.3 SETTING UP RASPBERRY PI 22
3.3.4 RELAY CIRCUIT 23
3.3.5 MOTION DETECTION 23
3.3.7 MOTION DETECTION FLOW
DIAGRAM
24
4
IMPLEMENTATION AND RESULT 28
5 CONCLUSIONS AND FUTURE WORK 29
6 APPENDIX-1 30
7 REFERENCES 31
vii
LIST OF ABBREVIATIONS
Abbreviation Expansion
IoT Internet of Things
ALG Application-layer gateway
WIFI Wireless Fidelity
API Application programmer interfaces
GPU Graphics processing unit
SD Secure digital
ARM Advanced RISC Machine
GPIO General purpose Input/Output
IRQ Interrupt Request
MIPI Mobile industry processer interface
LCD Liquid crystal display
DSI Display serial interface
CSI Camera serial interface
FDX Full Duplex
JTAG Join test action group
HDMI High definition multimedia interface
WAMI Wide area motion imagery
PIR Passive infrared sensor
LAN Local area network
SAD Subtraction of absolute difference
viii
LIST OF FIGURES
FIGURE
NO.
TITLE PAGE NO.
1.1 Raspberry Pi: Hardware Layout 8
1.2 Raspberry Pi: Pin Diagram 10
3.1 Architecture Diagram
21
3.2 Motion detection flow Diagram 24
4.1 Laboratory view 1 25
4.2 Laboratory view 2 25
4.3 Laboratory view 3 26
4.4 SAD Values Idle set 26
4.5 SAD Values motion detected 27
4.6 Android application user interface 27
4.7 Hardware setup of the system 28
1
CHAPTER 1
INTRODUCTION
1.1 INTERNET OF THINGS
The Internet of Things (IoT) is an important topic in technology
industry, policy, and engineering circles and has become headline news in both
the specialty press and the popular media. This technology is embodied in a
wide spectrum of networked products, systems, and sensors, which take
advantage of advancements in computing power, electronics miniaturization,
and network interconnections to offer new capabilities not previously possible.
An abundance of conferences, reports, and news articles discuss and debate the
prospective impact of the “IoT revolution”—from new market opportunities and
business models to concerns about security, privacy, and technical
interoperability.
The large-scale implementation of IoT devices promises to transform
many aspects of the way we live. For consumers, new IoT products like
Internet-enabled appliances, home automation components, and energy
management devices are moving us toward a vision of the “smart home’’,
offering more security and energy efficiency.
Other personal IoT devices like wearable fitness and health monitoring
devices and network enabled medical devices are transforming the way
healthcare services are delivered. This technology promises to be beneficial for
people with disabilities and the elderly, enabling improved levels of
independence and quality of life at a reasonable cost. IoT systems like
networked vehicles, intelligent traffic systems, and sensors embedded in roads
and bridges move us closer to the idea of “smart cities’’, which help minimize
congestion and energy consumption. IoT technology offers the possibility to
transform agriculture, industry, and energy production and distribution by
2
increasing the availability of information along the value chain of production
using networked sensors.
However, IoT raises many issues and challenges that need to be
considered and addressed in order for potential benefits to be realized.
Some observers see the IoT as a revolutionary fully–interconnected
“smart” world of progress, efficiency, and opportunity, with the potential for
adding billions in value to industry and the global economy. Others warn that
the IoT represents a darker world of surveillance, privacy and security
violations, and consumer lock–in. Attention-grabbing headlines about the
hacking of Internet-connected automobiles, surveillance concerns stemming
from voice recognition features in “smart” TVs, and privacy fears stemming
from the potential misuse of IoT data have captured public attention. This
“promise vs. peril” debate along with an influx of information though popular
media and marketing can make the IoT a complex topic to understand.
1.2 IoT COMMUNICATION MODELS
The discussion below presents the framework and explains key
characteristics of each of the communication models used by the IoT devices.
Device-to-Device Communications
Device-to-Gateway Model
Device-to-Cloud Communications
Back-End Data-Sharing Mode
3
1.2.1 DEVICE-TO-DEVICE COMMUNICATIONS
The device-to-device communication model represents two or
more devices that directly connect and communicate between one
another, rather than through an intermediary application server. These
devices communicate over many types of networks, including IP
networks or the Internet. Often, however these devices use protocols
like Bluetooth, Z-Wave to establish direct device-to-device
communications.
These device-to-device networks allow devices that adhere to a
particular communication protocol to communicate and exchange
messages to achieve their function. This communication model is
commonly used in applications like home automation systems, which
typically use small data packets of information to communicate
between devices with relatively low data rate requirements. Residential
IoT devices like light bulbs, light switches, thermostats, and door locks
normally send small amounts of information to each other (e.g. a door
lock status message or turn on light command) in a home automation
scenario.
From the user’s point of view, this often means that underlying
device-to-device communication protocols are not compatible, forcing
the user to select a family of devices that employ a common protocol.
For example, the family of devices using the Z-Wave protocol is not
natively compatible with the ZigBee family of devices. While these
incompatibilities limit user choice to devices within a particular
protocol family, the user benefits from knowing that products within a
particular family tend to communicate well.
4
1.2.2 DEVICE-TO-GATEWAY MODEL
In the device-to-gateway model, or more typically, the device-to-
application-layer gateway (ALG) model, the IoT device connects
through an ALG service as a conduit to reach a cloud service. In
simpler terms, this means that there is application software operating
on a local gateway device, which acts as an intermediary between the
device and the cloud service and provides security and other
functionality such as data or protocol translation.
Several forms of this model are found in consumer devices. In
many cases, the local gateway device is a smartphone running an app
to communicate with a device and relay data to a cloud service. This is
often the model employed with popular consumer items like personal
fitness trackers. These devices do not have the native ability to connect
directly to a cloud service, so they frequently rely on smartphone app
software to serve as an intermediary gateway to connect the fitness
device to the cloud.
The other form of this device-to-gateway model is the emergence
of “hub” devices in home automation applications. These are devices
that serve as a local gateway between individual IoT devices and a
cloud service, but they can also bridge the interoperability gap between
devices themselves. For example, the SmartThings hub is a stand-alone
gateway device that has Z-Wave and Zigbee transceivers installed to
communicate with both families of devices. It then connects to the
SmartThings cloud service, allowing the user to gain access to the
devices using a smartphone app and an Internet connection.
5
1.2.3 DEVICE-TO-CLOUD COMMUNICATIONS
In a device-to-cloud communication model, the IoT device
connects directly to an Internet cloud service like an application
service provider to exchange data and control message traffic. This
approach frequently takes advantage of existing communications
mechanisms like traditional wired Ethernet or Wi-Fi connections to
establish a connection between the device and the IP network, which
ultimately connects to the cloud service.
This communication model is employed by some popular
consumer IoT devices like the Nest Labs Learning Thermostat44 and
the Samsung SmartTV. In the case of the Nest Learning Thermostat,
the device transmits data to a cloud database where the data can be
used to analyze home energy consumption.
Further, this cloud connection enables the user to obtain remote
access to their thermostat via a smartphone or Web interface, and it
also supports software updates to the thermostat. Similarly with the
Samsung SmartTV technology, the television uses an Internet
connection to transmit user viewing information to Samsung for
analysis and to enable the interactive voice recognition features of the
TV. In these cases, the device-to-cloud model adds value to the end
user by extending the capabilities of the device beyond its native
features.
However, interoperability challenges can arise when attempting
to integrate devices made by different manufacturers. Frequently, the
device and cloud service are from the same vendor. If proprietary data
6
protocols are used between the device and the cloud service, the device
owner or user may be tied to a specific cloud service, limiting or
preventing the use of alternative service providers. This is commonly
referred to as “vendor lock-in’’, a term that encompasses other facets
of the relationship with the provider such as ownership of and access to
the data. At the same time, users can generally have confidence that
devices designed for the specific platform can be integrated.
1.2.4 BACK-END DATA-SHARING MODEL
The back-end data-sharing model refers to a communication
architecture that enables users to analyze smart object data from a
cloud service in combination with data from other sources. This
architecture supports “the user’s desire for granting access to the
uploaded sensor data to third parties”. This approach is an extension of
the single device-to-cloud communication model, which can lead to
data silos where “IoT devices upload data only to a single application
service provider’’. A back-end sharing architecture allows the data
collected from single IoT device data streams to be aggregated and
analyzed.
For example, a corporate user in charge of an office complex
would be interested in consolidating and analyzing the energy
consumption and utilities data produced by all the IoT sensors and
Internet-enabled utility systems on the premises. Often in the single
device-to-cloud model, the data each IoT sensor or system produces
sits in a stand-alone data silo.
7
An effective back-end data sharing architecture would allow the
company to easily access and analyze the data in the cloud produced
by the whole spectrum of devices in the building. Also, this kind of
architecture facilitates data portability needs. Effective back-end data
sharing architectures allow users to move their data when they switch
between IoT services, breaking down traditional data silo barriers. The
back-end data-sharing model suggests a federated cloud services
approach or cloud applications programmer interfaces (APIs) are
needed to achieve interoperability of data.
1.3 RASPBERRY PI
Raspberry Pi is a credit-card sized computer manufactured and designed
in the United Kingdom by the Raspberry Pi foundation with the intention of
teaching basic computer science to school students and every other person
interested in computer hardware, programming and DIY-Do-it Yourself projects
The Raspberry Pi has a Broadcom BCM2835 system on a chip (SoC),
which includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU
and was originally shipped with 256 megabytes of RAM, later upgraded (Model
B & Model B+) to 512 MB. It does not include a built-in hard disk or solid-state
drive, but it uses an SD card for booting and persistent storage, with the Model
B+ using a MicroSD.
The Foundation provides Debian and Arch Linux ARM distributions for
download. Tools are available for Python as the main programming language,
with support for BBC BASIC (via the RISC OS image or the Brandy Basic
clone for Linux), C, Java and Perl.
8
1.4 HARDWARE LAYOUT
Fig 1.1 Raspberry Pi : Hardware Layout
1.4.1 PROCESSOR / SOC (SYSTEM ON CHIP)
The Raspberry Pi has a Broadcom BCM2835 System on Chip
module. It has a ARM1176JZF-S processor.
9
1.4.2 POWER SOURCE
The Pi is a device which consumes 700mA or 3W or power. It is powered
by a MicroUSB charger or the GPIO header. Any good smartphone charger will
do the work of powering the Pi.
1.4.3 SD CARD`
The Raspberry Pi does not have any onboard storage available. The
operating system is loaded on a SD card which is inserted on the SD card slot
on the Raspberry Pi. The operating system can be loaded on the card using a
card reader on any computer.
1.4.4 GPIO
General Purpose Input Output General-purpose input/output (GPIO) is a
generic pin on an integrated circuit whose behaviour, including whether it is an
input or output pin, can be controlled by the user at run time. GPIO pins have
no special purpose defined, and go unused by default. The idea is that
sometimes the system designer building a full system that uses the chip might
find it useful to have a handful of additional digital control lines, and having
these available from the chip can save the hassle of having to arrange additional
circuitry to provide them.
10
Fig 1.2 Raspberry Pi : PIN Diagram
GPIO capabilities may include:
GPIO pins can be configured to be input or output
GPIO pins can be enabled/disabled
Input values are readable (typically high=1, low=0)
Output values are writable/readable
Input values can often be used as IRQs (typically for wakeup events)
11
The production Raspberry Pi board has a 26-pin 2.54 mm (100 mil)
expansion header, marked as P1, arranged in a 2x13 strip. They provide 8 GPIO
pins plus access to I²C, SPI, UART), as well as +3.3 V, +5 V and GND supply
lines. Pin one is the pin in the first column and on the bottom row.
1.4.5 DSI CONNECTOR
The Display Serial Interface (DSI) is a specification by the Mobile
Industry Processor Interface (MIPI) Alliance aimed at reducing the cost
of display controllers in a mobile device. It is commonly targeted at LCD
and similar display technologies. It defines a serial bus and a
communication protocol between the host (source of the image data) and
the device (destination of the image data).
A DSI compatible LCD screen can be connected through the DSI
connector, although it may require additional drivers to drive the display.
6) RCA Video RCA Video outputs (PAL and NTSC) are available on all
models of Raspberry Pi. Any television or screen with a RCA jack can be
connected with the RPi.
1.4.6 AUDIO JACK
A standard 3.5 mm TRS connector is available on the RPi for stereo
audio output. Any headphone or 3.5mm audio cable can be connected directly.
Although this jack cannot be used for taking audio input, USB mics or USB
sound cards can be used.
12
1.4.7 STATUS LEDS
There are 5 status LEDs on the RPi that show the status of various
activities as follows:
OK - SDCard Access (via GPIO16) - labelled as "OK" on Model B
Rev1.0 boards and "ACT" on Model B Rev2.0 and Model A boards
POWER - 3.3 V Power - labelled as "PWR" on all boards
Raspberry PI Seminar Report
FDX - Full Duplex (LAN) (Model B) - labelled as "FDX" on all
boards
LNK - Link/Activity (LAN) (Model B) - labelled as "LNK" on all
boards
10M/100 - 10/100Mbit (LAN) (Model B) - labelled (incorrectly) as
"10M" on Model B Rev1.0 boards and "100" on Model B Rev2.0
and Model A boards
1.4.8 USB 2.0
Port USB 2.0 ports are the means to connect accessories such as mouse or
keyboard to the Raspberry Pi. There is 1 port on Model A, 2 on Model B and 4
on Model B+. The number of ports can be increased by using an external
powered USB hub which is available as a standard Pi accessory.
1.4.9 ETHERNET
Ethernet port is available on Model B and B+. It can be connected to a
network or internet using a standard LAN cable on the Ethernet port. The
Ethernet ports are controlled by Microchip LAN9512 LAN controller chip.
13
1.4.10 CSI CONNECTOR
CSI – Camera Serial Interface is a serial interface designed by MIPI
(Mobile Industry Processor Interface) alliance aimed at interfacing digital
cameras with a mobile processor.
The RPi foundation provides a camera specially made for the Pi which
can be connected with the Pi using the CSI connector.
1.4.11 JTAG HEADERS
JTAG is an acronym for ‗Joint Test Action Group', an organisation that
started back in the mid 1980's to address test point access issues on PCB with
surface mount devices. The organisation devised a method of access to device
pins via a serial port that became known as the TAP (Test Access Port). In 1990
the method became a recognised international standard (IEEE Std 1149.1).
Many thousands of devices now include this standardised port as a feature to
allow test and design engineers to access pins.
1.4.12 HDMI
HDMI – High Definition Multimedia Interface HDMI 1.3 a type A port is
provided on the RPi to connect with HDMI screens.
1.5 ORGANIZATION OF THESIS
The thesis is organized as follows. Chapter 1 discusses Introduction of
IoT and Raspberry Pi, its layout and gives an overview of its components.
Chapter 2 presents the literature review on motion detection and home
automation. Chapter 3 discusses the Chapter 4 discusses the simulation results
and concludes with future work.
14
CHAPTER 2
LITERATURE SURVEY
2.1 MOTION DETECTION SYSTEM
Badri Narayan Subudhi et. al. [1] (2016) proposed a novel background
subtraction (BGS) technique to detect local changes corresponding to the
movement of the objects in video scenes. It presents an efficient combination of
six local features; three existing and three newly proposed. For background
modelling and subtraction, a statistical parametric biunique model is proposed.
A few simple statistical parameters are used to characterize each feature. For
background subtraction, the multi-valued features computed at each pixel
location are compared with those of the computed parameters corresponding to
that feature.
Komal Rahangdale et. al. [2] (2016) proposed an approach to the problem
of automatically tracking people and detecting unusual or suspicious
movements in CCTV videos. It proposes a system that works for surveillance
systems installed in indoor environments like entrances/exits of buildings,
corridors, etc. It presents a framework that processes video data obtained from a
CCTV camera fixed at a particular location. First, the foreground objects are
obtained using background subtraction. These foreground objects are then
classified into people and suspicious objects. These objects are tracked using a
blob matching technique.
Sunanda R. Hanchinamani et. al. [3] (2016) presented a method in which
the video is first converted to streams and then applied to convolution filter
which removes high frequency noise components to obtain smoothened images.
The smoothened images are then applied to background subtraction algorithm
15
with adaptive threshold which gives detected object present in background
image. The detected object is then applied to convolution filter to remove the
spurious distorted pixels which improves the quality of image.
Chia-Jui Yang, Ting Chou et. al. [4] (2016) proposes an intelligence
surveillance system in indoor environments, which support the functions of
people detection, people tracking, and behaviour analysis. Strong variation of
lightness by switching lights and frequent crossing of people are two major
design challenges of the proposed system, which will decrease the detection
accuracy. Therefore, we propose a mechanism of updating background to react
to the variation of lightness.
2.1.1. BACKGROUND SUBTRACTION METHOD
Identifying moving objects from a video sequence is a fundamental and
critical task in many computer-vision applications. A common approach is to
perform background subtraction, which identifies moving objects from the
portion of a video frame that differs significantly from a background model.
There are many challenges in developing a good background subtraction
algorithm. First, it must be robust against changes in illumination. Second, it
should avoid detecting non-stationary background objects such as moving
leaves, rain, snow, and shadows cast by moving objects. Finally, its internal
background model should react quickly to changes in background such as
starting and stopping of vehicles.
In paper [5], the author proposes a two-stage foreground propagation that
uses clues to adapt to the environment and detect moving objects in a non-
16
stationary camera. The first stage creates a weight matrix to instantaneously
regulate the background model by responding to clues from frame differencing
and background subtraction. The regulated background model is less affected
by inaccurate motion compensation. In the second stage, an iterative approach is
taken to refine the threshold for each pixel location by initially using pixels with
high foreground probability as clues.
Foreground regions detected from the refined threshold are less likely to
be false detections and capture true object regions with completeness.
Experimental results showed that the two-stage foreground propagation had
significantly higher recall with comparable precision and outperformed other
method.
To overcome the limitation in traditional background subtraction
algorithms, several methods have been proposed to detect moving objects in a
non-stationary camera. Panoramic methods [6, 7] use image registration to
create a background model with a panorama, and the background model is used
to detect moving objects. The panoramic background model suffers from
accumulated stitching errors and infrequent updates, resulting in false
detections.
Frame differencing methods [8] and accumulative frame differencing
methods [9, 10] are not affected by these modeling errors because they use few
previous frames as references to localize the moving object. However, frame
differencing methods and accumulative frame differencing methods cannot
properly segment the complete object and need alternative means to segment
the moving object. [11] is a motion segmentation method, and it segments the
foreground from the background with the assumption that the trajectories of
moving objects and those of the background do not have the same subspace.
17
2.1.2 WIDE AREAS MOTION IMAGERY
Wide Area Motion Imagery (WAMI) enables the surveillance of tens of
square kilometers with one airborne sensor. Each image can contain thousands
of moving objects. Applications such as driver behavior analysis or traffic
monitoring require precise multiple object tracking that is dependent on initial
detections. However, low object resolution, dense traffic, and imprecise image
alignment lead to split, merged, and missing detections.
In paper [12], the author provides a detailed overview of existing methods
for moving object detection in WAMI data. Also proposing a novel combination
of short-term background subtraction and suppression of image alignment errors
by pixel neighbourhood consideration, In total, eleven methods are
systematically evaluated using more than 160,000 ground truth detections of the
WPAFB 2009 dataset. Best performance with respect to precision and recall is
achieved by the proposed one.
Surveys such as Radke et al. [13] summarize change detection methods,
whereby the specific characteristics of WAMI and their impact on the detection
method are not considered. Although various different detection approaches
exist in the literature [14, 15], no evaluation of detection performance has been
presented so far. Instead, authors usually focus on developing and evaluating
multiple object tracking algorithms that implicitly handle inaccurate detections,
e.g. by allowing many to many correspondences (i.e. detection and track
sharing) in multiple hypothesis tracking [16]. Common evaluation measures
such as precision and recall are reported either estimated tracks and not
detections [17] or within a limited evaluation setup.
18
2.2. HOME AUTOMATION SYSTEM
In paper [18], the author used the inexpensive Raspberry Pi to automate
the tasks at home such as switching appliances on & off over WiFi (Wireless
Fidelity) or LAN(Local Area Network) using a personal computer or a mobile
or a tablet through the browser. The proposed work was done by using the
dedicated Android application. The conventional switch boards were added with
a touch screen or replaced with a touch screen to match the taste of the user's
home decor. PIR (Passive Infrared Sensor) sensor was used to detect human
detection and automate the on and off functionality.
Home automation uses different types of network protocols such as Wi-
Fi, Bluetooth and ZigBee. However, existing home equipment often requires
network communication enabled power plugs or devices that have a unique
communication protocol specified by the company. Although these equipment
have standard communication capability, each device is limited to communicate
within a same network protocol enabled devices. In order to solve this issue
between various network protocols in smart homes, Ho-Kyeong Ra, Sangsoo
Jeong, Hee Jung Yoon, and Sang Hyuk Son [19] presented a Smart Home
Automation Framework (SHAF) wherein a central server manages multiple
nodes in a smart home through ZigBee communication.
Home automation system uses the portable devices as a user interface.
They can communicate with home automation network through an Internet
gateway, by means of low power communication protocols like Zigbee, Wi-Fi
etc.
In paper [20], controlling home appliances via Smartphone using Wi-Fi
as communication protocol and raspberry pi as server system is facilitated. The
user here will move directly with the system through a web-based interface over
19
the web, whereas home appliances like lights, fan and door lock are remotely
controlled through easy website. An extra feature that enhances the facet of
protection from fireplace accidents is its capability of sleuthing the smoke in
order that within the event of any fireplace, associates an alerting message and
an image is sent to Smartphone. If the web affiliation is down or the server isn't
up, the embedded system board still will manage and operate the appliances
domestically. By this we provide a climbable and price effective Home
Automation system.
20
CHAPTER 3
PROPOSED WORK
3.1 OERVIEW
The proposed system architectures generally incorporate a raspberry-pi
computer for the purposes of network management and provision of remote
access. Raspberry-pi can be configured according to our required system.
The user will communicate to raspberry-pi through wifi network. The system is
flexible and scalable, allowing additional appliances designed by multiple
vendors, to be securely and safely added to the home network with the
minimum amount of effort.
The wifi network should be having adequate strength also. We can use a
wifi-modem for steeping a wifi. The users have an android interface for using
the system through the mobile phone which is also connected to the same
network as the raspberry-pi. The camera for motion detection is also connected
in the same network. The raspberry-pi board is configured for each appliances.
So, according to user intervention the matched out will make high and the
corresponding relay will switch on and device start function.
The system is scalable and allows multi-vendor appliances to be added
with no major changes to its core. The project consists of the following
modules:
User Interface
Wifi Router configuration
Raspberry Pi
Relay Circuit
Motion Detection and Appliances
21
3.2. ARCHITECTURE
Fig 3.1 Home automation: Architecture
22
3.3. DESCRIPTION OF MODULES
3.3.1 USER INTERFACE
Android provides a variety of pre-build UI components such as structured
layout objects and UI controls that allow you to build the graphical user
interface for your app. Android also provides other UI modules for special
interfaces such as dialogs, notifications, and menus. The interface allows user to
view device status and to control device. It provides notifications from the
motion detection system when the room is idle. It consists of separate buttons to
on/off the appliances.
3.3.2. WIFI ROUTER CONFIGURATION
The wifi unit provides the medium for communication. It can be also
configured to make security services. the wifi should be configured with a
certain address and user commands will be directing through wifi unit. We may
use sudo nano /etc/network/interfaces for configuring wifi with raspberry-pi.
3.3.3. SETTING UP RASPBERRY PI
The Raspberry Pi is a low cost single-board computer which is controlled
by a modified version of Debian Linux optimized for the ARM architecture.
Here we are using modelB ,700 MHz ARM processor with 512 MB RAM. The
setting up of raspi consists of selecting raspbian OS from noobs package. the
noobs package consists of raspbian, arclinux, pidora, open ELEC, Risc OS
operating system. After the os selection we need to configure raspberry-pi using
Raspi-config command. We can enter into raspi desktop using startx command.
To interface with raspberry pi, VNC Viewer and Putty are used.
23
3.3.4. RELAY CIRCUIT
A relay is an electrically operated switch. Relays are used where it is
necessary to control a circuit by a low-power signal (with complete electrical
isolation between control and controlled circuits), or where several circuits must
be controlled by one signal.in our system the output from raspberry pi is directly
given to relay circuit. According to the out of raspberry pi, corresponding relay
will turn on and makes its device working. We are using a NPN transistor in
relay and it works based on concept of emf. The relay can be selected according
to our application purpose. Our system ends up with the working of relay
circuit. In this system, we can add devices very easily into system. Also it can
be configured with more security and functional services.
3.3.5. MOTION DETECTION
The motion detection system will detect idleness and this can be notified
to the server that is running in the Raspberry pi. This can be communicated to
the android app via the wifi network in which the whole system is connected.
The appliances like electric door, fan and light are connected to the GPIO pins
of the raspberry pi through the relay circuit. Depending upon the button pressed
by the user on the android app, the appliance is selected in the relay circuit and
the appliance can be turned on/off.
24
3.3.6. MOTION DETECTION FLOW DIAGRAM
Fig 3.2 Motion detection: flow control
25
CHAPTER 4
IMPLEMENTATION AND RESULTS
Fig 4.1 Laboratory View 1
Image is captured using camera and transmitted using WiFi. Fig 4.1 , 4.2 ,
4.3 shows the snapshot that is captured and analysed using SAD( Subtraction of
Absolute Differences) method.
Fig 4.2 Laboratory View 2
26
Fig 4.3 Laboratory View 3
The result of SAD is analysed and when its value is more than certain
threshold there is motion in the laboratory. If it is below the threshold and at the
same instance if the timestamp is also exceeded then “idleness” is marked and
reported. The threshold can vary based upon the level of sensitivity to be
measured.
Fig 4.4 SAD values idle set
27
Fig 4.5 SAD values Motion Detected
In Fig 4.4, 4.5 the final values are computed and analysed based on
which inference has to be made. In this case the threshold is used as 10 and the
timestamp is used as 15 minutes. When the final values are less than
10(threshold) for 15 minutes then it is reported. If any final value is more than
10(threshold) in this instance then the timestamp is reset and started again.
Figure 4.6 shows the user interface screen of the developed android
application. It contains a switch button each for light, fan and the door.
Fig 4.6 Android application user interface
28
Fig 4.7 Hardware setup of system
The above figure Fig 4.7 is the hardware setup of the system on the
whole. It contains the raspberry pi, the relay circuit and the door lock.
Fig 4.8 Hardware setup of system
The above figure Fig 4.8 is the product after final fabrication
29
Fig 4.9 Hardware setup of system
The above figure Fig 4.9 shows the organisation of the components inside
the box.
30
CHAPTER 5
CONCLUSION AND FUTURE WORK
The proposed system is at an affordable price and has an ease of
installing it anywhere required, with minimum maintenance cost. The motion
detection module has been implemented in MATLAB. Safety always a prime
priority for man. Hence, leveraging exciting new technology to extend the
proposed home automation system to increase safety through fire and carbon-
monoxide detectors is definitely on the cards. Energy efficient technology is the
order of the day. So another crucial future extension may include power
tracking and notifying customers of their power budgets and carbon footprints.
Closed and private networks wherein all devices communicate with each other
in a private network facilitates the extension of the proposed system to a total
personal home security system.
31
APPENDIX-1
IMPLEMENTATION TOOL
MATLAB (matrix laboratory) is a multi-paradigm numerical computing
environment and fourth-generation programming language. A proprietary
programming language developed by MathWorks, MATLAB allows matrix
manipulations, plotting of functions and data, implementation of algorithms,
creation of user interfaces, and interfacing with programs written in other
languages, including C, C++, Java, Fortran and Python.
MATLAB is used to analyze and design the systems and products
transforming our world. The matrix-based MATLAB language is the world's
most natural way to express computational mathematics. The Built-in graphics
make it easy to visualize and gain insights from data. The desktop environment
invites experimentation, exploration, and discovery.
MATLAB is used to take users ideas beyond the desktop. One can run
your analyses on larger data sets, and scale up to clusters and clouds. MATLAB
code can be integrated with other languages, enabling one to deploy algorithms
and applications within web, enterprise, and production systems. Although
MATLAB is intended primarily for numerical computing, an optional toolbox
uses the MuPAD symbolic engine, allowing access to symbolic computing
abilities. An additional package, Simulink, adds graphical multi-domain
simulation and model-based design for dynamic and embedded systems.
USAGE OF MATLAB IN THIS PROJECT:
MATLAB is mainly used here for video analysis. The live video from ip
camera is captured and analyzed. This analysis is done based on SAD (Sum of
absolute Difference). If the result is below a threshold value then it means that
the system is idle. If idleness is detected then notification is sent to the server.
MATLAB is also used for sending notification to the server. MATLAB is also
used to store the live videos which can be viewed whenever needed.
32
REFERENCES
[1] B. N. Subudhi, S. Ghosh, S. C. K. Shiu, and A. Ghosh, "Statistical
feature bag based background subtraction for local change
detection", Information Sciences.
[2] Komal Rahangdale and Mahadev Kokate, “EVENT DETECTION
USING BACKGROUND SUBTRACTION FOR
SURVEILLANCE SYSTEMS”, International Journal of
Engineering Applied Sciences and Technology, 2016 Vol. 1,
Issue 4, ISSN No. 2455-2143, Pages 25-28 .
[3] Sunanda R. Hanchinamani, Sayantam Sarkar and Satish S
Bhairannawar, “Design and Implementation of High Speed
Background Subtraction Algorithm for Moving Object Detection”,
6th International Conference On Advances In Computing &
Communications, ICACC 2016, 6-8 September 2016, Cochin,
India
[4] C. J. Yang, T. Chou, F. A. Chang, C. Ssu-Yuan and J. I. Guo, "A
smart surveillance system with multiple people detection, tracking,
and behavior analysis," 2016 International Symposium on VLSI
Design, Automation and Test (VLSI-DAT), Hsinchu, 2016, pp.1-4.
[5] WonTaek Chung, YongHyun Kim, Yong-Joong Kim and DaiJin
Kim, "A two-stage foreground propagation for moving object
detection in a non-stationary," 2016 13th IEEE International
Conference on Advanced Video and Signal Based Surveillance
(AVSS), Colorado Springs, CO, 2016, pp. 187-193.
[6] S. Ali and M. Shah. Cocoa: tracking in aerial imagery. In Defense
and Security Symposium, pages 62090D–62090D. International
Society for Optics and Photonics, 2006.
[7] C. Guillot, M. Taron, P. Sayd, Q. C. Pham, C. Tilmant, and J.-M.
Lavest. Background subtraction adapted to ptz cameras by
keypoint density estimation. In Proceedings of the British Machine
Vision Conference, pages 34–1, 2010
[8] C. Aeschliman, J. Park, and A. C. Kak. Tracking vehicles through
shadows and occlusions in wide-area aerial video. Aerospace and
Electronic Systems, IEEE Transactions on, 50(1):429–444, 2014.
33
[9] S. Bhattacharya, H. Idrees, I. Saleemi, S. Ali, and M. Shah.
Moving object detection and tracking in forward looking infra-red
aerial imagery. In Machine Vision Beyond Visible Spectrum,
pages 221–252. Springer, 2011
[10] S. Bhattacharya, H. Idrees, I. Saleemi, S. Ali, and M. Shah.
Moving object detection and tracking in forward looking infra-red
aerial imagery. In Machine Vision Beyond Visible Spectrum,
pages 221–252. Springer, 2011
[11] L. W. Sommer, M. Teutsch, T. Schuchert and J. Beyerer, "A
survey on moving object detection for wide area motion imagery,"
2016 IEEE Winter Conference on Applications of Computer
Vision (WACV), Lake Placid, NY, 2016, pp. 1-9.
[12] L. W. Sommer, M. Teutsch, T. Schuchert and J. Beyerer, "A
survey on moving object detection for wide area motion imagery,"
2016 IEEE Winter Conference on Applications of Computer
Vision (WACV), Lake Placid, NY, 2016, pp. 1-9.
[13] R. Radke, S. Andra, O. Al-Kofahi, and B. Roysam. Image
Change Detection Algorithms: A Systematic Survey. IEEE
Trans. Image Process., 14(3):294–307, 2005.
[14] V. Reilly, H. Idrees, and M. Shah. Detection and Tracking of Large
Number of Targets in Wide Area Surveillance. In ECCV, 2010.
[15] I. Saleemi and M. Shah. Multiframe Many-Many Point
Correspondence for Vehicle Tracking in High Density Wide
Area Aerial Videos. IJCV, 104(2):198–219, 2013.
[16] J. Xiao, H. Cheng, H. Sawhney, and F. Han. Vehicle Detection
and Tracking in Wide Field-of-View Aerial Video. In CVPR, 2010
[17] J. Prokaj, M. Duchaineau, and G. Medioni. Inferring Tracklets for
Multi-Object Tracking. In CVPRW, 2011.
[18] M. Asadullah and A. Raza, "An overview of home automation
systems," 2016 2nd International Conference on Robotics and
Artificial Intelligence (ICRAI), Rawalpindi, Pakistan, 2016, pp.
27-31.
34
[19] H. K. Ra, S. Jeong, H. J. Yoon and S. H. Son, "SHAF: Framework
for Smart Home Sensing and Actuation," 2016 IEEE 22nd
International Conference on Embedded and Real-Time Computing
Systems and Applications (RTCSA), Daegu, 2016, pp. 258-258.
[20] Ghosh, "Intelligent appliances controller using Raspberry Pi," 2016
IEEE 7th Annual Information Technology, Electronics and Mobile
Communication Conference (IEMCON), Vancouver, BC, 2016,
pp. 1-5.