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>I'm confused. So What OS do I have to install to my Raspberry Pi that this will work?</p>
<p>You will need a debian based OS. So Rapsbian</p>
<p>I just do not see the wire connection for ALL on and off..?</p>
<p>Hi there, i also have a project which uses Raspberry for remote switch for light.</p><p>Please visit my blog for detail instruction</p><p>http://engineer2you.blogspot.com/2016/06/raspberry-pi-remote-light-switch.html</p>
<p>Is it possible to add button with 2 seconds delay for dimming? Should be easy.</p>
<p>Hi, Thanks for the great manual. I have a little problem, hope you can help me.</p><p>I am getting the following error message: &quot;RPi.GPIO.SetupException: This module can only be run on a Raspberry Pi!&quot; when trying to run: <em>sudo python /home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py</em></p><p><em>I have the latest raspberry pi, maybe it is not recognising it?</em></p><p><em>Thanks a lot!</em></p>
<p>Does anyone has error ticket problems when the button is pressed?i got &lt;class socket.error&gt;[Errno 111] connection refused.any idea where is the problem?</p>
<p>In your hardware setup. You need to do diagnostics on your own :(</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>check the name that you gave when you upload and install the packed application.</p>
<p>I am using a 433mhz transceiver. Put i can not get my script to execute from web page via php. My setup up is different from yours but you seem knowledgeable so i figured i'd ask. When i sudo ./my_light_on_script.sh from the terminal it works fine but not from the web page. I have chmod 775, 777 and finally +x, the script and page but still nothing.</p><p>Have you encountered this?</p><p>As stated above it executes successfully from terminal so i know every thing is hooked up correctly </p>
<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>
<p>you could use a service like weaved, </p><p><a href="http://www.weaved.com/" rel="nofollow">http://www.weaved.com/</a></p><p>this lets you use a software only interface and requires no setup on 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>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>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>

About This Instructable




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