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.

Step 1: Parts

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

(Not shown)
• PCB board
• Resisters

• Soldering gun
• Dremel/Hacksaw
• Screwdriver
• Wire cutters
• Wire striper
• Multimeter
<p>Can u tell me exactly how i can access this server from an outside network?</p><p>Thanks</p>
<p>Port forward the RPi, then access the IP. (Read up on port forwarding...)</p>
<p>hi..what if i use university wifi..how do i make the portforwarding if i cant access the router?</p>
hello, and thank you willq44 for the project, great project. <br>the only one problem i have is that i don't use wireless rel&egrave;, but cable rel&egrave;. So that when i push the web button to switch on lights, lights turn on for 1 second and immediatly switch off, the same then i push the button to turn off them. <br>How can i solve this problem? <br>many thanks <br>lorenzo <br>
Have the same problem that Lorenzo Ribani described.<br> <br> The current buttons act as a trigger which goes on and then almost immediately off. What should be modified to make each button a toggle that will behave following a pattern like: click--&gt;ON, click again--&gt;OFF (and so forth)<br> <br> Thanks! :)
<p>Have you solved this? I am also doing the same to control the relay on an off as and when I want like a normal switch in homes.</p>
willq44 or anyone has any pointer on how to change the behavior of the buttons to turn them into a relay &quot;lick--&gt;ON, click again--&gt;OFF&quot; instead of having them send a pulse to simulate the push of the button on the remote as it was needed in this project (bueller... bueller... ;D)? Thanks!
<p>Hello friend do you found any solution for your query. I am also dealing with it.</p>
<p>i am running raspbian. can you simply give us</p><p>setup-web2py-ubuntu.sh because i am having problem setup apache 2.2 to 2.4 . please uploade somewhere or email me kotarajeshece@gmail.com</p>
<p>You made nice project</p><p>I made simple Do it yourself in 10 minutes bluetooth controlled home automation</p><p><a href="http://www.instructables.com/id/Take-control-of-your-house-in-10-Minutes/" rel="nofollow">http://www.instructables.com/id/Take-control-of-your-house-in-10-Minutes/</a></p>
<p>internal error was made !!!</p>
<p>I have a remote controler where the button &quot;pulls down&quot; the micrcontroller line to the ground when it is pressed (opposite to your case of pulls up).</p><p>How can I do the wiring ?</p>
<p>great idea, can you wire up the kettle and washing machine as well?</p>
<p>don't be silly Snellingkorey, that would take at least 2 Raspberrys and a Strawberry!</p>
<p>In my case ,Installing web2py on a raspberry running raspbian, I had to modify a line on setup-web2py-ubuntu.sh</p><p>From:</p><p>sudo a2ensite default</p><p>To:</p><p>sudo a2ensite default.conf</p><p>Also, the auth types on the default.conf were on apache 2.4 format, whereas the setup script installed me apache 2.2 so I had to make changes according to <a href="http://httpd.apache.org/docs/2.4/upgrading.html#run-time" rel="nofollow">http://httpd.apache.org/docs/2.4/upgrading.html#ru...</a></p>
<p>i am running raspbian. can you simply give us </p><p>setup-web2py-ubuntu.sh because i am having problem setup apache 2.2 to 2.4 . please uploade somewhere or email me mejlgago@gmail.com</p>
<p>If I wanted to upscale this to more than just three switches, how would I do that?</p>
<p>Great instructable, detailed and well explained. Keep up the good work</p>
<p>Hi pals!</p><p>The resistor used on this project are dependent on the RF controller? Why were these picked?</p>
<p>How could i set this up to run locally, that is running the program directly on the pi without internet acess?</p>
<p>My project is home automation and CCTV. After doing the cctv function using pi, we did the automation part. Upto step 7, everything went perfectly. After that, I cannot access pi using ssh or remote desktop. And I cannot access the web page.</p><p>What to do? Please help me!</p>
<p>I had trouble installing web2py but I think I got it solved by using this script instead:</p><p><a href="http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh" rel="nofollow">web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh</a></p><p>and then running this at startup:</p><p>sudo uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log &amp;</p>
<p>Hello!</p><p>I have ssl problem :Hibak&oacute;d: ERR_SSL_PROTOCOL_ERROR. </p><p>I use Chrome and Explorer, the problem is in both. </p><p>I have no idea :-(</p>
<p>Nice Job!! </p><p>Very detailed guide.</p>
<p>where do you download the home lights package</p>
<p>Hi matey, i'm from Australia and i need this model for a demo. can you please let me know if it is possible for you to post me a working model (whole kit) and guide me to make it work.Please, respond to this message on my email &quot;rohitgoudponnam@gmail.com&quot; is my gmail id. </p><p>Thanks and Regards </p>
<p>Hi. </p><p>We already developed piece of hardware for home control. There are relays, digital inputs, 1wire, EEPROM, 0-10V.....</p><p>check indiegogo project:</p><p><a href="http://igg.me/at/unipi/x/8241961" rel="nofollow">http://igg.me/at/unipi/x/8241961</a></p>
<p>hy, </p><p>wen i write this in pi terminal :</p><p><em>sudo python /home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py</em></p><p>it show me:</p><p>python: can't open file '/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py':</p><p> [Errno 2] No such file or directory</p>
<p>that is a typo, delay there is 2 seconds :P</p>
<p>Awesome project! <br>I intend to use it to control a door buzzer, so I added 5 second delay. <br><br>I had to change swap the output from &quot;1&quot; to &quot;0&quot;, because I am using a brandless 8-relay board which operates as Active LOW (relays are turned on when output is &quot;0&quot;).<br></p><p>In the hope it is of help to anyone, this is what I did:<br></p><p>changed the GPIOClient.py file's line 13 to this: </p><p><em>ON = chr(0)<br></em><br>and added the following lines to the GPIOServer.py file</p><p>line 3: <br></p><p><em>import time</em><br></p><p>line 12: <br><br><em>SleepTimeL =2</em></p><p>line 23: (this is after <em>GPIO.output(pin,val)</em>)</p><p><em>time.sleep(SleepTimeL);</em></p>
<p>I use the raspberry pi from china (red color), what can?</p><p>Thanks</p>
<p>Hi,</p><p> we are interested in doing the home lighting automation which takes care of the central lighting system. so, could you please suggest how to proceed with the project.</p><p>email-id: nangunoorilaxmijoythi1@gmail.com</p><p>Regards.</p>
<p>Hi have it all setup and working as expected but is there any way to change the output for relays and not single button press applications ( using a relay that need to be powered constantly?</p>
<p>Traceback (most recent call last):</p><p> File &quot;/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py&quot;, line 29, in &lt;module&gt;</p><p> serversock.bind(ADDR)</p><p> File &quot;/usr/lib/python2.7/socket.py&quot;, line 224, in meth</p><p> return getattr(self._sock,name)(*args)</p><p>socket.error: [Errno 99] Cannot assign requested address</p><p>root@raspberrypi:~/RPi.GPIO-0.4.2a# </p><p>//What should I do with this error??Please Help..:)</p>
<p>cool introduction!</p>
<p>Hey - does anyone managed to adopt this web interface to work with 8 channel relay?</p><p>I wired it but on relay all i get is just a blink of LED i try to edit the settings - same result...</p><p>Please help </p>
<p>i think in your case the input voltage is not<em> enough for the relay board so double check your input volt.<br></em></p>
<p>Sweeet!! Everything works except i have to be at home connected to my wi-fi for it to work. is that supposed to be that way?</p>
<p>I have a question.</p><p>If i want to automate lights or AC, should this device be controllable via a remote controller in the first place or it's possible to do it with any hardware.</p>
<p>i have a problem in setting up the web2py setup. when i type sudo ./setup-web2py-ubuntu.sh it has and error and it says cannot find file destination though i have downloaded the setup file. and i cant update my raspi it also has an error. is it because i have a dynamic internet connection??pls reply i need your help..thanks</p>
When I connect up the wires, it acts as if the button is being held down, and so it can't define which button is being pressed when multiple buttons are connected. <br> <br>Long story short no matter if I turn them on or off, it doesn't make a difference! <br> <br>Help would be so appreciated! <br>Thanks, <br>Hugh
Awesome tutorial and project! Can't wait to fully try it out. I'm having one issue though. I don't have all of the proper hardware yet (I have everything but the remote outlets and a cut ribbon cable). But my problem is once I try to start the GPIOServer.py, it indefinitely says &quot;waiting for connection...&quot;. Is this because I have nothing connected to the GPIO pins? I was hoping to run out later and get everything else I need, but I figured I would set everything software-related up first. I'm hoping this is the issue, and not the fact that my pi hates me, haha. <br> <br>Anyways, thanks in advance for the response and, again, awesome instructable. <br> <br>- Chronos
sorry man email is a.nolan@pss.ie <br> <br>Regards
Hi I am very interested in your project its brilliant. I am new to computers and have very little understanding of electronics. Is there any chance of further instructions for this eg PCB board and what resistors you used if possible. further instructions diagrams etc. <br>Would be very helpful
hello, awesome instruction guide everything is working except for the pictures for the buttons. when i go to the webpage they never shown up. im talking about the power bottons plz help thx
sir,i need your help, can give me all detail about this project? code or anything about this..tq sir <br>s_roll88@yahoo.com

About This Instructable


648 favorites


More by willq44: Raspberry Pi GPIO home automation Raspberry Pi Case
Add instructable to: