Sie sind auf Seite 1von 41

HOME AUTOMATION USING IOT

Abstract

We’re entering a new era of computing technology that many are calling the
Internetof Things (IoT). Machine to machine, machine to infrastructure,
machine to environment, the Internet of Everything, the Internet of
Intelligent Things, intelligent systems—call it what you want, but it’s
happening, and its potential is huge.
We see the IoT as billions of smart, connected “things” (a sort of “universal
global neural network” in the cloud) that will encompass every aspect of
our lives, and its foundation is the intelligence that embedded processing
provides. The IoT is comprised of smart machines interacting and
communicating with other machines,objects, environments and
infrastructures. As a result, huge volumes of data are being generated, and
that data is being processed into useful actions that can “command and
control” things to make our lives much easier and safer—and to reduce our
impact on the environment. The creativity of this new era is boundless,
with amazing potential to improve our lives. The following thesis is an
extensive reference to the possibilities, utility, applications and the
evolution of the Internet of Things.

CITM - CSE DEPARTMENT Page 1


HOME AUTOMATION USING IOT

TABLE OF CONTENTS

ENVIRONMENTAL MONITORING 5
1.2.3 INFRASTRUCTURE MANAGEMENT 5
1.2.4 MANUFACTURING 5
1.2.5 ENERGY MANAGEMENT 6
1.2.6 MEDICAL & HEALTHCARE SYSTEMS 6
1.2.7 BUILDING & HOME AUTOMATION 6
1.2.8 TRANSPORTATION 6
1.3 AIM & OBJECTIVES 7
1.4 MOTIVATION 9
2 BACKGROUNG 10
3 METHODOLOGY 11
3.2 MODEL DESIGN 11
3.3 TECHNICAL SOLUTIONS 13
3.3.1 COMPONENTS 13
3.3.2 USING RASPBERRY PI FOR IOT 14
3.3.3. BIPOLAR DIGITAL INTEGRATED CIRCUIT ULN2003APG 20
3.3.4 PYTHON 21
3.3.5 UBIDOTS 30
3.3.6 PUTTY 33
4 CONCLUSION 38
5 FUTURE WORK 39
BIBILOGRAPHY 40

1.Introduction

CITM - CSE DEPARTMENT Page 2


HOME AUTOMATION USING IOT
IoT allows objects to be sensed and controlled remotely across existing network
infrastructure, creating opportunities for more direct integration of the physical world
into computer-based systems, and resulting in improved efficiency, accuracy and
economic benefit; when IoT is augmented with sensors and actuators, the technology
becomes an instance of the more general class of cyber-physical systems, which
also encompasses technologies such as smart grids, smart homes, intelligent
transportation and smart cities. Each thing is uniquely identifiable through its
embedded computing system but is able to interoperate within the existing Internet
infrastructure. Experts estimate that the IoT will consist of almost 50 billion objects by
2020.

Internet of ThingsThe concept of Internet of things(IoT) was introduced by the growth of


the widely used global network known as the internet along with the deployment of
ubiquitous computing and mobiles in smart objects which brings new opportunities for the
creation of innovative solutions to various aspects of life. The concept of Internet of
things(IoT) creates a network of objects that can communicate, interact and cooperate
together to reach a common goal . IoT devices can enhance our daily lives, as each device
stop scatting as a single device and become part of an entire full connected system. This
provides us with the resulting data to be analysed for better decision making, tracking our
businesses and monitoring our properties while we are far away from them.

CITM - CSE DEPARTMENT Page 3


HOME AUTOMATION USING IOT
Evolution Of IOT

1.2 . Overview

1.2.1. Applications

According to Gartner, Inc. (a technology research and advisory corporation), there


will be nearly 26 billion devices on the Internet of Things by 2020. ABI Research
estimates that more than 30 billion devices will be wirelessly connected to the
Internet of Things by 2020. As per a recent survey and study done by Pew Research
Internet Project, a large majority of the technology experts and engaged Internet
users who responded—83 percent—agreed with the notion that the Internet/Cloud of
Things, embedded and wearable computing (and the corresponding dynamic
systems[40]) will have widespread and beneficial effects by 2025. As such, it is clear
that the IoT will consist of a very large number of devices being connected to the
Internet. In an active move to accommodate new and emerging technological
innovation, the UK Government, in their 2015 budget, allocated £40,000,000 towards
research into the Internet of Things. The British Chancellor of the Exchequer George
Osborne, posited that the Internet of Things is the next stage of the information
revolution and referenced the inter-connectivity of everything from urban transport to
medical devices to household appliances.

CITM - CSE DEPARTMENT Page 4


