0% found this document useful (0 votes)
117 views5 pages

Saath

The document describes a system to automate home appliances like lights and fans using a Raspberry Pi, PIR sensor, relay board and touch screen. The system can be controlled via an Android app or browser over WiFi/LAN. A PIR sensor detects presence and triggers scripts on the Raspberry Pi web server to control relays and appliances.

Uploaded by

saathvekha16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views5 pages

Saath

The document describes a system to automate home appliances like lights and fans using a Raspberry Pi, PIR sensor, relay board and touch screen. The system can be controlled via an Android app or browser over WiFi/LAN. A PIR sensor detects presence and triggers scripts on the Raspberry Pi web server to control relays and appliances.

Uploaded by

saathvekha16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Intelligent Appliances Controller Using Raspberry Pi

Through Android Application & Browser

Mr. Atonu Ghosh


Institute of Engineering & Management: Computer Science & Engineering Department
Salt Lake, Kolkata, India
[email protected]

Abstract— Using the inexpensive Raspberry Pi to automate Raspberry Pi. This automation system is capable of sensing
the tasks at home such as switching appliances on & off over Wi- the presence of a human being in the area of deployment so as
Fi (Wireless Fidelity) or LAN(Local Area Network) using a to turn on & off the necessary loads like lights and fans when
personal computer or a mobile or a tablet through the browser. it senses human presence. Its sense is overridden by using the
This can also be done by using the dedicated Android Android app or any browser to fit the needs of the user. A
application. The conventional switch boards will be added with a capacitive multi-touch screen can be added to the system
touch screen or replaced with a touch screen to match the taste of which will act as a touch switch board.
the user's home decor. PIR (Passive Infrared Sensor) sensor will
be used to detect human detection and automate the on and off
functionality. A. Hardware Components
The hardware components for this system essentially
Keywords— Raspberry Pi; Android Application; PIR sensor; comprises of the Raspberry Pi, PIR motion sensor, 4 channel
human detection; LAN; automate; touch screen photo coupled relay board for Raspberry Pi, 7” or 10”
capacitive multi-touch screen for Raspberry Pi and other
I. INTRODUCTION necessary components like power adapter, HDMI ( High-
Definition Multimedia Interface ) cable for the touch screen,
Modern days are the ones where we, the human beings Micro SD card, connecting wires etc.
exploit the technical knowhow at each level possible so as to
simplify and ease our lives. IoT and SoC are among such The Raspberry Pi being the heart of the project controls the
knowhow. The IoT (Internet of Things) is a group a devices above mentioned 4 channel relay which achieves the
connected over a network using cloud computing, web switching operation for us as per the output of the
applications and network communications in order to share corresponding GPIO pin to which it is connected to. The relay
information, store and retrieve data.[1] The SoC (System on board being photo coupled and having its own relay driver
Chip) is an electronic chip or an integrated circuit that has the integrated circuit like ULN2003A, makes it extremely safe to
whole computing system on it. This very innovation (SoC) has use with the very sensitive and low current output Raspberry
led to a tremendous drop in the production cost of computing Pi GPIO pins.
systems and in turn a much reduced cost for the end user for a
complete computing system. Such a system is the Raspberry A 7” or 10” capacitive multi-touch screen for Raspberry Pi
Pi. is used here to provide the feature of a digital touch enabled
switch board. This screen actually displays the beautifully
The Raspberry Pi is a very low cost small credit card sized designed buttons in the web page. This design is fully
computer (single board) developed in the United Kingdom by customizable and depends completely upon the user’s taste.
the Raspberry Pi Foundation. The price ranging from $20 to This hardware or feature of the project is optional as other
modes of controlling (through browser and Android
$35. Since its first release, the foundation has released application) are available.
several models with different hardware features. The latest one
being the Raspberry Pi - 3 released in February 2016 which The PIR motion sensor is used to sense the presence of
has on board Wi-Fi and Bluetooth. The Raspberry Pi 3 uses a human being as it detects the infra red rays emitted by the
Broadcom BCM2837 SoC with a 1.2 GHz 64-bit quad- core human body and processes it with it’s on board circuitry and
ARM Cortex-A53 processor, with 512 KB shared L2 cache, provides a high or low as an output indicating the presence of
1GB of RAM, providing a great thrust over its predecessor a human being or absence. This high and low output is used as
(Raspberry Pi – 2), about 80% faster in parallelized tasks.[2] a trigger to a predefined Python script on the Raspberry Pi
Equipped with 40 general purpose input output pins and web server which in turn performs a set of operations such as
consuming ultra low power of 800mA (4.0 W) it is very well switching certain GPIO pins of the Raspberry on or off thus
suited for various IoT projects and its usage is limited by turning the relay on or off.
imagination.
The Raspberry Pi being the heart of the project captures The relay when connected to any load such as a light or a
our attention a lot in this project of Intelligent Android fan or any load of such sort necessarily must be compatible
Application & Browser Controlled Appliances Using

