Thursday, May 15, 2014

Raspberry Pi GPIO home automation

I had heard about GPIO pins on the raspberry pi and decided to do something with it. And with the holidays coming, wouldn't it be great to be able to turn on and off your light display from the web!  This is a pretty simple project that creates a web app for controlling lights.  It uses the Raspberry Pi for the internet connection and a wireless remote control to turn on and off the lights. The tricky thing is to connect the Raspberry Pi GPIOs to emulate pressing the buttons on the remote control.

 
Remove these adsRemove these ads by Signing Up

Step 1: Parts

Parts needed:
• Raspberry Pi
• Remote controlled outlets
• Ribbon cable
• Solder

(Not shown)
• PCB board
• Resisters

Tools
• Soldering gun
• Dremel/Hacksaw
• Screwdriver
• Wire cutters
• Wire striper
• Multimeter

Step 2: Web Server setup

I choose the Web2Py framework for it’s ease of installation and use.  Installation is very simple.  Follow the instructions (repeated here) at http://web2py.com/books/default/chapter/29/13#One-step-production-deployment

Connect your R-PI to the internet. Logon to your R-PI and enter the following at the command line:

wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
chmod +x setup-web2py-ubuntu.sh
sudo ./setup-web2py-ubuntu.sh


Follow the instructions on the screen.  This step will take several minutes and you may see some errors in the process, but it seems to work anyway.  The mail configuration is not really important, you can just set it as “no configuration”.  When asked about your location and such, the values aren't critical, do your best.  The most important thing is to remember the admin password that you select during the installation

Once the installation is complete you should be able to connect to web2py server from your computer.  In your computer's browser enter the address to your Raspberry Pi.  It is very important that you used https when connecting to the web2py server.  Your URL will look something like:

https://192.168.2.179/  or  https://rasberrypi


You may see a security warning in your browser.  That's OK,  you can safely ignore this warning.  If everything worked correctly, you should now see the welcome page for Web2Py.

No comments:

Post a Comment