HOME AUTOMATION USING IOT
1.2.2. Environmental monitoring

Environmental monitoring applications of the IoT typically use sensors to assist in


environmental protection by monitoring air or water quality, atmospheric or soil
conditions, and can even include areas like monitoring the movements of wildlife and
their habitats.

1.2.3. Infrastructure management

Monitoring and controlling operations of urban and rural infrastructures like bridges,
railway tracks, on- and offshore- wind-farms is a key application of the IoT.[66] The
IoT infrastructure can be used for monitoring any events or changes in structural
conditions that can compromise safety and increase risk.

1.2.4. Manufacturing

Network control and management of manufacturing equipment, asset and


situation management, or manufacturing process control bring the IoT within the
realm on industrial applications and smart manufacturing as well.

1.2.5. Energy management

Integration of sensing and actuation systems, connected to the Internet, is likely to


optimize energy consumption as a whole.[49] It is expected that IoT devices will be
integrated into all forms of energy consuming devices (switches, power outlets,
bulbs, televisions, etc.) and be able to communicate with the utility supply company
in order to effectively balance power generation and energy usage.

1.2.6. Medical and healthcare systems

IoT devices can be used to enable remote health monitoring and emergency

CITM - CSE DEPARTMENT Page 5


HOME AUTOMATION USING IOT
notification systems. These health monitoring devices can range from blood pressure
and heart rate monitors to advanced devices capable of monitoring specialised
implants, such as pacemakers or advanced hearing aids.
1.2.7. Building and home automation

IoT devices can be used to monitor and control the mechanical, electrical and
electronic systems used in various types of buildings (e.g., public and private,
industrial, institutions, or residential)[49] in home automation and building automation
systems.
1.2.8. Transportation

The IoT can assist in integration of communications, control, and information


processing across various transportation systems.

FIGURE SHOWS SOME OF THE APPLICATIONS OF IOT

1.3 Aim and Objectives

This paper addresses an IoT software-based approach on the field of Home Automation.
Common use-cases include measuring home conditions, controlling home appliances and

CITM - CSE DEPARTMENT Page 6


HOME AUTOMATION USING IOT
controlling home access through WIFI where a person can control the devices in the home
with a click on their mobile app or the webpage without reaching to the switch board . The
main aim of the project is to promote the use of IOT which simplifies the living style of the
human.

A User has the following features:

CITM - CSE DEPARTMENT Page 7


HOME AUTOMATION USING IOT
1. Can turn on and off the electrical devices when they need to be without reaching to the
switch board.
2. In addition the user is also provided with the mobile application where the user can
perform all the functionalities which are provided on the desktop.

1.4 Motivation

During the past few years, internet was known as a big mass that we can acquire data from.
Embedding mobile transceivers to everyday items and gadgets enabled new forms of bi-
directional communication between people with other people, and people with things. That
paradigm, known as Internet of Things, that was first introduced in 1998 by Kevin Ashton,
has received recently more attention in the academia and industry ,and this would add a new
dimension to the world of Information and communication technology.While that paradigm
is growing and have high positive impact on many aspects of our lives, challenging issues
arise, that should be considered and addressed. The central issues are guaranteeing security
and privacy of users and their data. Another issue is fully achieving smartness of
interconnected devices by enabling their interaction. Exchanging data and autonomous
behaviour is the key to achieving the later . IoT has different definitions from different
perspectives, however, they all revolve around ”things” generally, collecting, exchanging
and communicating data with each others and with people through the ”internet”. IoT helps
in decision making and automating almost everything around us. The smarter life IoT vision
promises in the near future through various applications, made smart Home Automation
actually possible, starting from basically monitoring different parts of home, to actually
controlling them.Integration of IoT and Home Automation, made it possible to monitor and
control homes from different parts of the world. Some examples of applications to this are:

controlling and setting the desired temperature of the house before arriving home, turning

CITM - CSE DEPARTMENT Page 8


HOME AUTOMATION USING IOT
on/off the lights of a room and setting its intensity, running washing machine while the
person is at work, leakage or smoke detection and notification, monitoring home through
surveillance camera or car inside the house while the person is away, or remote central
locking, and many other applications.As the field of Home Automation through IoT is a
wide application in a very wide and challenging field due to the reasons mentioned in the
previous paragraphs, I chose to work on that field as part of this thesis, specifically in
maintaining and ensuring security and safety inside home.

2 Background

