top of page

Home Automation Using Respberry Pi

Urban Skate Park

LIST OF COMPONENTS AND TOOLS

 

Components:

❏ Raspberry Pi

❏ 4 Channel Relay

❏ Bulbs or LEDs

❏ Breadboard

❏ Jumper Wires

 

 

Tools / Libraries:

❏ Django

❏ WebIOPi

❏ Python

 

 

 

Raspberry Pi

The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and

uses a standard keyboard and mouse. It is a capable little device that enables people of all ages to explore

computing, and to learn how to program in languages like Scratch and Python.

 

 

 

Channel Relay Module

The 4-Channel Relay Driver Module makes it simple and convenient to drive loads such as 12V

relays from simple 5V digital outputs of your Arduino compatible board or other microcontroller.

You can use any of the control channels independently, so simply leave any unused channels

disconnected

 

 

TOOLS / LIBRARIES

 

 

Django Framework :

 

Django is a Python-based free and open-source web framework, which follows the

model-template-view architectural pattern. It is maintained by the Django Software Foundation, an

independent organization established as a 501 non-profit. Django's primary goal is to ease the

creation of complex, database-driven websites.

 

 

WebIOPi Framework :

 

The Original one Control, debug, and use your Pi's GPIO, sensors and converters from a web

browser or any app. WebIOPi is the perfect Swiss-knife to make connected things. Developed and

provided by Eric PTAK (trouch) Runs on Raspberry Pi.

 

 

 

Implementation / Working

 

Preparing the Raspberry Pi :

 

This section will comprise of the Pi updating procedures and installing the WebIOPi framework

which will help us handle communication from the webpage to the raspberry pi.

To update the raspberry Pi below commands and then reboot the RPi;

sudo apt-get update

sudo apt-get upgrade

sudo reboot

 

With this done, the next thing is for us to install the webIOPi framework.

Make sure you are in home directory using;

cd ~

Use wget to get the file from their sourceforge page;

 

wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz

 

When download is done, extract the file and go into the directory;

tar xvzf WebIOPi-0.7.1.tar.gz

cd WebIOPi-0.7.1/

 

At this point before running the setup, we need to install a patch as this version of the WebIOPi

does not work with the raspberry pi 3 which we are using and we couldn’t find a version of the

WebIOPi that works expressly with the Pi 3.


Below commands are used to install patch while still in the WebIOPi directory, run;


wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch

patch -p1 -i webiopi-pi2bplus.patch


Then we can run the setup installation for the WebIOPi using;

sudo ./setup.sh


Keep saying yes if asked to install any dependencies during setup installation. When done, reboot

your pi;


sudo reboot


Test WebIOPi Installation:


Now, we will need to test our WebIOPi installation to be sure everything works fine as desired.

Run the command;


sudo webiopi -d -c /etc/webiopi/config


After issuing the command above on the pi, point the web browser of our computer connected to

the raspberry pi to http://127.0.0.1:8000 or http;//thepi’sIPaddress:8000. The system will prompt

for username and password.


Username is webiopi

Password is raspberry


This login can be removed later if desired but even our home automation system deserves some

extra level of security to prevent just anyone with the IP controlling appliances and IOT devices in

your home.

 

After the login, look around, and then click on the GPIO header link.





CONCLUSION & RESULT


With our components connected, we fired up our server, from a webpage, we will go to the IP of

our Raspberry Pi and indicate the port, Now, we will login with our username and password, and

we should see a webpage that looks exactly like the image below




Now we can easily control our AC Home appliances from anywhere wirelessly, just by clicking on

the buttons. This will work from Mobilephone, tablet etc. and we can add more buttons and relays

to control more devices.




bottom of page