SlideShare a Scribd company logo
1 of 13
• It is a concept where devices in our home or wherever
they are , have the capability to communicate with each
other via the internet web based using normal HTTP
protocols , you will be able to control any appliance in
your home from anywhere.
• 1.Raspberry Pi model B with memory card preloaded with
an OS.
• 2.WiFi dongle .
• 3.USB keyboard.
• 4.HDMI monitor.
• 5.Device Controller module
• 1.PHP.
• 2.HTML/CSS.
• 3.Python.
• 4.Linux/Rasbian.
of two parts:
1.Server
2.Client.
Here,the server is the web interface consisting of buttons
and UI (User Interface) that will allow you to turn ON/OFF a
device.
It consists of PHP files, Html files and a .txt file (to store
data).
The server usually stores information regarding the button
press on the page (ON/OFF) on a .txt file.
• his is a simple Html file called main.html ,consisting of two
buttons.
• The clicking of the buttons will trigger the execution of a PHP file
called button.php.
• This program serves as an API (Application Programming
Interface) to store data on to a text file called button Status.txt.
• The data is a string : “ON”, if ON button is clicked and “OFF”, if
OFF button is clicked.
• Thus the current button press state is recorded in the text file :
buttonStatus.txt.
 The client side consists of a Raspberry Pi with a relay circuit
connected to its GPIO pin.
 The pi runs a python program which is used to ‘Post’ a url link
using urllib2.
 That is, the pi constantly reads the contents of a url link.
 Here, the url link is another PHP file called buttonStatus.php
 This PHP file serves as an API to read the contents of the text file
buttonStatus.txt
 After reading the data, the python program checks if the string
