Page 1 of 1

Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 1:02 pm
by georgekok97
I need help !
how can i control 4 solid state relays using my raspberry pi ???
how i connect the solid state relays with raspberry pi and how i control them via the ‘/sys’ filesystem ??

I mean how can i control them with commands like this :
Enable GPIO 17 access via the Kernel on path ‘/sys/class/gpio/’, and configure it as an output pin: -

echo "17" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio17/direction

View the current state of GPIO 17: -

cat /sys/class/gpio/gpio17/value

Set the state of GPIO 17 by writing “1″ for high (relay on) and “0″ for low (relay off): -

echo "1" > /sys/class/gpio/gpio17/value
echo "0" > /sys/class/gpio/gpio17/value

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 7:25 pm
by j0e
It's just as you say, but with some little considerations. You'll need to add "sudo" to each instruction you posted. If this doesn't work, you can first do "sudo -i" to be able to input commands as root, and then do the rest. Also, you might want to chmod the directory of the exported gpio folder, so you can access it from your program without doing too much work about the user permissions, but this is up to you.

So, in summary, this would be (I'll use GPIO 17 as well):

Code: Select all

sudo echo "17" > /sys/class/gpio/export
sudo chmod -R 777 /sys/class/gpio/gpio17
sudo echo "out" > /sys/class/gpio/gpio17/direction
The above will setup your GPIO 17 as an output. And, if this doesn't work, as I said before try the "sudo -i" alternative:

Code: Select all

sudo -i
echo "17" > /sys/class/gpio/export
chmod -R 777 /sys/class/gpio/gpio17
echo "out" > /sys/class/gpio/gpio17/direction
To control 4 of them, you would do the same for 4 different GPIO pins, and do as you posted to define "1" or "0" as their output value. Hope this points you in the right direction ^^

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 7:57 pm
by georgekok97
j0e wrote: To control 4 of them, you would do the same for 4 different GPIO pins, and do as you posted to define "1" or "0" as their output value. Hope this points you in the right direction ^^
And how exactly i connect the ssr with the raspberry pi ??
Image
which one of the two pins goes to pin 17 (for example) and the other where i connect it ???
Thank you a lot for your help !!!!

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 8:29 pm
by j0e
I have never used one of those relays, and also its difficult to tell without more information about what you want to connect, but as I can see over its datasheet "http://pdf1.alldatasheet.es/datasheet-p ... 505FB.html", you would connect it this way (by your own responsibility!!!):

pin1: Load (+)
pin2: Load (-)
pin3 (2 in your red mark): GPIO 17
pin4 (1 in your red mark): GND

As I understand it, pulling the GPIO 17 up and down will connect or disconnect the load, but I might be completely wrong (actually i'm a little confused as I thought that relays should normally have 5 pins), so if you don't have spare relays to burn them and have fun trying, I would suggest to wait for someone else to give you a more reliable answer.

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 8:58 pm
by georgekok97
i confrimed it by some pictures i found :
Image

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Wed Jun 19, 2013 10:16 pm
by j0e
Great! I'm glad it wasn't going to blow with my guess xD

Post back with feedback about how it worked ^^

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Thu Jun 20, 2013 8:29 am
by georgekok97
OK !!!!
I'm waiting for some SSRs from eBay , so I think in two weeks I will post here again !!!

Re: Help with controling 4 SSRs - H E L P !!!

Posted: Thu Jun 20, 2013 12:37 pm
by TechColab
I have some very similar SSRs which helpfully include an indicator LED. Wiring straight to the RPi as discussed above should work fine. Handy tip though: After connecting your mains load wires, I'd strongly recommend a bit of duct tape over those screw terminals. Just in case of accidental touching or dropping something on them.
You can see mine in this self-portrait http://www.raspberrypi.org/phpBB3/viewt ... 00#p356200