IoT aims in creating a network between objects embedded with sensors, that can store,
analyse, communicate and exchange data together over the internet. This leads to efficient
industry, manufacturing, efficient energy management, resource management, accurate
health care, smarter business decisions based on analysed data, safer driving through smart
cars that are able to communicate together, smart home automation and countless more
applications. As this project focuses on smart home automation through IoT, smart home
concept should be understood first. Smart homes combines common devices, found in
homes ,to be able to control it. The technology originally was developed and used to control
environmental systems, but recently, almost any electrical component can be included
within the system of smart home .The system designed for the home automation project
presented in this paper needs a control unit, a computer, to be able to control the different
electrical devices connected to it. Raspberry Pi, is a credit-card tiny computer, that can be
plugged to a monitor ,uses standard keyboard and mouse, that enables people of different
ages learn how to program. For its simplicity and capabilities, it has been chosen to be the
control unit of this project . Ubidots is a third party service provider that is used to control
the devices the raspberry pi access the information from the ubidots and the raspberry pi

CITM - CSE DEPARTMENT Page 9


HOME AUTOMATION USING IOT
controls the devices according the input give in the back end we have used the python
language to run the entire system which integrates the raspberry pi and the electrical devices
.

3. Methodology

System Architecture and Approach The first thing that had to be thought about after
choosing this topic was the system architecture. How will the appliances and devices
communicate with a web/mobile application, receive commands and send their status?
Should it be a server client protocol ,in which there is a direct connection between the
devices and the application used by the user? How will a direct connection be established
over the internet? Or should the client and server communicate through a medium channel
that the messages should be passed on before reaching the client or the server? These
questions had led to exploring different approaches and services. Raspberry Pi was chosen
as the main control unit, to connect different sensors and devices together and to the
internet. The Raspberry Pi isa tiny computer, that has forty GPIO pins and capable of being
programmed, so it was chosen for its simplicity and capabilities.

The next challenge, after finding a way to connect different devices together and tothe
internet was actually controlling them over the internet through a web/mobile application
built using Ionic Framework. Different ways and services were explored including setting-
up port forwarding on the router. Setting-up port forwarding will change the configuration
of the router and expose one port of the private Local Area Network(LAN) to the public,
which is considered a security vulnerability that has to be managed carefully. Some of the
services that were explored and considered to allow the communication of the web/mobile
application with the Raspberry Pi connecting different devices are Ubidots, the need of real-
time interaction, it was chosen as the most adequate solution.

CITM - CSE DEPARTMENT Page 10


HOME AUTOMATION USING IOT
3.2 Model Design

An essential part of the project was designing a model for simulation, testing analysing
results .The design was prepared in such a way that the system can be arrange in any
environment so that it will be ready to use at any time.

FIGURE SHOWS THE DESIGN OF THE MODEL

CITM - CSE DEPARTMENT Page 11


HOME AUTOMATION USING IOT

3.3 Technical Solutions

3.3.1 Components

• RASPBERRY PI 3 MODEL B
• RELAY BOARD
- RELAYS - 4
- LED INDICATORS - 5

CITM - CSE DEPARTMENT Page 12


HOME AUTOMATION USING IOT
- RESISTORS - 5
- Bipolar Digital IntegratedCircuit ULN2003APG

3.3.2 Using Raspberry Pi for IoT

The Raspberry Pi is a low priced, credit card sized computer. It can be connected to a
computer monitor or a television through HDMI cable and HDMI port found in
theRaspberry Pi4. It has four USB ports, allowing the connection of different peripherals to
it such as keyboard, mouse, memory stick or Wi-Fi dongle, that allows its connection to
wireless internet. As any computer, the Raspberry Pi needs an Operating System(OS)to run
on it, to allow the interaction between it and the user. Different OS choices that can run on
the Raspberry Pi are available such as Raspbian, Linux and a Windows 10special version
for the Raspberry Pi. The OS is downloaded to a micro SD card and mounted to the
Raspberry Pi’s SD memory reader. It also has Ethernet port that allows its connection to the
internet through Ethernet cable from a router.

CITM - CSE DEPARTMENT Page 13


HOME AUTOMATION USING IOT

RASPBERRY 3 MODEL B

Technical Specification:

Processor

• Broadcom BCM2387 chipset.


• 1.2GHz Quad-Core ARM Cortex-A53 (64Bit)
802.11 b/g/n Wireless LAN and Bluetooth 4.1 (Bluetooth Classic and LE)
• IEEE 802.11 b / g / n Wi-Fi. Protocol: WEP, WPA WPA2, algorithms AES-CCMP
(maximum key
length of 256 bits), the maximum range of 100 meters.
• IEEE 802.15 Bluetooth, symmetric encryption algorithm Advanced Encryption Standard
(AES)
with 128-bit key, the maximum range of 50 meters.

CITM - CSE DEPARTMENT Page 14


HOME AUTOMATION USING IOT

