RASPBERRY PI HOME AUTOMATION

Let us build a home automation system that can control electrical appliances such as lights, fans, gates etc suing our mobile phone from anywhere around the world. All you need is a Raspberry Pi, some relays and an android phone. Lets get started.

Components Required

  • Raspberry Pi
  • Relay
  • An Android Phone with RootSaid – WiFi Command Center installed
  • A WiFi network

Instructions

Step 1 – The Relay

Relays are switching circuits that can close and break circuits mechanically. That means it can control an electrical circuit by closing and breaking connections in that circuit.

s-l1000-768x591

relay

As you can see, there are mainly 5 terminals in a relay. Two for energizing the coil, one Common terminal, a Normally Closed terminal which will be connected to the Common terminal when the coil is not energized and a Normally Open terminal which will be in contact with the Common terminal when the coil is energized.

electromechanical-relay

images

This is how the relay works. In our case, we will be connecting

  • GPIO pins to One End of Coil
  • Ground to other End of Coil
  • Phase of Main Power Supply to The Common terminal or Pole
  • One Terminal of bulb (Or other electrical Appliance) to Normally Open Terminal
  • And the Other Terminal of Bulb to Neutral Point of Main Power Supply

 

Since the Output of Raspberry Pi GPIO pins are 3.3V, you will have to buy a 3.3V Relay. You can purchase the relay board of 4 relays that is compatible with Raspberry Pi from here or click on the image.

151158~1

Step 2 – The Raspberry Pi

Raspberry Pi is a low cost single board computer which can be used for robotics, home automation etc.

Get your Raspberry Pi from Here

12-768x585

Download and burn an OS to a micro SD card and insert it into the raspberry Pi. In this project, I used Raspbian OS. You can download the OS by clicking the below link Download

Now power it up. Now fire up your terminal and create a password for the user ‘pi’ by executing the command
sudo passwd pi
Now perform and update and upgrade by running
sudo apt update -ysudo apt upgrade -y
Now you can connect GPIO pins to Relay board

  • GPIO 11 to Relay 1 Controlling Device 1
  • GPIO 13 to Relay 2 Controlling Device 2
  • GPIO 15 to Relay 3 Controlling Device 3
  • GPIO 29 to Relay 4 Controlling Device 4

Connect your Raspberry Pi to a WiFi router or Wired network and make sure it is connected by checking whether it is getting an IP address from the switch. Connect your mobile phone to the same network and make sure there is connectivity between the mobile phone and the raspberry pi. You can confirm it by pinging your mobile phone from your Raspberry Pi by pinging to your mobile phone
ping <ip address of mobile phone>
Take a note of the IP address of the raspberry Pi as we will be using it in the future.
ifconfig

Step 4 – Connections

Raspberry Pi should be provided with 5V.

For this project we will be using 4 GPIO pins to control the devices. 11, 13, 15 and 29 all goes directly to the 4 relays input.

Step 5 – Setting Up the Listener

Best WiFi Routers of 2018

Here is a list of World’s Best WiFi Routers of the year 2018. Make sure you grab one of them for High speed, Long Range, and Stable Internet connection.

The Code

 

RPI-HO~1

Run the script by running
python automation.py

Step 6 – Install RootSaid WiFi Command Center from Google PlayStore

RootSaid WiFi Command Center is a simple light weight android application that can be used to control robots and home appliances over WiFi. All you have to do is connect your mobile phone to the network, enter the IP address and Port of the server (the home automation system) and control it using the On Off buttons. Click here to know more about this App.

Step 7

Now all you have to do is start the App, enter the IP address of the Pi and port it is listening to (5050).

685800~1

Load the IP and Port using the link button and navigate to the Home Automation Tab.

Read More Information….
RASPBERRY PI HOME AUTOMATION


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top