978-1-5090-0996-1/16/$31.00 ©2016 IEEE


with the ratings of the relay used else may result in burn out of II. SETTING THINGS UP
the relay board and even damage to the appliance connected. Below is the block diagram of the basic functionality of
Since the Raspberry Pi uses a Micro SD Card as its the system. The diagram provides an idea how the units of the
secondary memory, it is recommended to use at least a Micro system interacts and in turn creates the whole set of features.
SD Card of 8 GB capacity. For better speed and performance a
class 10 card is preferable.
A Wi-Fi router is needed if the project is implemented
using a Raspberry Pi other than Raspberry Pi 3, as the
Raspberry Pi 3 has on-board Wi-Fi. We need this router for
mobility; also the mobile phones do not support standard
Ethernet port connectivity. So the Wi-Fi is the only option to
connect to our local web server though PCs can be connected
via Ethernet.

B. Software Components
The project essentially comprises of the current version of
Raspberry Pi operating system, the Raspbian Jessie, (version
May 2016), Flask (version 0.11), Python 3, HTML and CSS.
Raspbian Jessie is the official operating system for the
Raspberry Pi based on Debian Linux. It is extremely user
friendly and the GUI is awesome though we have very little or
nothing to do with the GUI of the OS. We may use the OS
headless after deploying the project. The Raspberry Pi and all
other mentioned components except the display is exactly Figure 1: Functional Block Diagram of the System
what we need. From the very beginning of the project itself we
may go headless and SSH(Secure Shell) into our Raspberry Pi
to configure it as per our project specifications.
With the Micro SD card having loaded with the Raspbian
Jessie image in it, we need to first assign a static IP(Internet
Flask is a web framework for Python which we can use to Protocol) to our Raspberry Pi so that it always remains same
create website using Python. The best thing is Flask is BSD as we will be using this IP as the URL to the website for the
licensed.[4] interface to switch the lights on and off. This static IP
assignment can be done in two ways.
Python is one of the most widely used high-level, general-
purpose, interpreted, object oriented, dynamic programming Firstly, we can configure a static IP in the router it is
language created by Guido van Rossum. It’s power, connected to. Secondly, we can change the configuration file
simplicity, flexibility & robustness is incredible. Whatever of the Raspberry Pi to assign it a static IP. Whatever way it is,
way you praise the mighty Python it’s less! Our project uses it has to have a static IP else it would be very taxing later on to
Python 3 all along. find its IP and visit the webpage. Over that, the Android app
would be assigned the static IP while building, so we don’t
Python provides a module named the RPi.GPIO which is want it to change later on. Once the static IP is set, we go
dedicated to control the GPIO on a Raspberry Pi. Current headless and simply SSH into the Raspberry Pi.
version of RPi.GPIO available is 0.6.2.[3] This module does
the trick for us. We simply import the module in our Python
A. Installing flask
script and create the magic in the project’s codes.
Installing Flask is too simple; it’s just a matter of one line
HTML (Hypertext Markup Language) is the standard command. Issuing the following command completes the
markup language used for creating web pages. Each HTML Flask installation.
document has a set of tags that describe the structure of the
page along with the contents. Along with HTML, CSS sudo apt-get install python3-flask
(Cascading Style Sheets) is used to describe the way the
contents are presented. The CSS is the element that adds the
beauty to the web page. CSS is optional in our case it is just To check if working properly post successful installation,
for a pleasant feeling to our eyes while using the website or we create a very simple ‘Hello IEMCON’ app. We create a
the application. new folder and name it as IEMCON. Inside IEMCON folder
we now create a new Python file and name it as hello.py and
write the following code inside this hello.py file.
B. The Final Project Implementation
hello.py In this project we are using four GPIO pins of the
Raspberry Pi for each room. We are configuring the system
from flask import Flask for two rooms. In total we will be using 4+4 = 8 GPIO pins for
app=Flask( name ) output purposes and two GPIO pins for two PIR sensor for
@app.route(‘/’) two rooms. The input GPIO pins for Room 1 are pin #17, #27,
def index(): #22 & #23 and for Room 2 the pins are pin #5, #6, #13 & #19.
return ‘Hello IEMCON’ We name our final project app as IEMCON_PI. So we
if __name == “ main ”: create a new folder with same name i.e. IEMCON_PI. Inside
app.run(host=’0.0.0.0’, debug=True) IEMCON_PI we create two more folders with names
‘templates” and “static”.
Now to run the recently created Hello IEMCON app we The “templates” folder will contain the html files which
change our present working directory to the IEMCON will serve as a blue-print for the output of our app i.e. the User
decretory where the hello.py file is present and issue the Interface. The “static” folder will contain the CSS file and the
following command. pictures used in the User Interface. All python scripts will be
present in the IEMCON_PI folder.
sudo python3 hello.py
Since we need the User Interface for two rooms, we copy
Upon issuing the above command we get the following in the IEMCON_PI folder and paste it in the same directory with
the terminal representing the running state of the Hello a new name, IEMCON. So, now we have two apps for each of
IEMCON app. the two rooms.
We will be using single Raspberry Pi for both the rooms.
We simply assign the python files of the two rooms different
port numbers as shown in the code snippet below.