GPU

• Dual Core Video Core IV® Multimedia Co-Processor. Provides Open GL ES 2.0,
hardware-accelerated
Open VG, and 1080p30 H.264 high-profile decode.
• Capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with texture filtering and DMA
infrastructure
Memory
• 1GB LPDDR2
Operating System
• Boots from Micro SD card, running a version of the Linux operating system or Windows
10 IoT
Dimensions
• 85 x 56 x 17mm
Power
• Micro USB socket 5V1, 2.5A

Connectors:

Ethernet
• 10/100 BaseT Ethernet socket
Video Output
• HDMI (rev 1.3 & 1.4)
• Composite RCA (PAL and NTSC)
Audio Output
• Audio Output 3.5mm jack
• HDMI
• USB 4 x USB 2.0 Connector
CITM - CSE DEPARTMENT Page 15
HOME AUTOMATION USING IOT
GPIO Connector

• 40-pin 2.54 mm (100 mil) expansion header: 2x20 strip


• Providing 27 GPIO pins as well as +3.3 V, +5 V and GND supply lines
Camera Connector
• 15-pin MIPI Camera Serial Interface (CSI-2)
Display Connector
• Display Serial Interface (DSI) 15 way flat flex cable connector with two data lanes and a
clock lane
Memory Card Slot
• Push/pull Micro SDIO

The Raspberry Pi 3’s four built-in USB ports provide enough connectivity for a
mouse,keyboard, or anything else that you feel the RPi needs, but if you want to add even

CITM - CSE DEPARTMENT Page 16


HOME AUTOMATION USING IOT
more youcan still use a USB hub. Keep in mind, it is recommended that you use a powered
hub so as notto overtax the on-board voltage regulator. Powering the Raspberry Pi 3 is easy,
just plug any USB power supply into the micro-USB port. There’s no power button so the

Pi will begin toboot as soon as power is applied, to turn it off simply remove power. The
four built-in USB
ports can even output up to 1.2A enabling you to connect more power hungry USB devices
(This does require a 2Amp micro USB Power Supply).
The Raspberry Pi 3’s four built-in USB ports provide enough connectivity for a
mouse,keyboard, or anything else that you feel the RPi needs, but if you want to add even
more youcan still use a USB hub. Keep in mind, it is recommended that you use a powered
hub so as notto overtax the on-board voltage regulator. Powering the Raspberry Pi 3 is easy,
just plug any USB power supply into the micro-USB port. There’s no power button so the Pi
will begin toboot as soon as power is applied, to turn it off simply remove power. The four
built-in USB
ports can even output up to 1.2A enabling you to connect more power hungry USB devices
(This does require a 2Amp micro USB Power Supply)

SoC

Built specifically for the new Pi 3, the Broadcom BCM2837 system-on-chip (SoC) includes
four high-performance ARM Cortex-A53 processing cores running at 1.2GHz with 32kB
Level 1 and 512kB Level 2 cache memory, a VideoCore IV graphics processor, and is linked
to a 1GB LPDDR2 memory module on the rear of the board.

GPIO

The Raspberry Pi 3 features the same 40-pin general-purpose input-output (GPIO) header as
all the Pis going back to the Model B+ and Model A+. Any existing GPIO hardware will

CITM - CSE DEPARTMENT Page 17


HOME AUTOMATION USING IOT
work without modification; the only change is a switch to which UART is exposed on the
GPIO’s pins, but that’s handled internally by the operating system.

USB chip

The Raspberry Pi 3 shares the same SMSC LAN9514 chip as its predecessor, the Raspberry
Pi 2, adding 10/100 Ethernet connectivity and four USB channels to the board. As before,
the SMSC chip connects to the SoC via a single USB channel, acting as a USB-to-Ethernet
adaptor and USB hub.

Antenna

There’s no need to connect an external antenna to the Raspberry Pi 3. Its radios are
connected to this chip antenna soldered directly to the board, in order to keep the size of the
device to a minimum. Despite its diminutive stature, this antenna should be more than
capable of picking up wireless LAN and Bluetooth signals – even through walls.

CITM - CSE DEPARTMENT Page 18


HOME AUTOMATION USING IOT

CITM - CSE DEPARTMENT Page 19


HOME AUTOMATION USING IOT

3.3.3 Bipolar Digital

IntegratedCircuit ULN2003APG

The ULN2003APG/AFWG Series are high−voltage,


high−current
darlington drivers comprised of seven NPN darlington
pairs.
All units feature integral clamp diodes for switching
inductive
loads.
Applications include relay, hammer, lamp and display
(LED)
drivers.

Features :

• Output current (single output): 500 mA max


