ISBN : 978-93-5268-349-9 Paper ID-IESSENTC102
Web Based Home Automation using IoT Satyam H. Nalawade#1, Nileshkumar K. Verma *2, Ravindra N. Rathod #3 Electronics and Telecommunication Engineering Department, 1
[email protected] 2
[email protected] [email protected] Government College of Engineering, Karad, India II. Methodology Abstract— The proposed paper aims at designing a The section shows block diagram for home automation basic home automation system on Raspberry Pi system, implementation of HAS and Algorithm through accessing a web address and controlling the implemented for HAS appliances.The algorithm for the same has been developed in python environment which is the default A. Block Diagram The proposed system consists of two different sites programming environment provided by Raspberry Pi. viz. Server and the Client site. The Server side is The algorithms are linked to the GUI via html / php implemented using the apache2 web server on board platform. Results show the efficient implementation of the Raspberry Pi 3 Board. The webpage is hosted on proposed algorithm for home automation. This paper the webserver through which the user can access the deals with web connectivity using IoT and energy online control panel to control the appliances efficient control of the home appliances in a userinterfaced with the GPIO (General purpose Input friendlymanner. The connectivity achieved by use of Output) of the Raspberry Pi. The hosted web interface Raspberry Pi . The interface between the hardware is implemented using HTML and CSS thus providing and software of the entire system is achieved by a GUI to the user. The logical side of the webpage i.e. Raspberry Pi . It is connected to the internet using the control inputs are implemented in the background Ethernet port. This also give platform to lean all three using PHP. Each button is linked with a python script technologies together – Linux,Python, and HTML located on the webserver. Upon the clicking of the Keywords— Raspberry Pi, Home automation systems control button the respective python script executes (HAS), IoT on the Raspberry Pi python handler which then drives the relay to which the appliances are connected. Thus, I. INTRODUCTION the end user can have an efficient remote control via Home automation has gained popularity due to its the internet. numerous advantages. Using this basic concept one can have a dynamic access to the Home using the Local Area Network (LAN) which can be extended to have control via the web or internet. The algorithm for the same has been developed in python environment which is the default programming environment provided by Raspberry Pi. The algorithms are linked to the GUI via html / php platform. The previous work on home automations system consists of an experimental set up have been developed to control two lights, a cooler and alarm for gas leak [3], an Arduino based distributed HAS system consistsof aserver,hardware, and interface modules. server controls its alarm and actuators, the web server software is Fig. 1. Block diagram for Home Automation developed using ASP.net [4] HAS - mainly three System. components a Wi-fi module,Raspberry Pi Board, Relay circuit.Wi-Fi is used as a communication channel between B. Component Description android phone and the Raspberry Pi Board [5] 1) Raspberry Pi 3 . 3
ISBN : 978-93-5268-349-9 The Raspberry Pi 3 is third generation Raspberry is linked with the webserver. The webserver hosts the Pi model. It has a 1.2 GHz 64-bit quad core ARM user interface as a web page. v8 CPU, 802.11 n Wireless LAN, Bluetooth 4.1, 1 GB RAM, 4 USB Ports, 40 GPIO pins, full HDMI 4) Linking Module port, Ethernet port, micro SD card slot along with The last module is to link the python script with the a Camera interface (CSI) and a Display interface web module. This link is done by using PHP. (DSI). D. Implementation of Home Automation 2) HDMI Cable System To connect the Raspberry Pi 3 to the display monitor or a TV set. 1) Setting up the Raspberry Pi 3.
C.
1)
2)
3)
The Raspberry Pi is connected to the Monitor using a 3) Ethernet Cable To connect the Raspberry Pi to the Local Area HDMI cable and is provided with the mouse and keyboard to give inputs. A micro SD card preinstalled with NOOBS Network and the Internet. (New Out of the Box System) containing the Raspbian Linux distribution is inserted in the memory card slot. 4) Relay Driver Board The control signal obtained from the GPIO of the Raspberry Pi is given to the Relay driver board to 2) Installing Raspbian drive the relay and turn ON or OFF the connected The Raspbian Linux distribution is installed via the appliance. NOOBS with the prescribed configuration settings System Design 3) Setting up web server The proposed System incorporates basically with the following four modules. The apache2 web server is set in the Raspberry Pi using Raspberry Pi GPIO Connection the Command Terminal by using the following command A fully functioning Raspberry Pi running a sudo apt-get install apache2 reasonably recent build of Raspbian Linux that is connected to home 4) Setting up PHP network through wired or wireless that home network has internet access through a router that uses NAT The PHP which serves as a pre-processor to the HTML that is is set using the following command through the comfortable using Pi’s command line interface. Command Terminal. sudo apt-get install php5 Web Server Module A web server is needed to create a link between the 5) Python scripts for the GPIO remote user and the Raspberry Pi.A Web server is a program that, using the client/server model and the The python script for each GPIO is written in the text World Wide Web's Hypertext Transfer Protocol editor available in the Raspbian. The python scripts are (HTTP), serves the files that form Web pages to Web stored in the folder /var/www/html/ with an extension .py users (whose computers contain HTTP clients that . Before linking the scripts in PHP, it is necessary to make forward their requests).The user can access the them executable by using the following command webserver using the port number of the respective sudo chmod +x scriptname.py raspberry PI. The webserver used here is apache2. 6) Creation of the Web page and linking the python scripts User Interface The user interface is a combination of HTML, The webpage required for the control of the GPIO is JavaScript, and CSS. The user interface(UI) is designed using HTML and CSS. The PHP links all the everythingdesigned into an information device with python scripts to the respective control button. which a human being may interact including display screen, keyboard, mouse, light pen, the appearance of a desktop, illuminated characters, help messages, and 7) Hosting the web application on an internet server how an application program. Later the user interface
ISBN : 978-93-5268-349-9 To accesses the web application via internet it has to be hosted first which can be done by using various online free web hosting services or paid services. 8) Interfacing Raspberry Pi GPIO with Optocoupler The GPIO’s of the Raspberry Pi are connected to the input pins of the optocoupler which isolates the High Power and Low Power circuits. The appliances are connected output pins of the optocoupler.
E. Circuit Diagram: Figures 2,3,4, respectively shoes interfacing of Raspberry Pi to home appliances like lamp, fan etc. Below circuit uses TRIAC and Opto -couples to use small voltage to control high voltage device.The GPIO Pin are connected to pin 1 and 3 of the optocoupler (MOC3021) pin 6 and 4 gets connected internally (within optocoupler) and allows current flow between them. This connection provides GATE current to the TRIAC and it starts conducting m which completes the circuit and makes the bulb to glow. When GPIO pins go low, opto-coupler makes pin 6 and 4 electrically opened and doesn’t allow any current to flow between pin 2 and 1 also stops. which turns load off. TRIAC are selected with respect to the current rating and power consumption of the load .BT136 has current rating 4ampers.
Fig. 4. Interfacing Table FAN to GPIO.17
F.
Algorithm
The control panel is opened through the url of the web server. The opened webpage consists of control buttons. Pressing the button will fetch the linked python script. The python script will be executed on the Raspberry Pi module which will control the state of the Optocoupler which will determine the ON /OFF state of the appliances.
Fig. 2. Interfacing Lamp Load to GPIO .22
Fig. 3. Interfacing Refrigerator to GPIO.27
Fig.5. Algorithm Automation System
III. RESULTS
implemented
for
Home
ISBN : 978-93-5268-349-9 The appliances were successfully controlled from the web server client.Results show the efficient implementation of proposed algorithm for home automation
Government college of Engineering, Research, and Development grant.
Karadunder
REFERENCES [1] Raspberry Pi Technical documentation from Elinux.org. [2] Home automation system using Raspberry Pi using huckster.iot [3] Vinay Sagar K N , Kusuma S M, “Home Automation using Internet of Things ”, International Research Journal of Engineering and Technology (IRJET) , Volume :2 ,Issues :03 June -2015 ,PP19651970 [4] Ahmed Elshfee , Karim AlaaHamed , “Design and Implementation of a Wi-Fi Based Home Automation System,” International Journal of Computer, ElectricalAutomation,Control, and Information Engineering Vol :6, No:8,2012, pp 1074-1080. [5] Shaijupaul ,AshlinAnthony ,Aswathy B,”Android Fig 6. Web based GUI hosted on the Raspberry Pi based Home automation Using Raspberry Pi IJCAT – apache2 server international Journal of computing and Technology Volume 1, Issue 1,Februrary 2014,pp143-147” [6] Sahil Saxena , Rohit Gupta “Internet of things baes IV CONCLUSIONS Home Automation using Raspberry PI”IJESCInternational journal of Engineering Science and These technologies are useful to build smart homes and computing ,April 2016 pp 3849-3851 smart cities. Home automation are required for energy [7] Monika M Patel, Mehul Ajajal “Home Automation saving and remote monitoring and control. Raspberry Pi is using RaspberryPi” International Journal of an intelligent platform using which multiple appliance can Innovative and Emerging Research in Engineering be connected to each other and can be controlled from a Volume2, Issue 3,2015 longer range of distance. ACKNOWLEDGMENT This work is supported by the Department of Electronics and Telecommunication Engineering,