.
.
.
if name == "__main__":
app.run(host='0.0.0.0', port=5000, debug=True)

Port Configuration For Room 1.

Screen Shot: Terminal Showing Running hello.py .


Now we are ready to check the app using a browser. The .
static IP assigned to the Raspberry Pi used here is 192.168.1.7 .
So we simply enter 192.168.1.7:5000 in the address bar of our if name == "__main__":
browser from any device on the same network and we get the app.run(host='0.0.0.0', port=5001, debug=True)
following output which confirms the working of Flask.
Port Configuration For Room 2
When all scripts are ready, it’s time for setting up the
wiring. Plugging in the relay board & PIR sensor to the
Raspberry Pi using jumper wires to the corresponding GPIO
pins used. Now we may visit our web server URL which is the
static IP of our Raspberry Pi and appending it with “:5000“
port number for Room 1 and “5001” port number for Room 2.
In our case, the address of Room 1 is “192.168.1.7:5000” and
the address of Room 2 is “192.168.1.7:5001”, since
“192.168.1.7” is the static IP assigned to the Raspberry Pi in
this project.
Below are the screen shots of the User Interface of the
system configured for two rooms.
Screen Shot: Accessing The IEMCON App
The arrow at the bottom of the user interface helps in
navigation. Clicking on it takes pulls the URL of the
respective room associated with it and thus renders the user
interface for that room.

III. SYSTEM COST ANALYSIS


Since the system uses a single Raspberry Pi which is the
main component of the whole project and also this is the most
expensive component among all other components required in
the project, the system cost reduces with increasing
zones/rooms of deployment as with increasing number of
rooms we just need to increase the instances of the Flask app
which once developed can be modified without any extra cost
Screen Shot: User Interface For Room 1 and negligible timing. Obviously we have to keep a check on
the maximum number of GPIO pins that can be used on a
single Raspberry Pi before increasing the number of
rooms/zones.
With increasing rooms/zones we just need extra relay
module, PIR sensor and wires. The touch screen is optional.

A. System Cost Estimation for Two Rooms


The template is designed so that author affiliations are not
repeated each time for multiple authors of the same affiliation.
Please keep your affiliations as succinct as possible (for
example, do not differentiate among departments of the same
organization). This template was designed for two affiliations.

Seria Item Quantity Price


1 Raspberry Pi – 3 Kit 1 $89.95[5]
Screen Shot: User Interface For Room 2
2 4 Channel Relay 2 $6.99[6]
Module
3 Jumper Wire & - $4.58
Other Wires
4 7” Multi Touch Optional $59.99[7]
Screen
Total ( Excluding touch screen ) $108.51
Total ( Including touch screen ) $168.5

Table: System Cost Estimation For Two Rooms

B. System Cost & Feature Comparison