• High sustaining voltage output: 50 V min
• Output clamp diodes
• Inputs compatible with various types of logic
• Package Type-APG: DIP-16pi

CITM - CSE DEPARTMENT Page 20


HOME AUTOMATION USING IOT
• Package Type-AFWG: SOL-16pin

3.3.4 PYTHON

Python is an interpreted, object-oriented programming language.It is quite easy to add new


built-in modules to Python, if you know how to program in C. Such extension modules can
do two things that can't be done directly in Python: they can implement new built-in object
types, and they can call C library functions and system calls.

To support extensions, the Python API (Application Programmers Interface) defines a set of
functions, macros and variables that provide access to most aspects of the Python run-time
system. The Python API is incorporated in a C source file by including the header
"Python.h".

The compilation of an extension module depends on its intended use as well as on your
system setup; details are given in a later section.

CITM - CSE DEPARTMENT Page 21


HOME AUTOMATION USING IOT

A Simple Example

Let's create an extension module called `spam' (the favorite food of Monty Python fans...)
and let's say we want to create a Python interface to the C library function system().gif This
function takes a null-terminated character string as argument and returns an integer. We
want this function to be callable from Python as follows:

>>> import spam


>>> status = spam.system("ls -l")
Begin by creating a file `spammodule.c'. (In general, if a module is called `spam', the C file
containing its implementation is called `spammodule.c'; if the module name is very long,
like `spammify', the module name can be just `spammify.c'.)

The first line of our file can be:

#include "Python.h"
which pulls in the Python API (you can add a comment describing the purpose of the
module and a copyright notice if you like).

All user-visible symbols defined by "Python.h" have a prefix of `Py' or `PY', except those
defined in standard header files. For convenience, and since they are used extensively by the

Python interpreter, "Python.h" includes a few standard header files: <stdio.h>, <string.h>,
<errno.h>, and <stdlib.h>. If the latter header file does not exist on your system, it declares
the functions malloc(), free() and realloc() directly.

The next thing we add to our module file is the C function that will be called when the
Python expression `spam.system(string)' is evaluated (we'll see shortly how it ends up being
called):
CITM - CSE DEPARTMENT Page 22
HOME AUTOMATION USING IOT

static PyObject *
spam_system(self, args)
PyObject *self;
PyObject *args;
{
char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return Py_BuildValue("i", sts);
}

There is a straightforward translation from the argument list in Python (e.g. the single
expression "ls -l") to the arguments passed to the C function. The C function always has two
arguments, conventionally named self and args.

The self argument is only used when the C function implements a builtin method. This will
be discussed later. In the example, self will always be a NULL pointer, since we are defining

a function, not a method. (This is done so that the interpreter doesn't have to understand two
different types of C functions.)

The args argument will be a pointer to a Python tuple object containing the arguments. Each
item of the tuple corresponds to an argument in the call's argument list. The arguments are
Python objects - in order to do anything with them in our C function we have to convert

CITM - CSE DEPARTMENT Page 23


HOME AUTOMATION USING IOT

them to C values. The function PyArg_ParseTuple() in the Python API checks the argument
types and converts them to C values. It uses a template string to determine the required

types of the arguments as well as the types of the C variables into which to store the
converted values. More about this later.

PyArg_ParseTuple() returns true (nonzero) if all arguments have the right type and its
components have been stored in the variables whose addresses are passed. It returns false
(zero) if an invalid argument list was passed. In the latter case it also raises an appropriate
exception by so the calling function can return NULL immediately (as we saw in the
example).

Embedding Python in another application

Embedding Python is similar to extending it, but not quite. The difference is that when you
extend Python, the main program of the application is still the Python interpreter, while if
you embed Python, the main program may have nothing to do with Python -- instead, some
parts of the application occasionally call the Python interpreter to run some Python code.

So if you are embedding Python, you are providing your own main program. One of the
things this main program has to do is initialize the Python interpreter. At the very least, you
have to call the function Py_Initialize(). There are optional calls to pass command line
arguments to Python. Then later you can call the interpreter from any part of the application.

There are several different ways to call the interpreter: you can pass a string containing
Python statements to PyRun_SimpleString(), or you can pass a stdio file pointer and a file
name (for identification in error messages only) to PyRun_SimpleFile(). You can also call

CITM - CSE DEPARTMENT Page 24


HOME AUTOMATION USING IOT
the lower-level operations described in the previous chapters to construct and use Python
objects.

A simple demo of embedding Python can be found in the directory `Demo/embed’.

Applications for Python

Python is used in many application domains. Here's a sampling.

The Python Package Index lists thousands of third party modules for Python.
Web and Internet Development
Python offers many choices for web development:

