HiAngelus88 wrote:Hello everybody. I'm looking for a way to connect the raspberry pi to some sort of relay to switch off/on my home lights. I know there are plenty of tutorials out there but my problem is I know about nothing of electronic, my bad.
I wanted to buy a relay like this:
I wanted to ask you two things:
1) How can I phisically connect the raspberry to the relay? And I mean, which kind of cables should I use? Is there a noob-proof tutorial somewhere?
2) What kind of devices can I connect to the relay? I mean... is there some kind of power-consumption limit?
Thanks a lot guys
Yeah, this is what I was wondering but I found some videos, like this one, where the raspberry is directly connected to the relay.Pieter-Jan5000 wrote:The gpio pins of the raspberry pi are probably too limited in current to drive a relay directly. Use a line driver like the uln2003a to overcome this problem. Then you can also fix the problem of the voltage by feeding the line driver with 5V
Probably not - you would need to check the specs of the relay interface board, but whilst the relays need a 5v supply, the accompanying circuitry built into the relay board will most likely work with a 3.3v input signal.so it doesn't matter if the relay is 5v and the gpio pin is 3,3v?
That is correct if you are trying to switch a relay directly from the GPIO, but if using a relay interface board as shown in the photos then there is already circuitry to switch the relays on/off using a logic level signal.The gpio pins of the raspberry pi are probably too limited in current to drive a relay directly.
I don't believe it is. The 8-channel relay board shown has opto-isolators driving the relay coils, so the GPIO pin is only having to sink current through a pair of LEDs.Angelus88 wrote:Pieter-Jan5000 wrote:Yeah, this is what I was wondering but I found some videos, like this one, where the raspberry is directly connected to the relay.
Thanks for the informations. I found that link from Sainsmart too but as you can see the raspberry is connected to that sort of pcb and then the pcb is connected to the relay while in the video, as you say, is directly connected. Anyway, I've already ordered the relay board so I'll let you know if it works directly connected Thanks a lot guys!Mortimer wrote:
I don't believe it is. The 8-channel relay board shown has opto-isolators driving the relay coils, so the GPIO pin is only having to sink current through a pair of LEDs.
However from Sainsmarts own website there is a link on how to interface the Raspberry Pi to their 8-channel relay board:
http://www.sainsmart.com/arduino-compat ... logic.html
Here is the link itself:
https://github.com/fixedd/RPi_SainSmart ... ace#readme
However that video , along with many others, seems to suggest that the Raspberry Pi can work directly connected to the relay board.
Yes, I found this device too but I'm from Italy so I don't think it's gonna workSarge wrote:You could use a Power Tail Switch.
Maybe pricier than the relays but works fine with the Pi's GPIO.
Great, thanks a lot again I knew I could count on you guysPieter-Jan5000 wrote:Ok sorry. I didn't take a good look at the board. With a board that has opto couplers on it, the need for a line driver is obsolete. It also offers better protection for the indutive load of the relay. Good luck.
Well, this relay board should work! If you read the description, it is written that the board can manage 10A (max 250V AC or max 30V DC) for each relay. Anyway, what do you want to do?ruffinmedia wrote:I'm looking to do a similar thing however I need to be able to cut the connection on and off for 240 voltage cable.
That's a good question. Don't know why. I remember I was following a tutorial over the Internet and that tutorial said to use the 3v3 pin. I wondered the same thing as you did but as you can see in the description of this board, it says that the voltage to control the board is between 3 and 15v so I thought it would have worked and so it didtalkeasy wrote:Hi Angelus88
Can you explain why you connected the relay to the 3.5v pin not the 5v one? The relay spec says 5v.
Like to try this myself!
Pete I really appreciate your security advices and warnings.peewee2 wrote:a wee safety observation.
Electric shock kill, many years ago when I was an apprentice my boss caught me doing something potentially dangerous, a year later he died from an electric shock whilst working in his loft.
The questioner asked can he/she use this relay gizmo & a pi to control the lights (plural). The first question to ask is - do you mean fixed, mains powered house lights?
Exactly how do you use a single relay board to control house lights?
The practical answer is you can't, not unless you are going to run 1.5mm twin and earth cable all around the house, using a relay board to switch mains is potentially dangerous, the relay board needs to be in a suitable box securely fixed in a safe location, the cabling needs to be safely routed....
The only safe way to control lights is to use approved kit - such as the wireless light switches sold under the Home Easy brand.
Can you explain bit more why did you use transistor?dugongmoladive wrote:Hello,
I'm using Fotek SSR to do the trick. They come in several different flavor. Do check your power requirement before getting one.
Although the datasheet says it accepts 3-32VDC on the input pins, my rev 2 board doesn't have enough juice to power it directly from the GPIO (maybe not enough power on the PSU). So I end up creating an open collector circuit with NPN transistor with 5v from the power rail on the collector side. You can also use MOSFET to do this, but NPN BC547 is what I have lying around. With 5v on the SSR's input side, it works like a charm.
This SSR is pretty cheap, around 10 bucks each. So google around if you decide to buy one.
Just make sure you double/triple check all the connections before you test it with life AC current.
You can say that again. Why would anyone use RED for GND and BLACK for Vcc unless they're planning to break things? Didn't watch beyond the first minute because of that.