0

I live in India and its very difficult to procure original electronic stuff here. Mostly I get some chinese made, not sure about quality.

So, I wanted to start a rPi project, to control my table lamp. From Google I found two types of relays.

Assuming if I use such cheap quality relays:

  • If I use electromagnetic relay, can it harm rPi?
  • If I use electromagnetic relay, can it harm the connected electronic appliance?
  • If I use solid state relay, can it harm rPi?
  • If I use solid state relay, can it harm the connected electronic appliance?

Any either of them can harm rPi or electronic appliance, how do I protect them?

Please assume that I am gonna circuit correctly. (and also can these device act as fail safe and even if I make mistake in my circuiting, can they protect rPi or electronic appliance?)

and lastly, what if I connect them all to an ungrounded power supply?

  • The RPi most likely will not be able to drive a relay on its own. You will need a transistor connected to the pi driving it. As such even if it isn't the cleanest electronic circuit, the Pi will be isolated. Relays can cause some transient behavior on the load side, on the switch movement, so consider it might close and open and close again when switching, but not higher voltages. A capacitor should mitigate that. – Marco Poli May 26 '14 at 3:40
  • A relay or a relay board? It's a bit like can I drive a motor or drive a motor driver board. You shouldn't connect a Pi gpio to a motor or a relay. You can (usually) safely connect a gpio to a relay board and a motor driver board, – joan May 26 '14 at 5:04
  • I meant a relay board. Something like this: ebay.in/itm/2-Channel-5V-Relay-Module-With-Optocoupler-/… – avi May 26 '14 at 16:40
  • you can also just use a remote controlled power outlet with the remote connected to the pi - so you don't need to worry about the power... – Gotschi May 27 '14 at 0:09
  • ^hard to get them in India. Either I end up with counterfeits or they are too costly :( – avi May 27 '14 at 13:23
1
If I use electromagnetic relay, can it harm rPi?

Yes.

As Marco Poli said, you will need some driver stage to control the relay. A simple (bipolar) transistor + base resistor or, alternatively, a single MOSFET may be sufficient.

What you must definitely include is a flyback diode, or your Pi will die.

If I use electromagnetic relay, can it harm the connected electronic appliance?

No.

If you use a regular mechanical switch now, a relay will be just as good.

If I use solid state relay, can it harm rPi?

Maybe.

I'd be careful especially with low-quality devices. Theoretically, they can't do any harm to the Pi.

If I use solid state relay, can it harm the connected electronic appliance?

Probably no.

I don't see how this could potentially be a problem for the appliance.

Remember that the Pi is a 3.3V device, plus it cannot deliver any significant current; not enough for any common electromagnetic relays. You'll need an additional driver (transistor or driver board) for most applications.

You may want to head over to ee @ stackexchange to find some sample circuits.

  • "What you must definitely include is a flyback diode, or your Pi will die. Maybe you'll need another resistor or two to limit current surges through the inductor that could otherwise interfere with the Pi despite the flyback." RUBBISH I agree that the use of a flywheel diode is advisable to protect the b-c junction of the transistor. It is unlikely to damage anything else and adding resistors in undefined places is unlikely to help. elinux.org/RPi_GPIO_Interface_Circuits is an excellent collection of interface circuits. – Milliways May 26 '14 at 12:00
  • "It is unlikely to damage anything else" - not sure I can fully agree to this statement. "adding resistors in undefined places is unlikely to help" - Yes, definitely; obviously, I was formulating too sloppily. Yet, a small-valued resistor in the fly-back loop can help reduce EMI; if the relay doesn't need one anyway. – JimmyB May 26 '14 at 14:15
  • actually I meant relay board, something like this: ebay.in/itm/2-Channel-5V-Relay-Module-With-Optocoupler-/… does your answer still apply? – avi May 26 '14 at 16:42
  • The board you linked to seems fine; it has protection diodes in place plus optocouplers which should give maximum protection for your controller. – JimmyB Jun 2 '14 at 11:29
0

The relay board you linked to says it is suitable for the raspberry pi.

The optocoupler means your raspberry pi is just being used to turn on an LED.

The light from the LED switches a phototransistor which then controls the relay.

The only problem I'd expect with a board like that is if the 3.3V drive isn't enough for a 5V input. But this board looks like it's inputs are 3.3V compatible. Probably the 5V is referring to the relay coils. You should take that 5V from a separate supply - not the 5V GPIO pin as it may cause spikes on your power rail.

  • have any diagram for circuit connections? that would be great! – avi May 27 '14 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.