Frameworks such as Django and Pyramid.


Micro-frameworks such as Flask and Bottle.
Advanced content management systems such as Plone and django CMS.
Python's standard library supports many Internet protocols:

HTML and XML

JSON
E-mail processing.
Support for FTP, IMAP, and other Internet protocols.
Easy-to-use socket interface.
And the Package Index has yet more libraries:

Requests, a powerful HTTP client library.

CITM - CSE DEPARTMENT Page 25


HOME AUTOMATION USING IOT
BeautifulSoup, an HTML parser that can handle all sorts of oddball HTML.
Feedparser for parsing RSS/Atom feeds.
Paramiko, implementing the SSH2 protocol.
Twisted Python, a framework for asynchronous network programming.
Scientific and Numeric

Python is widely used in scientific and numeric computing:

SciPy is a collection of packages for mathematics, science, and engineering.


Pandas is a data analysis and modeling library.

IPython is a powerful interactive shell that features easy editing and recording of a work
session, and supports visualizations and parallel computing.
The Software Carpentry Course teaches basic skills for scientific computing, running
bootcamps and providing open-access teaching materials.
Education

Python is a superb language for teaching programming, both at the introductory level and in
more advanced courses.

Books such as How to Think Like a Computer Scientist, Python Programming: An

Introduction to Computer Science, and Practical Programming.


The Education Special Interest Group is a good place to discuss teaching issues.
Desktop GUIs
The Tk GUI library is included with most binary distributions of Python.

Some toolkits that are usable on several platforms are available separately:

CITM - CSE DEPARTMENT Page 26


HOME AUTOMATION USING IOT
wxWidgets
Kivy, for writing multitouch applications.
Qt via pyqt or pyside
Platform-specific toolkits are also available:

GTK+

Microsoft Foundation Classes through the win32 extensions


Software Development
Python is often used as a support language for software developers, for build control and
management, testing, and in many other ways.

SCons for build control.

Buildbot and Apache Gump for automated continuous compilation and testing.
Roundup or Trac for bug tracking and project management.
Business Applications
Python is also used to build ERP and e-commerce systems:

Odoo is an all-in-one management software that offers a range of business applications that
form a complete suite of enterprise management applications.
Tryton is a three-tier high-level general purpose application platform

CITM - CSE DEPARTMENT Page 27


HOME AUTOMATION USING IOT

PROGRAM

bulb1="5aa7db1cc03f97139d409794"
bulb2="5aa7db24c03f97140cf7a5ab"
bulb3="5aa7db2cc03f97140cf7a5af"
bulb4="5aa7db35c03f9713ef054c6f"
from ubidots import ApiClient
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(33,GPIO.OUT)
GPIO.setup(35,GPIO.OUT)
GPIO.setup(37,GPIO.OUT)
api=ApiClient(token="A1E-SvmOc0iB8TeqOQkl1Qcqho4kDV9Ue5")
dev1=api.get_variable(bulb1)
dev2=api.get_variable(bulb2)
dev3=api.get_variable(bulb3)
dev4=api.get_variable(bulb4)
while True:
var1=dev1.get_values(1)
if var1[0]['value']:
print 'Device 1 ON'
GPIO.output(31,1) #LIGHT WILL POWER ON
else:
print 'Device 1 OFF'
GPIO.output(31,0)
time.sleep(1)
var2=dev2.get_values(1)
if var2[0]['value']:
print 'Device 2 ON'
GPIO.output(33,1) #LIGHT WILL POWER ON

CITM - CSE DEPARTMENT Page 28


HOME AUTOMATION USING IOT

else:
print 'Device 2 OFF'
GPIO.output(33,0)
time.sleep(1)
var3=dev3.get_values(1)
if var3[0]['value']:
print 'Device 3 ON'
GPIO.output(35,1) #FAN WILL POWER ON
else:
print 'Device 3 OFF'
GPIO.output(35,0)
time.sleep(1)
var4=dev4.get_values(1)
if var4[0]['value']:
print 'Device 4 ON'
GPIO.output(37,1) #PHONE GETS CHARGED
else:
print 'Device 4 OFF'
GPIO.output(37,0)
time.sleep(1)

CITM - CSE DEPARTMENT Page 29


HOME AUTOMATION USING IOT

3.3.5 UBIDOTS

The Future is Connected


