User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Relay board with opto isolator connection

Sat Jun 11, 2016 10:20 am

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
Attachments
relay.jpg
relay.jpg (52.35 KiB) Viewed 4248 times
Last edited by faramon on Wed Jun 15, 2016 3:19 pm, edited 1 time in total.

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 2:34 pm

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?
Signature retired

Raspberry Paul
Posts: 86
Joined: Mon Jun 10, 2013 3:40 pm
Contact: Website

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 3:20 pm

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.
http://www.raspberrypaul.co.uk

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 3:26 pm

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
OptoRelayChannelData.jpg (57.79 KiB) Viewed 4247 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
relay1.jpg (53.24 KiB) Viewed 4247 times
Thanx,
Faramon
Last edited by faramon on Wed Jun 15, 2016 3:26 pm, edited 1 time in total.

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 5:00 pm

Use your first circuit, but increase the resistor to 10K. The opto-isolator input has a suitable resistor on board already.
Signature retired

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 5:47 pm

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
relay3.jpg (52.51 KiB) Viewed 4246 times
Thank you.
Faramon
Last edited by faramon on Wed Jun 15, 2016 3:30 pm, edited 2 times in total.

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Relay board with opto isolator connection

Sat Jun 11, 2016 6:10 pm

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

Return to “General discussion”