Comparing the system with other wireless solutions
available in the market like the PHR04 Wireless RF Key
Screen Shot: Accessing Both Rooms At The Same Time Chain Remote Control by X10 Home Automation [8] is able
two control only two loads with a single radio frequency based
C. Styling Of User Interface remote controller & it costs $24.99/piece. In our case, where
The user interface has been implemented using CSS. The we are controlling two rooms with four loads each, would
CSS has been so set that it generates a simple and clean require four such PHR04 remote controllers and would cost
interface with toggle buttons which change their color $24.99 X 4 = $99.96.
indicating the on and the off state. Green, indicating off and Moreover extension of zone or room will cost additional
Red, indicating on. $24.99 for two extra loads where as this is not the case with
The toggle feature has been implemented using same the Raspberry Pi based system that we have developed.
image with just the difference in color. So when the image is Above all, the radio frequency based solution has its own
changed by the code upon clicking on the button the user limitations. A typical radio frequency module used in such
simply gets an illusion of changing color of the switch.
remote controllers usually 433MHz is able to cover a distance system is deployed, for instance on a burning sunny day we
of few meters, whereas the Raspberry Pi based system will be might want our air conditioner in the living room to be on and
generally connected using Wi-Fi routers whose range is much cool the room before we reach home! Even we might recheck
higher than those remote controllers. on the door lock switch! These actions are only possible when
we have an access to the system even from outside our Local
Also, the radio frequency based solution has only one Area Network.
dedicated controller where as the Raspberry Pi based solution
has no such limitation, any supported device on the same Achieving the access over the internet needs a bit of tweak.
network can access the user interface. We may Port Forward our home router and use a free DNS
(Domain Naming System) more precisely DDNS (Dynamic
Even when the PHR04 RF Key Chain Remote Controller Domain Naming System) who provide a free static URL so
is replaced with an advanced version having more number of that we can point to our home ISP (Internet Service
switches results in inconvenience and wastage of switches due Provider)’s IP which is generally dynamic in nature.
to non-usability. The PHR03 Wireless RF Remote Control [9],
by X10 Home Automation provides switching of up to 16 Port Forwarding is the concept of forwarding the packets
devices. Such a remote is very tough to install in two rooms of one port to another port.
and even managed to install in two rooms the sharing of the
remote will create a scenario as good as not having a remote There are even more options like, we may use free services
controller. like the Weaved who provides a web based dashboard to
connect to our Raspberry Pi.

110 VI. CONCLUSION


108 In this paper we analyzed the project titled Intelligent
106 Appliance Controller Using Raspberry Pi. We explored the
104 working of the system with an analysis of the whole hardware
102 as well as software setup. We even had a brief idea of what
Price In $ future developments can be done to the system so as to make
100
it more efficient. We can now conclude that a low cost
98 solution to the need of automating & switching appliances is
96 possible with the Raspberry Pi.
94
X10 Solution Raspberry Pi
Based Solution
VII. ACKNOWLEDGEMENT
I would like to thank the department of Computer Science
Chart: Price Comparison Between X10 Home Automation & Engineering of Institute of Engineering & Management,
& Raspberry Pi Based System For Two Rooms. Kolkata, India for providing me this opportunity to share the
project. I am extremely thankful to Prof. Himadri Nath Saha
for his constant support and guidance on completion of this
IV. THE KIOSK MODE paper.
The digital switch board feature is achieved by running the
web browser in Kiosk mode. The kiosk mode is the one in VIII. REFERENCES
which the browser runs in full-screen mode without any
toolbar or menu bar. The idea is, we run the browser in kiosk
[1] Charalampous Doukas, “Building Internet of Things With The
mode and adding the browser and the Flask application (web Arduino,” CreateSpace Independent Publishing Platform, vol.1,2012
server) as auto start application when the operating system [2] Wikipedia – The free encyclopedia. - www.wikipedia.com.
starts. Thus as soon as the system boots or reboots we get the
[3] Python Official Website – www.python.org.
web page on the screen which is our digital switch board’s
[4] Flask website - www.flask.pocoo.org.
functional element.
[5] Adafruit website – www.adafruit.com.
[6] Amazon website - www.amazon.com.
[7] Amazon website - www.amazon.com.
V. EXTENDING THE SYSTEM ACCESS RANGE [8] X10 Home Automation - https://www.x10.com/x10-
pro/controllers/wireless/phr04.html.
Till now the system is accessible only in the Local Area [9] X10 Home Automation - https://www.x10.com/x10-
Network. This limits the access to the new i.e. we might want pro/controllers/wireless/phr03-wireless-rf-remote-control.html
to implement the system in certain application areas that need azon.com.
monitoring even when we are away from the place where the

You might also like