Connect your things to the internet and control them effortlessly with Ubidots
Phone
Ubidots cloud-based platform for IoT home and office automation gives you the power to
connect devices and easily deploy custom solutions to customers.
• Devices
• Connect devices securely and quickly
• Real-time data
• Gather detailed real-time data
• Lives
• Use data-driven analytics to enrich lives
• Common Applications
• Smart thermostats
• Lighting and Blinds Control
• Garage Door Control
• Air Quality Monitoring
• Sump-pump Controls
• Sound Detectors
• Benefits
• Convenient Lifestyle
• Comfortable Living
• Cost Effective
• Conserves Energy

In line with Ubidots guiding principles, in 2018 Ubidots spun out and repurposed its first
ever cloud version as “Ubidots for Education.” Rather than retire this shared-resource

CITM - CSE DEPARTMENT Page 30


HOME AUTOMATION USING IOT

platform, Ubidots instead empowers 35,000+ students and IoT innovators to explore and
develop technology and solutions, giving all users their first device free, always!

The precursor to Ubidots, Ubidots for Education is an IoT enablement platform that give
users the tools to learn and make an impact - be it big or small.

IMAGE SHOWS THE DASHBOARD OF UBIDOTS

CITM - CSE DEPARTMENT Page 31


HOME AUTOMATION USING IOT

INTERFACE ON THE ANDROID APP FOR CONTROLLING DEVICES

CITM - CSE DEPARTMENT Page 32


HOME AUTOMATION USING IOT

3.3.6 .PUTTY

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows
platform. PuTTY is open source software that is available with source code and is
developed and supported by a group of volunteers.

The SSH protocol was developed as a secure, encrypted replacement for the RSH protocol.
RSH is used for remote shell access to a UNIX (or UNIX-like) system and was once
popular among sysadmins before network security became the constant concern it is now.
Now, thanks to SSH, the same convenience can be had with an encrypted protocol famous
for its versatility and strong security. While OpenSSH is probably the most-used
implementation of SSH in the world, PuTTY is likely the most-used SSH client for the MS
Windows platform.

CITM - CSE DEPARTMENT Page 33


HOME AUTOMATION USING IOT

The SSH protocol was developed as a secure, encrypted replacement for the RSH protocol.
RSH is used for remote shell access to a UNIX (or UNIX-like) system and was once
popular among sysadmins before network security became the constant concern it is now.
Now, thanks to SSH, the same convenience can be had with an encrypted protocol famous
for its versatility and strong security.

While OpenSSH is probably the most used implementation of SSH in the world, PuTTY is
likely the most used SSH client for the Microsoft Windows platform.

PuTTY's basic capabilities

Like OpenSSH, PuTTY is a very versatile tool for remote access to another computer. It's
probably used more often by people who want secure remote shell access to a UNIX or
Linux system than for any other purpose, though that is only one of its many uses.

PuTTY is more than just an SSH client. It supports all of the following protocols:

raw: The raw protocol is normally used for network debugging.


rlogin: This is an unencrypted UNIX remote login protocol that uses port 513 by default.
serial: The serial option is used to connect to a serial line. The most common purpose for
this is to establish a serial connection between computers in lieu of an Ethernet or other
network connection.

SSH: As already noted, SSH is an encrypted secure remote login protocol, which uses port
22 by default.
Telnet: Like rlogin, Telnet (telecommunication network) is an unencrypted remote login
protocol. It typically uses port 23 and is available on many systems other than UNIX. Like
rlogin, Telnet has waned in popularity due to privacy concerns.
In addition to the five protocols supported by PuTTY, it also supports features such as saved

CITM - CSE DEPARTMENT Page 34


HOME AUTOMATION USING IOT

session configurations, session logging, locale (language) settings, and proxy sessions.

The importance of SSH on Windows


Of course, there are a number of reasons to use a tool like PuTTY. But the most common
purposes are related to the SSH protocol.

It's a terrible idea to connect to a Web host over an unencrypted connection for management
of your Web hosting account and for file transfers. Using an unencrypted login is a good
way to get your Web hosting account "owned" by a malicious security cracker. Using a
secure, encrypted protocol like SSH for such purposes is a much better option.
SSH via PuTTY offers a quick, easy way to securely access a UNIX shell environment from
a Windows system. This is handy not only because of the obvious need some people have
for working with both Windows and UNIX/Linux systems, but also for both people who are
forced to use Windows and want access to the power of the UNIX shell and people who are
forced to use UNIX and want the convenience of their Windows environment while they do
it.
As with OpenSSH, PuTTY can be used as a secure Web proxy.
PuTTY can be used to secure TortoiseSVN connections with a Subversion server.
This is by no means an exhaustive list, but it's a good start.

CITM - CSE DEPARTMENT Page 35


HOME AUTOMATION USING IOT

IMAGE SHOWS ACCESSING THE RASPBERRY PI THROUGH ITS IP ADDRESS

CITM - CSE DEPARTMENT Page 36


