Home Automation using Raspberry pi

In this article, we are introducing how to implement simple home automation by using a Raspberry Pi. By using the following method, you can control your devices in your home remotely by using your smartphone

Home automation using Arduino uno

Components Required to Perform Home Automation Using Raspberry Pi

Hardware Requirements:

  • Raspberry Pi 3 (Any other Version will be nice)
  • Memory card 8 or 16GB running Raspbian Jessie
  • 5v Relays
  • 2n222 transistors
  • Diodes
  • Jumper Wires
  • Connection Blocks
  • LEDs to test.
  • AC lamp to Test
  • Breadboard and jumper cables
  • 220 or 100 ohms resistor

Software Requirements:

In addition to the Raspbian Jessie operating system on the Raspberry Pi, we will use the WebIOPi framework, notepad++ on your PC, and filezila to copy files from the PC to the Raspberry Pi, particularly the web app files.

Hardware Implementation

Preparing the Raspberry Pi:

This section will cover the Pi upgrading procedures as well as the installation of the WebIOPi framework, which will enable us to handle communication from the webpage to the Raspberry Pi. I should definitely mention that this can be done in an arguably easier method using the Python Flask framework, but one of the most intriguing aspects of DIY is looking beneath the hood and doing the arduous work. That’s where the fun of DIY comes in.

To update the Raspberry Pi, run the following commands and then reboot it.

sudo apt-get update

sudo apt-get upgrade

sudo reboot

After this, we need to install the WebIOPi framework

cd ~

use wget to collect the file from their source

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

after download is finished, go into the directory after the extraction

tar xvzf WebIOPi-0.7.1.tar.gz

cd WebIOPi-0.7.1/

Before executing the setup, we need to install a patch because this version of the WebIOPi does not function with the Raspberry Pi 3 that I am using, and I couldn’t find a version of the WebIOPi that does.

Run the following scripts to install the patch while still in the WebIOPi directory:

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

patch -p1 -i webiopi-pi2bplus.patch

Then we can run the WebIOPi installation setup

sudo ./setup.sh

If ask proceed while installing, do iy and after the setup installation need to reboot the Pi

sudo reboot

Test WebIOPi Installation:

Before we go into the schematics and programming, we’ll need to test our WebIOPi installation to make sure everything is working properly.

Execute the command;

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

Return to the webpage after connecting and click the pin 11 button to turn on or off the LED. We can now use WebIOPi to control the Raspberry Pi GPIO.

If everything worked as expected throughout the test, we can return to the terminal and terminate the programme with CTRL + C.