Page 1 of 1
Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 10:20 am
by faramon
Hi to all Rpi masters,
I have one question. I have been using Raspberry Pi for a 3 months (Raspberry Pi 3) and I wanna connect it with Relay board (with two relays and opto isolator and VCC JDVCC jumper between). My relay board is on picture and my question is... Can i connect GPIO OUT like i do on picture because i do not know if is good for GPIO and Raspberry Pi to work on voltage difference, so i decided to connect like this on this picture down in attachment.
Is there a broblem with this connection?
My point is that i want to drive opto isolators diode with pure 5V.
Thanx,
Faramon
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 2:34 pm
by davidcoton
That circuit is correct IF the anode of the opto-isolator input is connected to 5V, and the cathode to IN1 via a resistor. If there is no resistor, you will need to supply one to avoid damaging the opto-isolator input.
The resistor to the transistor base should be higher, 10K or even 33K.
If the opto-isolator input is between IN1 and Ground, it will not work. In this case it would probably work with a connection through a 1K resistor from the GPIO.
Do you have a link to the specifications for the relay board?
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 3:20 pm
by Raspberry Paul
Is the transistor required anyway?
I have a similar relay board being driven directly from a Pi Zero GPIO. The relay board is driven from the 5v line on the pi.
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 3:26 pm
by faramon
Hi there,
thanx for reply, I found a some shema(and I realy think it is the one but because I bought the relayboard in China - eBay - it did not came with relay) .
ebay link to device is
http://www.ebay.com/itm/1pcs-5V-2-Chann ... 985229770?
and shema is this down in attachment.

- OptoRelayChannelData.jpg (57.79 KiB) Viewed 4246 times
Opto isolators cathode is connected through diode to IN0.
Is my sheme still correct or what is to be done here, but I dont want to replace or add nothing on the original relayboard?
My replace shema is here on another attachment.

- relay1.jpg (53.24 KiB) Viewed 4246 times
Thanx,
Faramon
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 5:00 pm
by davidcoton
Use your first circuit, but increase the resistor to 10K. The opto-isolator input has a suitable resistor on board already.
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 5:47 pm
by faramon
Thanx!
This is correct, opto isolator has its own 1 K resistor and I need to increase resistor between GPIO IN OUT (GPIO 24) and transistor base.
I think this answer will help many because the forums discussing this issue and I did not see that someone offered this answer.
The final circuit is here:

- relay3.jpg (52.51 KiB) Viewed 4245 times
Thank you.
Faramon
Re: Relay board with opto isolator connection
Posted: Sat Jun 11, 2016 6:10 pm
by faramon
I search tons of links and found a convenient link that may also be of help to someone:
http://vuelta-de-tuercas.blogspot.hr/20 ... art-1.html
Good luck to everyone.
Faramon