HOME AUTOMATION USING IOT

CITM - CSE DEPARTMENT Page 37


HOME AUTOMATION USING IOT

4. Conclusion

Home Automation is one of the important applications of IoT. It provides easier and leisure
living for every person. In this project, an approach for developing an IoTs software-based
smart home automation system was implemented and tested through the built model. It
focuses on safety and security perspective of home automation through using some of the
recent available technologies. The technologies used in implementing this project are: The
Raspberry Pi, credit-card sized computer, was used as the main control unit of the project, in
which different devices and sensors were connected toit; PubNub, Data Stream Network,
was used as the way of bi-directional connection between the two Raspberry Pis from an
end, and the mobile application from the other end; OpenCV was used in implementing a
simple motion detection algorithm, which determines if a room is occupied; JSON was used
as the data exchanged format; and finally Ionic was used in developing the mobile
application. The case studies showed satisfying results with infrequent and acceptable lag,
which maybe caused as a reason of the usage of 3G connection

CITM - CSE DEPARTMENT Page 38


HOME AUTOMATION USING IOT

5 . FUTURE WORK

Future Work IoT is having tremendous attention recently and its various applications are
growing, changing the way we live and work. This project’s main focus was on security and
safety perspective of smart home automation, which is a small part of what can be
automated and controlled inside a smart home. Future work focus would be working on
actual AC devices to implement what was simulated in the model in a real house,
developing amore advanced motion detection algorithm on surveillance cameras, and
surveillance car moving autonomously avoiding obstacles.As there are various appliances
that can be controlled and automated while being away from home, the same approach used
in implementing this project will be used to enable control over various appliances before
reaching home, saving time and effort ;Such application examples can be, monitoring
temperature and humidity, and being able to control them, controlling stoves and
microwaves, locking and unlocking doors autonomously depending on the visitor face
recognition and confidence level, surveillance car moving autonomously reaching for a
security breach or safety issue to live stream what happens so that the user can act
accordingly and many others that would combineIoT with smart appliances autonomy.

CITM - CSE DEPARTMENT Page 39


HOME AUTOMATION USING IOT

Bibliography

[1] Luigi Atzori, Antonio Iera, and Giacomo Morabito. The internet of things: A
survey.Computer Networks, 54(15):2787 – 2805, 2010.
[2] Nicola Bui and Michele Zorzi. Health care applications: A solution based on theinternet
of things. In Proceedings of the 4th International Symposium on AppliedSciences in
Biomedical and Communication Technologies, ISABEL ’11, pages 131:1–131:5, New York,
NY, USA, 2011. ACM.
[3] L. Coetzee and J. Eksteen. The internet of things - promise for the future?
anintroduction. In IST-Africa Conference Proceedings, 2011, pages 1–9, May 2011.
[4] L Heuser, Z Nochta, and NC Trunk. Ict shaping the world: A scientific view, 2008.
[5] Nurzhan Nurseitov, Michael Paulson, Randall Reynolds, and Clemente
Izurieta.Comparison of json and xml data interchange formats: A case study. Caine,
2009:157–162, 2009.
[6] Kari Pulli, Anatoly Baksheev, Kirill Kornyakov, and Victor Eruhimov. Real-
timecomputer vision with opencv. Commun. ACM, 55(6):61–69, June 2012.
[7] V. Ricquebourg, D. Menga, D. Durand, B. Marhic, L. Delahoche, and C. Loge.The smart
home concept : our immediate future. In 2006 1ST IEEE InternationalConference on E-
Learning in Industrial Electronics, pages 23–28, Dec 2006.
[8] G´erald Santucci et al. From internet of data to internet of things. In Paper for
theInternational Conference on Future Trends of the Internet, volume 28, 2009.
[9] M. Soliman, T. Abiodun, T. Hamouda, J. Zhou, and C. H. Lung. Smart home:Integrating
internet of things with web services and cloud computing. In CloudComputing Technology
and Science (CloudCom), 2013 IEEE 5th International Con-ference on, volume 2, pages
317–320, Dec 2013.
[10] A. Zanella, N. Bui, A. Castellani, L. Vangelista, and M. Zorzi. Internet of things
forsmart cities. IEEE Internet of Things Journal, 1(1):22–32, Feb 2014.

CITM - CSE DEPARTMENT Page 40


HOME AUTOMATION USING IOT

Internet of Things for Home Automation (PDF Download Available). Available from:
https://www.researchgate.net/publication/
314508660_Internet_of_Things_for_Home_Automation [accessed Apr 03 2018].

CITM - CSE DEPARTMENT Page 41

Das könnte Ihnen auch gefallen