Remove these ads by
Signing UpStep 1: Parts
• Raspberry Pi
• Remote controlled outlets
• Ribbon cable
• Solder
(Not shown)
• PCB board
• Resisters
Tools
• Soldering gun
• Dremel/Hacksaw
• Screwdriver
• Wire cutters
• Wire striper
• Multimeter










































Visit Our Store »
Go Pro Today »




the only one problem i have is that i don't use wireless relè, but cable relè. 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.
How can i solve this problem?
many thanks
lorenzo
As I cannot reply, I always need to comment (a bug with instructables, reply does not work with Chrome or Firefox).
Anyway, I found out that I should not have the battery in the remote controller while it is connected to the Pi. Pi will not read button presses if battery with the controller is present. Apparently it messes up the voltages etc. If connect to the Pi without battery, Pi will read buttons pressed correctly. But I wonder how I will power 12v controller with the Pi?
Well, as Willq44 replied somewhere here, it might just be possible to just power the remote with Pi. So, what I did as an experiment, I soldered a 3.3V (pin 1) to plus side of the battery connector in the remote. That gave me first success, but signal to the remote controlled plug was bad and it barely worked.. well, lack of power, I guess. So I tried 5V from the Pi (pin 2) and it started working. I do not know how much range will it have, but it works across the room. And that is all I need at the moment..
Phew, this has been quite an adventure :) Back to world of electronics, tin and soldering :)
So just maybe, my problems are because of that. The pin states (or something) are a bit different.
At the moment, I have no idea how to fix it.. all help would be welcome.
I got an strange problem with my button! assuming that when you switch the button to on it stays on, but in my case it comes on for a second and then goes off again. this is a fresh install of the pi OS and everything needed for the project to work, so there isn’t anything clashing I guess. I am using pin 11 for the led, although when i set it to other pins it does the same. Anyone got any ideas? Thanks guys
wget http://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.4.2a.tar.gz
tar zxvf RPi.GPIO-0.4.2a.tar.gz
cd RPi.GPIO-0.4.2a
sudo python setup.py install
Then run the Server as before:
sudo python /home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py
One discrepancy I noticed while following along is that for the downloadable application was renamed from "Home_Lights" to "Lights". The change affects the following:
The application homepage is now found at:
https://raspberrypi/Lights
The GPIO server script is now started with:
sudo python /home/www-data/web2py/applications/Lights/modules/GPIOServer.py
The index file ( /home/www-data/web2py/applications/Lights/views/default/index.html ) needs to be modified to point to the new locations of the on/off images. For example:
_src="/Lights/static/images/off.jpg"
... RPi.GPIO.InvalidDirectionException
I have the same problem as kaveh80 - when I click on button I get the error listed below. I'm new to this and don't really know where to start looking, so would be grateful for any help.
pi@raspberrypi ~ $ sudo python /home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py
waiting for connection...
...connected from: ('127.0.0.1', 35556)
Traceback (most recent call last):
File "/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py", line 39, in
ret = gpio_setup(data[1:])
File "/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py", line 13, in gpio_setup
GPIO.setup(pin,dir)
File "/usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.2.0-py2.7.egg/RPi/GPIO/__init__.py", line 94, in setup
raise InvalidDirectionException
RPi.GPIO.InvalidDirectionException
Problem for me is that this won't be applicable to a stand-alone system as in my case internet access is unavailable :(
The stand alone system would:
- have a ras-pi would running LAMP server
- have a minimal PHP/MySQL based authentication system
- have the ras-pi be connected to a router via wired connection
- have a relay module connected to the ras-pi's GPIO
- allow access to wifi devices (phones/tablets/etc) connecting to router
- let users connected to protected WLAN, access the web server
- serve a main page where upon login, will let users control a relay module
While the LAMP and connection of router and relay module poses no huge issues, the little web app that would need to be to trigger the proper GPIO output is a bit more difficult as I PHP doesn't come functions capable to interface natively with a system's GPIO so will have to be researched and made ad-hoc with a little help from the community out there :) (as I've found no ready to user free/commercial app yet).
Needless to mention that any and all help/suggestions addressing such an alternate case (stand-alone) would be very welcome and much appreciated, thanks! :)
I followed your instruction and I am getting error every time I try to turn on / off any of the lights. any suggestion?
pi@raspberrypi ~ $ sudo python /home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py
waiting for connection...
...connected from: ('127.0.0.1', 54283)
Traceback (most recent call last):
File "/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py", line 39, in
ret = gpio_setup(data[1:])
File "/home/www-data/web2py/applications/Home_Lights/modules/GPIOServer.py", line 13, in gpio_setup
GPIO.setup(pin,dir)
File "/usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.2.0-py2.7.egg/RPi/GPIO/__init__.py", line 94, in setup
raise InvalidDirectionException
RPi.GPIO.InvalidDirectionException
very thanks and great work!
Something like a CMOS 4016 (http://www.doctronics.co.uk/4016.htm) should do the trick nicely at negligible cost - just wire it up to be powered by the 3.3v out from the Pi and connect the GPIO to the enable pins. The switch pins function similarly to a relay and even if you burn one out the rpi should be isolated from the problem and the remaining switched on the chip will continue to work
I can't upload pictures from where I am at the moment but I'll drop a sketch of how do put the chip in if people are interested
the version of RPi.GPIO stated to install is very out of date and in any case, any recent versions of the Pi's Raspbian OS already has the latest version installed, so that stage is not needed.
Hope this helps,
Texy
Thank you for your great and detailed tutorial.
I am trying to switch some relais. To do that i just need to put one gpio output high and low.
But unfortunately i dont know how i have to modify your code examples to do that (because you need inputs and outputs). Can you tell me what parts of your code i have to change to do that?
Thank you and goodbye
very good work.
I was trying to go the same following your manual... but I'm getting
[Errno 111] Connection refused when I try the app.
Any help?