Beruflich Dokumente
Kultur Dokumente
2014-15
CHAPTER 1
INTRODUCTION
1.1 Overview
The Internet of Things (IoT) can be described as connecting everyday objects like
smart-phones, Internet TVs, sensors and actuators to the Internet where the devices are
intelligently linked together enabling new forms of communication between things and
people, and between things themselves. Building IoT has advanced significantly in the last
couple of years since it has added a new dimension to the world of information and
communication technologies.
The Internet has come a long way over the last 30 years. Old-fashioned IPv4 is giving
way to IPv6 so that every device on the Internet can have its own IP address. Machine-tomachine (M2M) communication is on the rise, enabling devices to exchange and act upon
information without a person ever being involved. The scope and scale of the Internet have
changed as well: industry leaders predict that the number of connected devices will surpass
15 billion nodes by 2015 and reach over 50 billion by 2020. The challenge for the embedded
industry is to unlock the value of this growing interconnected web of devices, often referred
to as the Internet of Things (IoT), describing it as the ultimate tool in our future surveillance.
Page 1
2014-15
Fig 1.1 shows the environment of Internet of Things. Potentialities offered by the
IoT make possible the development of a huge number of applications, of which only a
very small part is currently available to our society. Many are the domains and the
environments in which new applications would likely improve the quality of our lives: at
home, while travelling, when sick, at work, when jogging and at the gym, just to cite a
few. These environments are now equipped with objects with only primitive intelligence,
most of times without any communication capabilities. Giving these objects the
possibility to communicate with each other and to elaborate the information perceived
from the surroundings imply having different environments where a very wide range of
applications can be deployed. These can be grouped into the following domains:
otiaprnsT
n ad oglistc ndm.a
Healthcr ndom.i
Smart enviromt (home, ofce, plant) ndom.ai
oPnersal d social ndm.
At the edge of the IoT are the appliances and equipment we use every day. These
things are interconnected across an infrastructure or backbone using combinations of
ZigBee, sub-GHz, Wi-Fi or power line communications (PLC) connectivity to provide a
robust bi-directional communications link with relatively long range, low latency for fast
responsiveness, low power and a sufficient data rate to aggregate information from many
connected devices. This infrastructure also serves as the gateway to the Internet and enables
remote monitoring and control of devices by other networks, utility companies and end users.
Home automation or Smart Homes can be described as introduction of technology
within the home environment to provide convenience, comfort, security and energy
efficiency to its occupants. Adding intelligence to home environment can provide increased
Page 2
2014-15
quality of life. With the introduction of the Internet of Things (IoT), the research and
implementation of home automation are getting more popular.
Problem statement
The objective of our system is to take care of several domestic systems that may
normally be difficult for those who are handicap or elderly to take care of. The proposed idea
will allow a user with any android enabled device to run a piece of downloadable software on
any mobile device such as a smartphones. This application will allow the user to control a
device that is connected to any home appliance that is Pi enabled. The focus of this
application will be to direct a security system with webcam surveillance, door sensor
notification and a light control system. Sensors will be connected to the home appliances
with Pi so that they can be monitored and controlled. Suppose an employee who has gone to
work and during this period a thief sneaks up into the house breaking through a window.
The proposed system would enable the client to monitor home when a door or a
window sensor triggers the alarm. Client monitors home with webcam and could
immediately inform local authority or a policeman. The Client could also check the status of
the outside light and turn on and off the light without the need to get out of bed. These
devices would also benefit users with limited mobility that may have a difficult time getting
to or even reaching their light switch. These objectives require a large amount of technology.
The user interface must be as simple and powerful as possible and operate in a self-organized
way.
Solution
Innovative designs were produced wherein a Magnetic Door Sensors, a Microsoft
LifeCam webcam and LEDs could interact with Raspberry Pi with help of an Android
Smartphone. These applications rely on the use of smartphones, microprocessors and
magnetic door sensors to collect signals through a wireless network to provide users with a
Dept. of CSE, PESCE, Mandya
Page 3
2014-15
simple interface to interact with appliances in the home. The smartphone enables the user to
control the appliances using pre-existing devices such as their mobile phone. The interfaces
are intuitive and easy to use and provide the user with a more accessible interface than those
found in the home. The devices are also very easy to integrate into existing applications and
require only a small amount of expertise to install.
OBJECTIVES
Raspberry Pi: A microprocessor will interface with the android module to perform
the automation. A simple microprocessor will receive signals from the smartphone
installation.
Conduct Experiments and Analyse Data: Using the mobile device and the
appliance controller, conduct tests on usability and product range for a home
environment.
1.5
Existing system
Most commercially available home automation systems are all-in-one solutions which
require that all controllable appliances are from the same company, or must be approved as
compatible with said companys system. Moreover these systems normally come with a
proprietary, dedicated device which acts as the control center. To control the system from
multiple locations, additional control devices must be purchased. These complex systems
usually need to be integrated when the building is constructed and must be planned in
advance. They are also difficult to upgrade or replace once installed. The overall investment
adds up considerably and is financially infeasible in most cases. These drawbacks hinder the
popularity of such systems.
Dept. of CSE, PESCE, Mandya
Page 4
1.6
2014-15
Proposed system
Every user who is experienced in the existing system may think of a system that may
add more flexibility and run with some common applications such as android. The proposed
system is designed in such a way to avoid the limitations of the existing system. The
proposed system supports more flexibility, comfort ability and security. This home
automation system is working with very popular android phones. It is having mainly three
components; the android enabled user device, a Wi-Fi router having good scalable range and
a raspberry pi board. Here the users have provision to control the home appliances through
android enabled device. This will improve the system popularity since there is no need for a
wired connection, internet etc. The instructions from the user will be transmitted through the
Wi-Fi network. The raspberry pi board is configured according to the home system and it will
enable the relay circuit as per user request. The relay circuit can control the home appliances
also. We can add appliances to the system which will boost additional security features.
Advantages of Proposed system
The new system will provide the following features
It allows more flexibility through android device.
It allows a good range of scalability.
It provides security and authentication.
Additional vendors can be easily added.
Page 5
2014-15
CHAPTER 2
LITERATURE SURVEY
2.1 Survey papers
1. 1Sarthak Jain, 2Anant Vaibhav [1] Proposed That Home automation is becoming more and
more popular day by day due to its numerous advantages. This can be achieved by local
networking or by remote control. This paper aims at designing a basic home automation
application on Raspberry Pi through reading the subject of
the same has been developed in python environment which is the default programming
environment provided by Raspberry Pi. Results show the efficient implementation of
proposed algorithm for home automation. Here LEDs were used to indicate the switching
action.
The popularity of network enabled home automation has been increasing greatly in recent
years due to simplicity and much higher affordability. Introduction of technology within the
home to enhance the quality of life of its occupants, through the provision of different
services such as tele health, multimedia entertainment and energy conservation. This paper
presents a basic application of Raspberry Pi in home automation control through internet (Email) where subject of the received e-mail is read by the developed algorithm fed into
raspberry Pi and system responds to the corresponding instructions. The presented system in
this paper is interactive, efficient and flexible according to the consumer needs. It
immediately replies the status of work done by raspberry Pi to the consumer.
Page 6
2014-15
The home Appliances can be monitored and accessed remotely by user via SMS or EMAIL
where GSM Modem comes into use. Multi-vendor appliances can be added to the system
with no major changes and hence system is scalable. Password protection is one of the
functionality of the system so that unauthorized user can be denied from accessing home
appliances. Another important feature is the security system that will continuously monitor
the status of home appliances and take adequate actions if required. The system will carry out
the goal of modernized home integration system of automation control and management,
house burglarproof and security and remotely control the household electric appliances
through internet. The basic target of intellectual home automation system is to provide people
a comfortable, safe, convenient and high efficient life environment and a humanistic service.
3. 1Dr. S. Kanaga suba raja, 2C. Viswanathan, 3Dr. D. Sivakumar, 4M. vivekanandan [3]
proposed the system that deals with the design and implementation of Secure Home
Automation using Raspberry Pi for mobile devices that leverage mobile technology to
provide essential security to homes and associated control operations. The proposed home
security solution hinges on novel integration of cameras and motion detectors into web
application. Raspberry Pi operates and controls motion detectors and video cameras for
remote sensing and surveillance, streams live video and records it for future playback, and
finally manages operations on home appliances, such as turning ON/OFF a television or
microwave. For instance, when motion is detected, the cameras automatically initiate
Page 7
2014-15
recording operation and the Raspberry Pi device alerts the homeowner of the possible
intrusion.
This paper looks into the development of an ANDROID application which interprets the
message a mobile device receives on possible intrusion and subsequently a reply SMS which
triggers an alarm/buzzer in the remote house making others aware of the possible intrusion.
With the widespread diffusion of mobile devices and their integration with new autoidentification technologies, the need to control and manage the smart home through these
devices is increasing. In this context, the main goal of this work is to develop and validate an
architecture, both hardware and software, able to monitor and manage a KNX based home
automation system through an Android mobile device in an efficient and safe way.
4. 1Ali Ziya Alkar [4] proposed that home automation is to control home devices from a
central control point. In this paper, the author has presented the design and implementation of
a low cost but yet flexible and secure internet based home automation system. The
communication between the devices is wireless. The protocol between the units in the design
is enhanced to be suitable for most of the appliances. The system is designed to be low cost
and flexible with the increasing variety of devices to be controlled.
The control of the devices when completely taken over by the machines, the process of
monitoring and reporting becomes more important. The power for simple but routine tasks
while we need to maintain as much control as we can over the automated processes.
Automation lowers the human judgment to the lowest degree possible but does not
completely eliminate it. This paper suggests a framework of the communication protocol
between the devices to be used in home automation. To be used in this framework they
proposed a novel communication protocol to control devices with more than just the
switching functionality. The designed system will be open to expansion and will enable
control of different types of devices. The system is designed to be low cost however at the
same time more flexible alternative with respect to similar systems.
5. 1R.A.Ramlee [5] proposed the overall design of Home Automation System (HAS) with
low cost and wireless remote control. This system is designed to assist and provide support in
order to fulfill the needs of elderly and disabled in home. Also, the smart home concept in the
Dept. of CSE, PESCE, Mandya
Page 8
2014-15
system improves the standard living at home. The main control system implements wireless
Bluetooth technology to provide remote access from PC/laptop or smart phone. The design
remains the existing electrical switches and provides more safety control on the switches
with low voltage activating method. The switches status is synchronized in all the control
system whereby every user interface indicates the real time existing switches status. The
system intended to control electrical appliances and devices in house with relatively low cost
design, user-friendly interface and ease of installation.
In order to improve the standard living in home, this system provides three different types of
physical control methods to the Main Control Board. The first physical control method is by
pressing on the modified Low Voltage Activating Switches. The conventional high voltages
switches will be replaced by the modified 5 Volt push buttons as the activating switches. The
low voltage switch eliminates the risk of dangerous electrical shock by wet hand. The second
and third control methods are performed as wireless remote control to the appliances. The
second control method is by clicking on Window GUI on PC/laptop by using mouse or touch
pad. This method provides facility to the computer user to control the home appliances
without walk to the switches on the wall. Third control method is done by Android GUI
installed in Smart Phone. The user can easily touch on the screen of the phone to control the
home appliances. This portable method is able to assist the disabled people who have
problem with locomotion difficulty.
6. 1Ali Ziya Alkar [6] proposed that Smart Home is an emerging technology growing
continuously which includes number of new technologies which helps to improve humans
quality of living. This paper proposes an adaptive home system for optimum utilization of
power, through Artificial Intelligence and Wireless Sensor network. Artificial Intelligence is a
technology for developing adaptive system that can perceive the environment, learn from the
environment and can make decision using Rule based system. Zigbee is a wireless sensor
network used to efficiently deliver solution for an energy management and efficiency for
adaptive home. An algorithm used in adaptive home system is based on software agent
approach that reduce the energy consumption at home by considering the users occupancy,
temperature and users preferences as input to the system.
A Smart Home refers to a home with intelligent to control, monitoring and automate the
home system. The Intelligent System proposed is based on the rule-based expert system and
Dept. of CSE, PESCE, Mandya
Page 9
2014-15
unsupervised learning techniques where the problem is how to adapt to new knowledge
without destroying the existing knowledge. The core controller unit is equipped with
distributed sensors i.e., intelligent agents, which use the rule-based expert system and
artificial intelligence concepts to learn and adapt. The proposed system in this paper enables
the comfort zone adjustment, i.e., the control of heating/cooling of individual rooms and/or
of the entire house; and is capable of processing inputs to and from the EGU Utility/Smart
Meter to the core controller unit. The goal of the Adaptive Learning System is to adapt to the
occupants pattern and schedule changes by providing comfort, while not ignoring the energy
conservation aspect.
7. 1Raveendra.k [7] proposed simple, low cost, low power consumption and an energy
efficient image capturing novel method for implementing the intruder security using ZigBee
(802.15.4) standard and also a security protocol for detecting and localizing identity based
attacks in the system. It consists of PIR sensor node, cmos camera deployed in the location as
well as the doors/ windows of the shopping malls, railway station together with the ZigBee
modules which act as end devices that monitor continuously and send the security status of
each location to the coordinator node connected to a PC which acts as the master. It
sends/informs over sms to the concerned department in case of most wanted person
detection. The software has been implemented using Embedded and application program for
image authentication using Mat lab.
8. 1Rajeev Piyare [8] proposed a low cost and flexible home control and monitoring system
using an embedded micro-web server, with IP connectivity for accessing and controlling
devices and appliances remotely using Android based Smart phone app. The proposed system
does not require a dedicated server PC with respect to similar systems and offers a novel
communication protocol to monitor and control the home environment with more than just
the switching functionality. To demonstrate the feasibility and effectiveness of this system,
devices such as light switches, power plug, temperature sensor and current sensor have been
integrated with the proposed home control system.
A low cost and flexible home control and monitoring system using an embedded micro-web
server, with IP connectivity for accessing and controlling devices and appliances remotely
using Android based Smart phone app. The proposed system does not require a dedicated
Dept. of CSE, PESCE, Mandya
Page 10
2014-15
server PC with respect to similar systems and offers a novel communication protocol to
monitor and control the home environment with more than just the switching functionality.
The author have utilized RESTful based Web services as an interoperable application layer
that can be directly integrated into other application domains like e-health care services,
utility, distribution, or even vehicular area networks.
9. 1Armando Roy Delgado, 2Rich Picking and 3Vic Grout [9] proposed remote controlled
operation of home automation systems. It considers problems with their implementation,
discusses possible solutions through various network technologies and indicates how to
optimize the use of such systems. The home is an eternal, heterogeneous, distributed
computing environment (Greaves, 2002) which certainly requires a careful study before
developing any suitable Home Automation System (HAS) that will accomplish its
requirements. Nevertheless the latest attempts at introducing Home Automation Systems in
actual homes for all kinds of users are starting to be successful thanks to the continuous
standardization process that is lowering the prices and making devices more useful and easier
to use for the end user. Even so several important issues are always to be handled strictly
before developing and installing a Home Automation System; factors like security, reliability,
usefulness, robustness and price are critical to determine if the final product will accomplish
the expected requirements.
10. 1Y.Usha Devi [10] proposed that Home Automation industry is growing rapidly; this is
fuelled by provide supporting systems for the elderly and the disabled, especially those who
live alone. Coupled with this, the world population is confirmed to be getting older. Home
automation systems must comply with the household standards and convenience of usage.
This paper details the overall design of a wireless home automation system (WHAS) which
has been built and implemented. The automation centers on recognition of voice commands
and uses low-power RF ZigBee wireless communication modules which are relatively cheap.
The home automation system is intended to control all lights and electrical appliances in a
home or office using voice commands. The system has been tested and verified. The
verification tests included voice recognition response test, indoor ZigBee communication
test. The tests involved a mix of 10 male and female subjects with different Indian languages.
Dept. of CSE, PESCE, Mandya
Page 11
2014-15
7 different voice commands were sent by each person. Thus the test involved sending a total
of 70 commands and 80.05% of these commands were recognized correctly.
The Wireless Home Automation System (WHAS) is an integrated system to facilitate elderly
and disabled people with an easy-to-use home automation system that can be fully operated
based on speech commands. The system is constructed in a way that is easy to install,
configure, run, and maintain. The speech recognition system is a completely assembled and
easy to use programmable speech recognition circuit. Programmable, in the sense that you
train the words (or vocal utterances) you want the circuit to recognize. This board allows you
to experiment with many facets of speech recognition technology. It has 8 bit data out which
can be interfaced with any microcontroller for further development. Some of interfacing
applications which can be made are controlling home appliances, robotics movements,
Speech Assisted technologies, Speech to text translation.
11. 1Mitali Patil, 2Ashwini Bedare, 3Varsha Pacharne [11] proposed that Intelligent Home
Automation Systems are gaining importance in todays technology dependent world. Home
Automation Systems provide a sense of security and comfort. Using Wireless technology like
ZigBee the cost of wiring of Home Automation System can be reduced as well as a reliable
and secure communication can be achieved. ZigBee is a low data rate wireless network
standard with added features like low-cost, low power consumption and fast reaction. ZigBee
is most suitable for small area networks like homes. This System also allows controlling of
devices using Voice commands which reduce user interaction with system directly. This
System uses SAPI (Speech Application Programming Interface) a Microsoft Application to
enable voice recognition when a user gives voice command to the system. This system
contains of three main components: i) Intelligent Home Server with ZigBee module, ii)
Intelligent environment detection sensor modules and iii) Voice command controlling
module. The various features of the system include turning any home appliances or devices,
playing media applications, downloading RSS feeds, sending mail.
The Intelligent Home System is a voice-controlled home automation system which controls
home appliances over a ZigBee wireless network. Voice controlling enables users a sense of
comfort as no direct operation with the home automation system is required. ZigBee helps in
Dept. of CSE, PESCE, Mandya
Page 12
2014-15
achieving a rapid rate, low power consumption and low cost network for the server to
communicate with the devices. The future work for Intelligent Home System can be porting
the system to the cloud so that any device eventually could be used to control and monitor
the Intelligent Home System remotely over cloud.
12. 1Sharon Panth, 2Mahesh Jivani [12] proposed home appliances are connected to the on/off
relay via microcontroller ports and controlled through two ways: one way is conventional
domestic switch and second is through mobile phone. The communication between the
mobile phone and the home automation system is through Bluetooth wireless technology.
This system is designed to be economical and scalable allowing one to twenty four
appliances to be controlled with minimum efforts. Password protection is being used to only
allow authorized users to control the appliances at home. Discovery method where the device
discovers other Bluetooth enabled devices. In second case, is the Known method which
allows direct connection to be established between the remote devices that are already
known.
The application works using the second method. The advantage of using the second method
is that we can establish connection directly by specifying the known devices address (here
Bluetooth Serial Adapter) within very less time as compared to the first method where it
searches for Bluetooth enabled devices first in its range and then establishes connection, if
wanted. The JABWT implementation includes the support for btspp protocol over RFCOMM
service. For the communication between the mobile phone and the embedded system (i.e.
Home Automation system) the connection string must contain the btspp protocol in the URL.
This is implemented by using the Connector class in the GCF Hierarchy. The Connector class
creates new connections dynamically using the protocol implementation class formed from
platform name and protocol name.
13. 1Faisal Baig, 2Saira Beg and 3Muhammad Fahad Khan [13] proposed Home automation is
a wide and varied field that involves devices as small as temperature, light and motion
sensor, and as powerful as modern home appliances. In todays world technology is available
for home automation but these technologies are incompatible with each other and addresses
only communication and physical media, the main objective of this work is to facilitate the
Dept. of CSE, PESCE, Mandya
Page 13
2014-15
user to control appliances by two ways one is remotely via voice command, second is using
remote control to control the appliances which is also an override control.
For that purpose a mobile application is developed that convert the user voice command into
SMS and send through GSM network. Such application is developed using java for mobile
technology and MPLAB for microchip family of controller. This proposed system is
affordable to everyone, cheap and easy to install.
A low cost and flexible home control and monitoring system using an embedded micro-web
server, with IP connectivity for accessing and controlling devices and appliances remotely
using Android based Smart phone app. The proposed system does not require a dedicated
server PC with respect to similar systems and offers a novel communication protocol to
monitor and control the home environment with more than just the switching functionality.
14. 1Rajeev Piyare and 2Seong Ro Lee [14] proposed that Home automation or smart homes
(also known as domotic) can be described as introduction of technology within the home
environment to provide convenience, comfort, security and energy efficiency to its
occupants. With the introduction of the Internet of Things, the research and implementation
of home automation are getting more popular. Various wireless technologies that can support
some form of remote data transfer, sensing and control such as Bluetooth, Wi-Fi, RFID, and
cellular networks have been utilized to embed various levels of intelligence in the home. The
studies have presented Bluetooth based home automation systems using Android Smart
phones without the Internet controllability. The devices are physically connected to a
Bluetooth sub-controller which is then accessed and controlled by the Smart phone using
built-in Bluetooth connectivity. Researchers have also attempted to provide network
interoperability and remote access to control devices and appliances at home using home
gateways. Proposed mobile IP based architecture and its potential applications in Smart
homes security and automation without any actual deployment and testing.
15. 1Basma M. Mohammad El-Basioni,
Abdelmonim Fakhreldin [15] proposes a new design for the smart home using the wireless
sensor network and the biometric technologies. The proposed system employs the biometric
in the authentication for home entrance which enhances home security as well as easiness of
Dept. of CSE, PESCE, Mandya
Page 14
2014-15
home entering process. The proposed smart home Wireless Biometric Smart Home (WB-SH)
design is one of the few designs or it is the only design that addresses the integration between
the wireless sensor network and biometric in building smart homes. The structure of the
system is described and the incorporated communications are analyzed, also an estimation
for the whole system cost is given which is something lacking in a lot of other smart home
designs offers. The cost of the whole WB-SH system is determined to be approximately
$6000, which is a suitable cost with respect to the costs of existing systems and with respect
to its offered services. WB-SH is designed to be capable of incorporating in a building
automation system and it can be applied to offices, clinics, and other places.
16. 1Ulya Sabeel, 2Nidhi Chandra [16] proposed that Security is the major part of home
automation systems for the people. With the development of network and automatic control
technology, a home security monitoring and alarming system becomes more and more
practicable today. In this paper they have proposed simple, low cost, low power consumption
and a novel method for implementing the home security using Zigbee (802.15.4) standard
and also a security protocol for detecting and localizing identity based attacks in the system.
They have named the scheme as Wireless Home Security System (WHSS) and protocol as
Wireless Home Security Protocol (WHSP). It consists of many sensor nodes deployed in the
rooms as well as the doors/ windows of the house together with the zigbee modules which act
as end devices that monitor continuously and send the security status of each room to the
coordinator node connected to a PC which acts as the master.
The communication in this case is multi-hop which provides unlimited range. Here they have
used the XBEE Pro series1 (XBP24-AWI-001) radios for RF communication, DYP-ME003
PIR sensor, and Contact Door / window sensor based on magnetic reed switch
(ORD221).The hardware implementation has been tested for validation successfully. The
software has been implemented using C#. Also the performance of the proposed security
protocol has been analysed using NS2 and is found to be satisfactory. Passive Infrared (PIR)
sensor has been used to sense human motion by detecting the IR radiations emitted from
human body. The door/ window sensor is basically a magnetic contact reed switch. The
switch remains open when no magnetic field is present.
Page 15
2014-15
CHAPTER 3
Page 16
2014-15
product that would be easy to use for all users while still maintaining an atheistically pleasing
interface which was similar to the common look and feel of other mobile applications.
Page 17
2014-15
the complexity out of driving the GPIO pins. Installing the library is almost as simple, either
at a text console or using LXTerminal we need to enter the following commands.
3.3.3 Hardware
The various hardware components which are used mainly are listed below
Dept. of CSE, PESCE, Mandya
Page 18
2014-15
Raspberry Pi
Wi-Fi router
Android device
Camera
Lights
Door sensor
SIM900A
Stepper motor
CHAPTER 4
microprocessor and the users are clients to it. Since OpenShift can provide more powerful
applications, a more advanced user interface can be created.
Page 19
2014-15
and sensors. The software produced utilizes both the built in functions as well as user
defined methods.
The application consists of several classes which will be discussed in detail in this
section. The first section describes the code produced by the interface design software and
several header files which must be included. The second section describes code we produced.
WEB SERVICES
RASPBERRY PI
2014-15
API Overview
The sections below provide a technical overview of new APIs in Android 4.0.3.
SOCIAL STREAM API IN CONTACTS PROVIDER
Applications that use social stream data such as status updates and check-ins can now
sync that data with each of the users contacts, providing items in a stream along with photos
for each.
The database table that contains an individual contacts social stream is defined by
ContactsContract.StreamItems,
due
to
the
Uri
is
nested
within
the
ContactsContract.RawContacts directory to which the stream items belong. Each social stream
table includes several columns for metadata about each stream item. Photos associated with a
Page 21
2014-15
GRAPHICS
New method setDefaultBufferSize(int, int) in SurfaceTexture sets the default size
of the image buffers. This method may be used to set the image size when
Page 22
2014-15
and
setMaxScrollY() allow apps to get and set the maximum scroll offset for an
AccessibilityRecord object.
When touch-exploration mode is enabled to the user, a new secure setting called
ACCESSIBILITY_SPEAK_PASSWORD indicates whether the user requests the
IME to speak text entered in password fields, even when a headset is not in use.
By default, no password text is spoken unless a headset is in use.
DATABASE
A new CrossProcessCursorWrapper class lets content providers return results for
a cross-process query more efficiently. The new class is a useful building block
for wrapping cursors that will be sent to processes remotely. It can also transform
normal Cursor objects into CrossProcessCursor objects transparently.
The CrossProcessCursorWrapper class fixes common performance issues and
bugs that applications have encountered when implementing content providers.
The CursorWindow(java.lang.String) constructor now takes a name string as
input. The system no longer distinguishes between local and remote cursor
windows, so CursorWindow(boolean) is now deprecated.
CAMERA
MediaMetadataRetriever adds the new constant METADATA_KEY_LOCATION
to let apps access retrieve location information for an image or video.
Page 23
2014-15
Page 24
2014-15
As shown in the above Fig 4.3, there are two users: actual user and the end user
(Raspberry pi chip). The user has the control over the appliances that is camera and lights.
The user sends the signal to the appliances. The signal sent by the user will be processed by
the Raspberry chip and it will send the appropriate response to the devices that are internally
connected to it. The signal sent by the user will be validated by the Raspberry pi chip. If the
validation made by the Raspberry pi chip is unsuccessful then there will be generation of
error messages, else the result will be generated, user request will be executed. If there is an
error in the creation of a response to the user then the appropriate error messages are
generated which are notified to the end user. This figure explains how the user will have
control over the devices connected to the device.
4.3
Sequence diagram
WIFI
SERVER/ACCESS
OTHER
RASPBERRY
CONNECT
APPLIANCES STATUS
CONTROL APPLIANCES
ACTIVATE/DECTIVATE APPLIANCES
APPLIANCES STATUS
PROPOGATE STATUS
As shown in the above Fig 4.4 the actual user is connected to the server through
internet. The user will send a request to the server which will be processed by the raspberry
pi.The raspberry pi will reply the appliances status to the users device.
Dept. of CSE, PESCE, Mandya
Page 25
2014-15
The message sent by the user will not be received by the Raspberry pi chip directly.
We will create a web page which use that as a web service that is the message sent by the
user to the Raspberry pi chip will be communicated through web page, where a service will
be created.
Python code will be running for the particular message that is sent by the user that
make sure that it is running on the command. Application status will be received through the
Server access point which is nothing but the web service. Here we use web service because,
it will be running in the background. Web service is used because, it provides the service
even though the web page is closed.
Since we cannot communicate directly with the Raspberry pi chip, the XML
document will be transmitted. We can activate/deactivate the appliances through the
raspberry pi chip.
Page 26
2014-15
CHAPTER 5
IMPLEMENTATION
Implementation is the stage of the project when the theoretical design is turned out
into a working system. Thus it can be considered to be the most critical stage in achieving a
successful new system and in giving the user, confidence that the new system will work and
be effective. The implementation stage involves careful planning, investigation of the
existing system and its constraints on implementation, designing of methods to achieve
changeover and evaluation of changeover methods.
5.1 INTERFACE
Once the template was produced, it was time integrate all the development work to
make a complete interface. The python code manages the list of controls that are to be
displayed to the user. The software package provides various views to control different
aspects of the controls, such as how they are managed and how they appear on specific client
software.
microprocessor and the users are clients to it. Since OpenShift can provide more powerful
applications, a more advanced user interface was created.
5.2 SOFTWARE
The backend code that we produced for the applications is explained in the next
section. The code flow charts will help describe the flow of the code. The server and client
application is written using Python code as the interface for Raspberry Pi to connect to lights
and sensors. The software produced utilizes both the built in functions as well as user
defined methods.
Page 27
2014-15
The application consists of several classes which will be discussed in detail in this
section. The first section describes the code produced by the interface design software and
several header files which must be included. The second section describes code we produced.
5.2.1
Page 28
2014-15
CONNECT 0
URL
DISCONNECT 1
RASPBERRY
PI
ANDROID
DEVICE
Page 29
2014-15
magnets and thus sending a signal through the wires which are connected to the Raspberry
Pi. If a 0 is received the magnet is said to be connected or else if 1 the magnet is said to
be disconnected thereby sending a signal to the device. The camera and the lights works in a
similar fashion , if the input is 0 the lights and camera are set to off state and if the input
is 1 the lights and camera are set to on state.
The Raspberry Pi communicates with the web services through url which acts as an
interface between the application and the device. The web service application will be located
on the web service server i.e., on the raspberry pi.
Page 30
2014-15
a specific application then there must be a static IP assigned to each Raspberry Pi. The
increasing demand for IPs as well as the usage of IPv6 in the near future will decrease the
cost of static IPs. Every user can buy a domain for himself to have a secure access to his
home or workplace.
The raspberry Pi is set up using Python code with certain networking concepts
embedded into it in order to connect to the internet as well as the other devices. We make use
of standard set of APIs to generate a python code which can perform user specified tasks.
Since Raspberry Pi can only interact through Python we make use of this language to
communicate with the server as well as the android device.
# activate input
Page 31
2014-15
time.sleep(0.5)
The program sets the pir_pin to be just a plain old input. This is because the PIR
sensor has a digital output of either 3.3V or 0V. By contrast, the door_pin, since it is a switch
does not generate a voltage for a digital input. So, that input pin uses the extra argument
(pull_up_down=io.PUD_UP). This activates an internal resistor that makes the input HIGH
(pulled-up) unless something stronger (like a switch connecting it to GND) pulls it LOW.
The loop then reads each of the inputs in turn and prints a message appropriately.
Remember that the door switch warning will be activated when the magnet is removed from
the sensor rather than the other way around.
Camera
First, at the Python prompt or at the top of a Python script, enter:
import picamera
This will make the library available to the script. Now create an instance of the PiCamera
class:
camera = picamera.PiCamera()
And take a picture:
camera.capture('image.jpg')
Horizontal and vertical flip
Like with the raspistill command, you can apply a horizontal and vertical flip if your
camera is positioned upside-down. This is done by changing the hflip and vflip properties
directly:
camera.hflip = True
camera.vflip = True
Be sure to use an upper case T in True as this is a keyword in Python.
Preview
Page 32
2014-15
You can display a preview showing the camera feed on screen. Warning: this will
overlay your Python session by default; if you have trouble stopping the preview, simply
pressing Ctrl+D to terminate the Python session is usually enough to restore the display:
camera.start_preview()
You can use the stop_preview method to remove the preview overlay and restore the display:
camera.stop_preview()
Alternatively, you can access the Pi using SSH from another computer, open a Python
prompt and enter these commands, displaying the preview on the monitor connected to the Pi
(not the computer you're connected from).
Camera settings
You can change other camera configuration by editing property values, for example:
camera.brightness = 70
This will change the brightness setting from its default 50 to 70 (values between 0 and 100).
Other settings are available. Here is a list with their default values:
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 50
camera.saturation = 0
camera.ISO = 0
camera.video_stabilization = False
camera.exposure_compensation = 0
camera.exposure_mode = 'auto'
camera.meter_mode = 'average'
camera.awb_mode = 'auto'
camera.image_effect = 'none'
camera.color_effects = None
camera.rotation = 0
camera.hflip = False
camera.vflip = False
camera.crop = (0.0, 0.0, 1.0, 1.0)
Dept. of CSE, PESCE, Mandya
Page 33
2014-15
Sleep
You can add pauses between commands using sleep from the time module:
import picamera
from time import sleep
camera = picamera.PiCamera()
camera.capture('image1.jpg')
sleep(5)
camera.capture('image2.jpg')
You can also use sleep in a preview to adjust settings over time:
camera.start_preview()
for i in range(100):
camera.brightness = i
sleep(0.2)
Video streaming
Record 5 seconds of video:
camera.start_recording('video.h264')
sleep(5)
camera.stop_recording()
Lights
In order to make our LEDs flash on and off we will be using python code, so open up
IDLE3, all code that you need to type in is indented into the page, make sure you get the case
and the indents exactly as I have typed them.
As we will be writing Python scripts you need to adjust IDLE3 (your code editor)
slightly so that it brings up the script edit window as well as the shell windows. to do this go
to Options > Configure IDLE > General > Startup Preferences and then select 'Open Edit
Window'. Now when you restart IDLE you will get two windows, one called 'Python Shell'
and the other called 'Untitled'. The 'Untitled' window is your python script which you will
want to save somewhere to you can find it later. To run this script select Run > Run Module
or just press F5.
Page 34
2014-15
Page 35
2014-15
The code for the message to be read is specified here. Both the message as well as the
phone number is specified at the end of the file.
def readMessage(self):
flag = False
message = ''
self.sendCommand('AT+CMGR=1')
self.serialPort.flushInput()
self.serialPort.flushOutput()
self.serialPort.readline().rstrip()
while True:
response = self.serialPort.readline().rstrip()
if len(response)>1:
if response == 'OK':
break
else:
message = message +" " + response
flag = True
Audio
Page 36
2014-15
Certain set of built-in functions have to be included in order to get the audio output
from the device.
import os
from os import listdir
import subprocess
from time import sleep
import RPi.GPIO as GPIO
The function to read the mp3 file from the file system is given below.
mp3_files = [ f for f in listdir('.') if f[-4:] == '.mp3' ]
The .mp3 file is stored in the index. Since we have used only 1 file it is stored at the
beginning of the index. The GPIO port is specified ehich is connected to the speaker and the
audio output device.
if (GPIO.input(24)):
subprocess.Popen(['mpg123', mp3_files[index]])
Stepper Motor
4 GPIO pins are used for the stepper motor. Two of them are used for the clockwise
rotation and the other two are used for the anti-clockwise rotation. Finally those 4 pins are
connected to a common pin which is enabled by the following code.
enable_pin = 18
coil_A_1_pin = 4
coil_A_2_pin = 17
coil_B_1_pin = 23
coil_B_2_pin = 24
GPIO.setup(enable_pin, GPIO.OUT)
GPIO.setup(coil_A_1_pin, GPIO.OUT)
GPIO.setup(coil_A_2_pin, GPIO.OUT)
GPIO.setup(coil_B_1_pin, GPIO.OUT)
Dept. of CSE, PESCE, Mandya
Page 37
2014-15
GPIO.setup(coil_B_2_pin, GPIO.OUT)
The clockwise and anti-clockwise rotation is set accordingly using these set of lines
def forward(delay, steps):
for i in range(0, steps):
setStep(1, 0, 1, 0)
time.sleep(delay)
setStep(0, 1, 1, 0)
time.sleep(delay)
setStep(0, 1, 0, 1)
time.sleep(delay)
setStep(1, 0, 0, 1)
time.sleep(delay)
def backwards(delay, steps):
for i in range(0, steps):
setStep(1, 0, 0, 1)
time.sleep(delay)
setStep(0, 1, 0, 1)
time.sleep(delay)
setStep(0, 1, 1, 0)
time.sleep(delay)
setStep(1, 0, 1, 0)
time.sleep(delay)
The speed of the motor as well as the angle at which it rotates is set by using the following
code.
delay = 20
steps = 50
Page 38
2014-15
os.system("python gsm.py")
CHAPTER 6
TESTING
Software testing is a critical element of software quality assurance and represents the
ultimate service of specification design and coding. It provides a road map for the developer,
the quality assurance organization and the customer, a roadmap that describes the steps to be
conducted as path of testing, when these steps are planned and then undertaken and how
much effort, time and resources will be required. It is not unusual for a software development
to spend between 30 and 40 percent of total project effort in testing.
Testing demonstrates that software functions appear to be working according to specification
and that performance requirements appear to have been met. In addition, data collected as
testing is conducted provides a good indication of software. Testing cant show the absence
of defects, it can only show that software errors are present.
Page 39
2014-15
The main aim of testing is to analyse the performance and to evaluate the errors that occur
when the program is executed with different input sources.
In this project, we developed an automated system which focuses on supermarket Queue
prevention and automation. The main aim of testing in this project is to find the compatibility
issues as well as the working performance when different sources are given as the inputs.
Page 40
2014-15
Description
Door Sensors
No
arguments
GSM Module
No
arguments
Stepper Motor
Camera Monitoring
Lights
No
arguments
No
arguments
Action
Check and
notify Pi
about door
open or
close
Send Alert
messages
when door
Triggered
Stepper
motor
Rotation
360 Degree
Relay live
stream to Pi
On and Off
LEDs
Page 41
Working
Yes
Yes
Yes
Yes
Yes
2014-15
status to Pi
Table 6.1 - Raspberry Pi Component Testing
Working
Action taken
Pi obtains the status of
door and reports back to
user
Pi obtains a live video
stream from the camera
and relays it back to user
Yes
Yes
Yes
Page 42
Test
case ID
Test case
Name
TC-01
Testing
TC-02
Integration
Testing
TC-03
TC-04
Unit
Testing
Test case
description
A Wi-Fi Router
is used as a
method of
communication
between Pi and
android
Remote login
into Pi using
PuTTy for
configuration
2014-15
Test steps
Input Expected
Given Output
Actual
Output
Pass
Successfully user
commands are executed by
Raspberry Pi
The IP and Port number is
identified, configured and
successful connection
takes place
Pass
Integration is
checked with
Python
Programming
Pass
Executing
main program
which involves
all the modules
Successful execution of
program
Pass
CHAPTER 7
Page 43
2014-15
This is the start-up screen of the android application. It is the authentication page of the user
where the user gives his username and password.
This is the second screen of the application. As soon as the user logins to his account
there are two options which appear on the screen. i.e., one option is to control the devices
such as camera, door sensors and lights. The other option is to view the live streaming
content on the users smartphone. It also provide the option such as to set the host ip address
and the port number to view the stream. Along with these option, we also have provided the
option to change the resolution of the video.
Page 44
2014-15
After clicking on the home devices option he will be directed to the page where you will see
three options to control the lights, door sensors and camera. The user can select the desired
options depending upon his requirements.
The user can access the accessories like camera, light and door sensor magnet by
sending the signal from the application to raspberry pi. If the user sends the signal to
light,then the raspberry pi sends the signal back with necessary action that the light is ON or
OFF.
Page 45
2014-15
The user sends the signal to raspberry pi to check on door and the raspberry sends
back the signal as follows, if the magnet is separated the message will be displayed as door is
OPEN or if the magnets are joined then the message will be displayed as door is CLOSED.
Now if the user wants to access the camera for live feed, then the user sends the
signal to raspberry pi to switch on the camera and to send back the message that the camera
is ON or OFF. If the camera is on then the live feed of the view inside the hall will be
displayed on the mobile device and user can see the live feed.
Page 46
2014-15
FUTURE ENHANCEMENT
Predicting the future of just about anything is very risky business. Home automation is an
industry that largely started with X10 devices in 1980. Today, we believe the future of home
automation will very much ride the digital age and develop along with the computer and
networking systems in the years to come. Initially it appeared, companies such as Microsoft
and Exceptional Innovation with their Life/ware software were positioning the Windows
Media Centre PC as the heart and soul of a complete solution for home automation relying on
web services to seamlessly interface with lighting controls, climate controls, security panels,
and IP surveillance cameras to compliment the digital media management capabilities of
Windows Media Centre.
Page 47
2014-15
BIBILIOGRAPHY
[1]1Sarthak Jain, 2Anant Vaibhav, 3Lovely Goyal Student member, Raspberry Pi based
Interactive Home Automation System through E-mail IEEE, ICROIT 2014, India, Feb 6-8
2014.
[2] 1Nausheen Belim, 2Harshada Bhambure, 3Priyanka Kumbhar, 4Simranjit Tuteja
Automate and Secure Your Home Using Zigbee Technology, International Journal of
Innovative Research in Computer and Communication Engineering Vol. 1, Issue 1, March
2013.
[3] 1Dr. S. Kanaga suba raja, 2C. Viswanathan, 3Dr. D. Sivakumar, 4M. vivekanandan Secured
smart home energy monitoring system (Schemes) using raspberry pi Journal of Theoretical
and Applied Information Technology 10th August 2014. Vol. 66 No.1.
[4] 1Ali Ziya Alkar, 2Umit Buhur, An Internet Based Wireless Home Automation System for
Multifunctional Devices Member, IEEE Volume: 51, Issue: 4
[5] 1R.A.Ramlee, 2M.H.Leong, 3R.S.S.Singh, 4M.M.Ismail, 5M.A.Othman, 6H.A.Sulaiman,
7
M.H.Misran, 8M.A.Meor Said Bluetooth Remote Home Automation System Using Android
Automation Systems with Different Network Technologies, Centre for Applied Internet
Research (CAIR), University of Wales, NEWI, Wrexham, UK.
[10] 1Y.Usha Devi, II M.Tech, Wireless Home Automation System Using ZigBee
International Journal of Scientific & Engineering Research Volume 3, Issue 8, August-2012.
Dept. of CSE, PESCE, Mandya
Page 48
2014-15
[11] 1Mitali Patil, 2Ashwini Bedare, 3Varsha Pacharne The Design and Implementation of
Voice Controlled Wireless Intelligent Home Automation System Based on ZigBee
International Journal of Advanced Research in Computer Science and Software Engineering.
Volume 3, Issue 4, April 2013 ISSN: 2277 128X
[12] 1Sharon Panth, 2Mahesh Jivani Designing Home Automation System (HAS) using Java
ME for Mobile Phone International Journal of Electronics and Computer Science
Engineering.
[13] 1Faisal Baig, 2Saira Beg and 3Muhammad Fahad Khan.Zigbee Based Home Appliances
Controlling Through Spoken Commands Using Handheld Devices, Vol. 7, No. 1, January,
2013
[14] 1Rajeev Piyare, 2Seong Ro Lee Department of Information Electronics Engineering,
Mokpo National University Smart Home-Control and Monitoring System Using Smart
Phone Volume 5, Issue 2, April 2014
[15] 1Basma M. Mohammad El-Basioni, 2Sherine M. Abd El-kader and 3Mahmoud
Abdelmonim Fakhreldin Smart Home Design using Wireless Sensor Network and Biometric
Technologies, Volume 2, Issue 3, March 2013
[16] 1Ulya Sabeel, 2Nidhi Chandra Department of Computer Science and Engineering,
Amity University An Ingenious Wireless Home Security System and Protocol based upon
Multi-hop 802.15.4 standard, Magnetic contact and PIR sensor, MECS Publisher 2013
Page 49
2014-15
APPENDIX A
Hardware components Description and Purpose
Raspberry Pi Microprocessor
The Raspberry Pi shown in Fig 1 is a series of credit card-sized single-board
computers developed in the UK by the Raspberry Pi Foundation. The Raspberry Pi shown in
fig 3.2 has a Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZFS 700 MHz processor, VideoCore IV GPU, and was originally shipped with 256 megabytes
of RAM, later upgraded 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. The Raspberry Pi primarily
uses Linux-kernel-based systems. The ARM11 chip at the heart of the Pi is based on
version 6 of the ARM. The current releases of several popular versions of Linux,
including Ubuntu, will not run on the ARM11. It is not possible to run Windows on the
original Raspberry Pi, though the new Raspberry Pi 2 will be able to run Windows 10. The
Raspberry
Pi
currently
only
supports Ubuntu
Snappy
Core, Raspbian, OpenELEC and RISC OS. The install manager for the Raspberry Pi is
NOOBS.
Page 50
2014-15
Page 51
2014-15
Page 52
2014-15
Fig 4: Router
Page 53
2014-15
Fig 6 Camera
Any camera can be chosen for the video surveillance. The cameras resolution has to
be known in prior so that it can be given in the application. Better the quality of the camera
better will be the view to the user. The basic resolution which is used will be 640x480 pixels.
Page 54
2014-15
Another aspect which has to be looked onto is the internet speed which will have a major
influence on the streaming content. Fig 6 shows the Microsoft camera which is being used.
Breadboards and LEDs
Breadboards and a bunch of LEDs i.e. Light emitting diodes are used that can be
used to replicate the function of an actual Lighting devices in home automation system.
Router configuration
The Wi-Fi unit provides the medium for communication. It can be also configured to
make security services. The Wi-Fi should be configured with a certain address and user
commands will be directing through Wi-Fi unit. We may use sudo nano
/etc/network/interfaces for configuring Wi-Fi with raspberry-pi.
Audio configuration
The Raspberry Pi has two audio output modes: HDMI and headphone jack. You can
switch between these modes at any time.
Page 55
2014-15
If your HDMI monitor or TV has built-in speakers, the audio can be played over the
HDMI cable, but you can switch it to a set of headphones or other speakers plugged into the
headphone jack. If your display claims to have speakers, sound is output via HDMI by
default; if not, it is output via the headphone jack. This may not be the desired output setup,
or the auto-detection is inaccurate, in which case you can manually switch the output.
Changing the audio output
Page 56
2014-15
Page 57
2014-15
Pin
No
1
2
3
4
5
6
7
8
9
10
11
12
Function
Name
Enable 1,2
Input 1
Output 1
Ground
Ground
Output 2
Input 2
Vcc 2
Enable 3,4
Input 3
Output 3
Ground
Page 58
Ground (0V)
Output 2 for Motor 1
Input2 for Motor 1
Supply voltage; 5V (up to 36V)
2014-15
Ground
Output 4
Input 4
Vcc 1
Stepper motor
Stepper motors provide a means for precise positioning and speed control without the
use of feedback sensors. The basic operation of a stepper motor allows the shaft to move a
precise number of degrees each time a pulse of electricity is sent to the motor. Since the shaft
of the motor moves only the number of degrees that it was designed for when each pulse is
delivered, you can control the pulses that are sent and control the positioning and speed. The
rotor of the motor produces torque from the interaction between the magnetic field in the
stator and rotor. The strength of the magnetic fields is proportional to the amount of current
sent to the stator and the number of turns in the windings.
The stepper motor uses the theory of operation for magnets to make the motor shaft
turn a precise distance when a pulse of electricity is provided. You learned previously that
like poles of a magnet repel and unlike poles attract. The stator (stationary winding) has eight
poles, and the rotor has six poles (three complete magnets).
Page 59
2014-15
The rotor will require 24 pulses of electricity to move the 24 steps to make one
complete revolution. Another way to say this is that the rotor will move precisely 15 for
each pulse of electricity that the motor receives.
The number of degrees the rotor will turn when a pulse of electricity is delivered to
the motor can be calculated by dividing the number of degrees in one revolution of the shaft
(360) by the number of poles (north and south) in the rotor. In this stepper motor 360 is
divided by 24 to get 15. When no power is applied to the motor, the residual magnetism in
the rotor magnets will cause the rotor to detent or align one set of its magnetic poles with the
magnetic poles of one of the stator magnets. This means that the rotor will have 24 possible
detent positions. When the rotor is in a decent position, it will have enough magnetic force to
keep the shaft from moving to the next position. This is what makes the rotor feel like it is
clicking from one position to the next as you rotate the rotor by hand with no power applied.
GSM SIM900A
Page 60
2014-15
Synchronous Asynchronous
Receiver
and
Transmitter)
communication).
Features
Page 61
feature
(serial
2014-15
Inbuilt Powerful TCP / IP (Transfer Control Protocol / Internet Protocol) stack for
APPENDIX B
PUBLICATION
Dept. of CSE, PESCE, Mandya
Page 62
2014-15
Page 63