With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
Tell us about yourself!
Raspberry Pi with 4 Relay Module ( for home automation )
it turns them on then off
the relay turns on but it doesn t seem to be turning off any suggestions?
When you try the test_relay.py file it only Turns On the relays ? Or in some other case it stays in the On position ?
Yes you can by setting port forwarding in your home router (googling port forward for more details)
no way to access the RPI by smartphone via network 4g starting work?
existe forma de aceder ao rpi por smartphone via rede 4g apartir do trabalho?
Hey, it is running now. I have changed the power supply from 5V to 3,3 V so that the output of the GPIO and the power supply have the same voltage. Then it is running.I will check now what circuit would be a good to add in advance to make it save running.Any advice? Thanks a lot, Mathias
I had to change the HW, now all is running. I had to add before the Relays an extra circut or I have to connect the relays to the 3,3V what might be at 8 LEDs too low and risky. So I used this circut:http://ras-pi.de/wp-content/uploads/2014/07/Relais...Thanks for all who support me.Mathias
I have changed your program to make better analyses as following:#STARTimport RPi.GPIO as GPIOimport timeGPIO.setmode(GPIO.BCM)pins = [26,16,4,21] GPIO.setup(pins, GPIO.OUT)print("GPIO.output:pin, GPIO.HIGH")for pin in pins : GPIO.output(pin, GPIO.HIGH) print(str(pin) + " set output") time.sleep(1)print("setting the GPIO to LOW or 0 or false for pin: " + str(pin)) GPIO.output(pin, GPIO.LOW) time.sleep(1)print("Checking if the current relay is running and printing it") if not GPIO.input(pin) : print("Pin "+str(pin)+" is working" )time.sleep(1) print("setting the GPIO to HIGH or 1: " + str(pin)) GPIO.output(pin, GPIO.HIGH) time.sleep(1)#cleaning all GPIO's print "Shutdown All relays in 2 second"time.sleep(2)GPIO.cleanup()print "Shutdown All relays"time.sleep(2)print "End"# ENDWhen I run this program on my Raspberry 3 at "GPIO.setup(pins, GPIO.OUT)" all 4 relays are turned on at once. Then nothing is happening in between even if they should change status from LOW to HIGH but no switching of Relays. The output for all pins is "Pin xx is working".At "GPIO.cleanup()" all Relays are turned off together at once.So as far as I understand the pins are correct because all LEDs are turned on correct. The time.sleep is working also.Any other ideas what can be the problem? Do I need to install any drivers or anything to make it correct running.Thanks a lot for your support!
Today I also tried to get the GPIO direclty controlled by console:export the GPIO:sudo echo 16 >/sys/class/gpio/exportChange the GPIO to OutPut:cd /sys/class/gpio/gpio16sudo nano direction(Change the value from "in" into "out" and save it)==> GPIO status is changing directly to active 3,3V and the LED turns on.Change the GPIO status by changing the Value:sudo nano value(Modify from "0" to "1" or from "1" to "0" an save the file)==> The stauts of the GPIO is not changing and the LED is constantly turned on. It is not possible to turn it off.
If I enter "GPIO.output(16, 1)" in the python console without any import or anything else before I get following error message:"name 'GPIO' is not defined"But in the program showed before it is running after the import command.
check from the python console if >> GPIO.output(pin, 1)>> GPIO.output(pin, 0)is working . Replace the pin with 17,15,14, or 18 .
Do you have any other ideas what I could do? It is really frustrating. :-(
Yes, it is seeping 1 second. So the program with all steps is running few seconds and at each step it gives new screen output. But during this the relais are not changing.Thanks a lot
So if that thing are working you are currently installed python GPIO library . Type in console : ~: python >> import time >> time.sleep(1) And tell me does the shell sleeps for 1 second or not ?
Yes, I get this message through all the pins, but they are not switched on and off correct.Turned on at initilisation (GPIO.setup(pins, GPIO.OUT))and turned off at the end (GPIO.cleanup())It looks like a driver problem. Maybe I have to install something before or have to do some one time settings in any config file.As I told you I have another Raspberry and on this one (Raspberry 2) all is working fine. But on the new one (Raspberry 3) it is suddenly not running any more.Any ideas from anybody? Thanks a lot to all the ideas and hints to try.
When you run the test_relay.py , what do you see on your console ? Does the program prints "Pin x is working" ?
Hi, I have been done this on my Raspberry 2B and it was running. Now I got a new Raspberrry 3 and after I get it running I also tried the test_relay.py.The correct Relais was turned all at once turned on at the beginning and at the end all together off again. I was not able to turn off and on single Relais.Do I need to install any drivers or other tools or what did I do wrong? I hope someone can help me. Thanks a lot!
Join 2 million + to receive instant DIY inspiration in your inbox.
Download our apps!
© 2016 Autodesk, Inc.