obtained is “ON” / “OFF” based on which it switches ON/OFF the
relay respectively via its GPIO pin.
• Step 1: Preparing the html, php files
• Step 2: Setting up the relay circuit for the
Raspberry Pi home automation system
• Step 3: Setting up the Raspberry Pi
• Here, the server side of the system has to be set up. If you are having your own domain, you
• can use the file manager service to drop these files into your server and can be used to control
• your IoT systems from anywhere around the world. The files to be put in your server are :
• main.html , button.php , buttonStatus.php and buttonStatus.txt , download them from here :
• DIY Hacking – Raspberry Pi home automation system and extract it. The program raspbi.py is
• the python program which is to be copied to your raspberry pi.If you are new to html and php ,
• don’t worry. This project will need only a basic understanding of the two languages, spending
• some time on a few tutorials :HTML for beginners , PHP for beginners and reading the code
• would be su cient. The html file consists of a basic UI with two buttons. On button press, it
• triggers a PHP program which writes a string to a .txt files depending on the button pressed.The
• .txt le stores information of the last button state.
• However, if you don’t have a domain, you can simulate a domain in your local network or wi
• using a service called xampp. It is very simple, the instructions for using it are here : Xampp Web
• Server Emulator Windows and Xampp Web Server Emulator Linux. Using xampp you can useyour
• pc as a local web server. However, the IoT systems gets con ned to a control range limited
• to your home wi network. Drop the html, php and .txt les into the /htdocs/xampp directory.
Step 2: Setting up the relay circuit for the Raspberry Pi home
automation system
• A small relay circuit is to be made , to switch an appliance ON/OFF
Step 3: Setting up the Raspberry Pi
• If you have a brand new raspberry pi and are looking for instructions to load the OS into the SD
• card please follow this tutorial: Installing the OS for raspberry pi.The default OS used with the pi
• is the raspbian.To use the GUI for pi, use the command “startx” in the terminal. You can use an
• Edimax wi dongle for wireless connectivity, use the wi con g application in the desktop of
• your pi to scan and connect to the wi network.The raspberry pi is used to continually run a
• python program called raspbi.py , copy this le to your pi. Before executing this le , open the
• le using “nano raspbi.py” and edit the line that says :
• “response=urllib2.urlopen(‘https://diyhacking.com/projects/IOTautomation/buttonStatus.php’)”
• by replacing the link within ‘ ‘ , by your own link generated either through xampp or your own
• domain.On using the command “sudo python raspbi.py”, it will initiate the program.
• You can use the raspberry pi without a monitor by using ssh. SSH (Secure Shell) can be used to
• control the pi remotely from a pc in the same home network, if you know the ip address of your
• pi. Use “ifcon g” command on your pi to nd the ip address. Use “sudo /etc/init.d/ssh start” to
• initiate the ssh service.Then, from a remote pc using putty software (for windows) , open the
• terminal and enter the command “sudo ssh ipaddress -l pi” , “ipaddress” is replaced with the
• actual ip address you obtained for the pi in the range 192.168.1.1 – 192.168.1.254.
• Connect the relay circuit to the raspberry pi. You need to connect GPIO pin no : 5 and 6 (GND) to
• the circuit as in the schematic. Please note: Raspberry pi uses GPIO pins 5 and 6 to get into safe
• mode by shorting them together. Hence, please use any other GPIO other than 5 by editing the
• python program, to prevent booting into the safe mode

More Related Content

Similar to Raspberry pi home automation idea

5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdfJayanthi Kannan MK
 
Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreBenjamin Moore
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSanjay Kumar
 
Workshop For pycon13
Workshop For pycon13Workshop For pycon13
Workshop For pycon13Steven Pousty
 
Php introduction and configuration
Php introduction and configurationPhp introduction and configuration
Php introduction and configurationVijay Kumar Verma
 
Smart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PISmart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PIKrishna Kumar
 
Habitat Overview
Habitat OverviewHabitat Overview
Habitat OverviewMandi Walls
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuis Rodríguez Castromil
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry piFahim Hossain
 
Web design and_development
Web design and_developmentWeb design and_development
Web design and_developmentchaxubzxreid
 
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Chris Tankersley
 
Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Chris Tankersley
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confooCombell NV
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntuIker Coranti
 

Similar to Raspberry pi home automation idea (20)

5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
 
Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMoore
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
 
Workshop For pycon13
Workshop For pycon13Workshop For pycon13
Workshop For pycon13
 
Php introduction and configuration
Php introduction and configurationPhp introduction and configuration
Php introduction and configuration
 
Smart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PISmart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PI
 
Habitat Overview
Habitat OverviewHabitat Overview
Habitat Overview
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry pi
 
Web design and_development
Web design and_developmentWeb design and_development
Web design and_development
 
Software Instructions
Software InstructionsSoftware Instructions
Software Instructions
 
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
 
Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Raspberry Pi ppt.pptx
Raspberry Pi ppt.pptxRaspberry Pi ppt.pptx
Raspberry Pi ppt.pptx
 
Raspberry Pi ppt.pptx
Raspberry Pi ppt.pptxRaspberry Pi ppt.pptx
Raspberry Pi ppt.pptx
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntu
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Raspberry pi home automation idea

  • 1.
  • 2. • It is a concept where devices in our home or wherever they are , have the capability to communicate with each other via the internet web based using normal HTTP protocols , you will be able to control any appliance in your home from anywhere.
  • 3. • 1.Raspberry Pi model B with memory card preloaded with an OS. • 2.WiFi dongle . • 3.USB keyboard. • 4.HDMI monitor. • 5.Device Controller module
  • 4. • 1.PHP. • 2.HTML/CSS. • 3.Python. • 4.Linux/Rasbian.
  • 6. Here,the server is the web interface consisting of buttons and UI (User Interface) that will allow you to turn ON/OFF a device. It consists of PHP files, Html files and a .txt file (to store data). The server usually stores information regarding the button press on the page (ON/OFF) on a .txt file.
  • 7. • his is a simple Html file called main.html ,consisting of two buttons. • The clicking of the buttons will trigger the execution of a PHP file called button.php. • This program serves as an API (Application Programming Interface) to store data on to a text file called button Status.txt. • The data is a string : “ON”, if ON button is clicked and “OFF”, if OFF button is clicked. • Thus the current button press state is recorded in the text file : buttonStatus.txt.
  • 8.  The client side consists of a Raspberry Pi with a relay circuit connected to its GPIO pin.  The pi runs a python program which is used to ‘Post’ a url link using urllib2.  That is, the pi constantly reads the contents of a url link.  Here, the url link is another PHP file called buttonStatus.php  This PHP file serves as an API to read the contents of the text file buttonStatus.txt  After reading the data, the python program checks if the string obtained is “ON” / “OFF” based on which it switches ON/OFF the relay respectively via its GPIO pin.
  • 9. • Step 1: Preparing the html, php files • Step 2: Setting up the relay circuit for the Raspberry Pi home automation system • Step 3: Setting up the Raspberry Pi
  • 10. • Here, the server side of the system has to be set up. If you are having your own domain, you • can use the file manager service to drop these files into your server and can be used to control • your IoT systems from anywhere around the world. The files to be put in your server are : • main.html , button.php , buttonStatus.php and buttonStatus.txt , download them from here : • DIY Hacking – Raspberry Pi home automation system and extract it. The program raspbi.py is • the python program which is to be copied to your raspberry pi.If you are new to html and php , • don’t worry. This project will need only a basic understanding of the two languages, spending • some time on a few tutorials :HTML for beginners , PHP for beginners and reading the code • would be su cient. The html file consists of a basic UI with two buttons. On button press, it • triggers a PHP program which writes a string to a .txt files depending on the button pressed.The • .txt le stores information of the last button state. • However, if you don’t have a domain, you can simulate a domain in your local network or wi • using a service called xampp. It is very simple, the instructions for using it are here : Xampp Web • Server Emulator Windows and Xampp Web Server Emulator Linux. Using xampp you can useyour • pc as a local web server. However, the IoT systems gets con ned to a control range limited • to your home wi network. Drop the html, php and .txt les into the /htdocs/xampp directory.
  • 11. Step 2: Setting up the relay circuit for the Raspberry Pi home automation system • A small relay circuit is to be made , to switch an appliance ON/OFF
  • 12. Step 3: Setting up the Raspberry Pi • If you have a brand new raspberry pi and are looking for instructions to load the OS into the SD • card please follow this tutorial: Installing the OS for raspberry pi.The default OS used with the pi • is the raspbian.To use the GUI for pi, use the command “startx” in the terminal. You can use an • Edimax wi dongle for wireless connectivity, use the wi con g application in the desktop of • your pi to scan and connect to the wi network.The raspberry pi is used to continually run a • python program called raspbi.py , copy this le to your pi. Before executing this le , open the • le using “nano raspbi.py” and edit the line that says : • “response=urllib2.urlopen(‘https://diyhacking.com/projects/IOTautomation/buttonStatus.php’)” • by replacing the link within ‘ ‘ , by your own link generated either through xampp or your own • domain.On using the command “sudo python raspbi.py”, it will initiate the program. • You can use the raspberry pi without a monitor by using ssh. SSH (Secure Shell) can be used to • control the pi remotely from a pc in the same home network, if you know the ip address of your • pi. Use “ifcon g” command on your pi to nd the ip address. Use “sudo /etc/init.d/ssh start” to • initiate the ssh service.Then, from a remote pc using putty software (for windows) , open the • terminal and enter the command “sudo ssh ipaddress -l pi” , “ipaddress” is replaced with the • actual ip address you obtained for the pi in the range 192.168.1.1 – 192.168.1.254.
  • 13. • Connect the relay circuit to the raspberry pi. You need to connect GPIO pin no : 5 and 6 (GND) to • the circuit as in the schematic. Please note: Raspberry pi uses GPIO pins 5 and 6 to get into safe • mode by shorting them together. Hence, please use any other GPIO other than 5 by editing the • python program, to prevent booting into the safe mode