Friday, March 6, 2015

Home automation system based on Raspberry pi

After building the Raspberry Pi tablet, i decided to do more, this time something for home automation, and what better thing to automate first than the light system.
For this project i ordered a Raspberry Pi model A. The main difference between model A and model B is that model A doesen't have an RJ45 port and 2 usb, also the ram have been lowered to 256 mb. Becase of this downgrades it is more cheaper, but for an automation project it is perfect.
The idea is to set some ports as output, connect those ports to some optocouplers that acts as a switch for the 12V adpter that power the 12V relays that turn on/off the lights.


In the above picture you can see the optocouplers and the relays soldered on an old pc power supply circuit board.
The relay board and the Raspberry board is fitted inside the power supply metal case for protection



I also wanted to have an touch pannel inside the wall, and for that i decided to use a simple android tablet.The andorid tablet is set to automatically connect to the raspberry via wifi, the light of the display  set to minimum and always on.
The interface that control the relays is called Webiopi which allow you to use HTML codes to create a nice interface for the output ports.



In this image you can see the web interface on the tablet mounted in the wall.
Becase i use webiopi i can switch the light both from any device that can connect to the internet.
I also let the analog switches of the light bulbs, in case something goes wrong with the raspberry board or the relays. Those switches are connected to the relays, so it is possible to turn on the light from the analog switch and turn it off from the touch panel (or any device) and vice versa.
Here is a video with the system in action:




Source code of the HTML file: index.html