This tutorial will show you how to build a simple Raspberry Pi home automation system that will allow you to control appliances in your home from anywhere in the world. It will also allow you to view data from the PIR motion sensor via the internet to detect intruders. This project will be using platforms like the Raspberry Pi, IBM’s IoTF (Internet of Things Foundation) and Bluemix packages and can be used as a perfect project to get into the world of the Internet of Things. So let’s get started!
- Raspberry Pi 2 / B+.
- USB wifi dongle.
- USB keyboard and mouse.
- HDMI monitor and cable.
- Micro USB power adapter (smartphone charger).
- PIR motion sensor.
- Male-female and male-male jumpers.
- BC547 transistor.
- 5V SPDT relay and 1n4001 diode.
- LED and 220Ohm resistor.
How Does it Work?
If you are a beginner to Raspberry Pi, I recommend reading this Basic Linux Commands tutorial. You can also use our free eBook to learn how to set up the Pi and the Raspbian OS. The Raspberry Pi home automation system uses client and server side python scripts. These can communicate with each other through IBM’s IoTF platform. This whole Internet of Things project can be divided into two parts:
Sending Commands to the Raspberry Pi
The server side script running on our laptop or on a web server takes input commands from the user and correspondingly sends it to the client (Raspberry Pi). Here, we will be using commands to turn a light ON/OFF. When we pass the command to turn ON a light through the server side script, the information is relayed to the Raspberry Pi and its GPIO pin turns ON a relay. The system also sends status updates to the server on whether the light is ON/OFF.
Receiving Data from the Raspberry Pi
When sending data from the PIR motion sensor connected to the Raspberry Pi, we run a script which reads the sensor through a GPIO pin and broadcasts the data through the IoTF platform. This can then be viewed through the IoTF console or through a custom web application designed using the platform.
For more detail: IoT Based Raspberry Pi Home Automation Using IBM Bluemix