Wiring a Opto-Isolated Relay to Arduino

Hi, I was wondering if someone could help me interpret the instructions to wire up the following Opto-Isolated Relay (http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156)

NOTES: If you want complete optical isolation, connect "Vcc" to Arduino +5 volts but do NOT connect Arduino Ground. Remove the Vcc to JD-Vcc jumper. Connect a separate +5 supply to "JD-Vcc" and board Gnd. This will supply power to the transistor drivers and relay coils.

So I understand the first part I connect 5v to the device. The second part has me confused though. I have a 5V wallwart so I connect the +5 to JD-VCC does that mean I connect the neutral off the wallwart to board ground? Or do I just ground that pin to the case?

I'm just a beginner as you can tell so go easy on me if it's a silly question :slight_smile:

Thanks

If you want complete isolation, you will have seperate 5V supplies, one for the Arduino and one for the relay power.

Then you would connect an arduino output pin to the cathode of the drive LED, with VCC to a current limit resistor to that anode.

On the other side, you have pin 1 of the jumper field goes to the pin that goes to Pin 4 of the optoisolator.

If you only have 1 wallwart, leave the jumper in. Having an optoisolatar and the relay seems like overkill to me. Most applications just drive the transistor to drive the relay.

Thanks for the reply, I have two wall-warts but i'm still having a hard time following you. I quickly put this diagram to together to better help me understand (Don't laugh I only had paint).

Not sure what the optoisolated relay is can you give a link. What you drew is not what anyone was expecting.
You need a ground going from the arduino into that optoisolated relay, I am not sure I understand what the right hand connectors are, and where is the load you are trying to drive with the relay?
Is it a mechanical relay or a solid state one?

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156

Here is a bit more info too:
http://arduino-info.wikispaces.com/ArduinoPower

Thanks!

OK that is a rather unusual design you have it right apart from the 5V wall wart the positive output should be connected to the Vcc not the JD-Vcc

Mike,
Having the seperate 5V go to the JD-Vcc means the Opto-receiver and the Relay are totally isolated from the Arduino Vcc.
Overkill for sure, but the design provides for that.

Makes sense now, appreciate the help guys.

Having the seperate 5V go to the JD-Vcc means the Opto-receiver and the Relay are totally isolated from the Arduino Vcc.
Overkill for sure, but the design provides for that.

I'm just trying to understand this a bit better. Since I'm not tying the grounds together does that mean the second wall wart is acting like ground for the +5v coming from Arduino? Or is it grounding through the Input PINS? I updated the pic as the last one was a bit confusing.

CrossRoads:
If you want complete isolation, you will have seperate 5V supplies, one for the Arduino and one for the relay power.

Then you would connect an arduino output pin to the cathode of the drive LED, with VCC to a current limit resistor to that anode.

On the other side, you have pin 1 of the jumper field goes to the pin that goes to Pin 4 of the optoisolator.

If you only have 1 wallwart, leave the jumper in. Having an optoisolatar and the relay seems like overkill to me. Most applications just drive the transistor to drive the relay.

In my case I have a 3,3V Arduino Pro Mini (3,3V should be enough for logical signal if the coils are driven by 5V) and one 5v supply. Would the design be ok that I drive JD-VCC directly with the 5V of the supply and also the Arduino Pro Mini RAW? This way Grounds will be connected. I know optimum would be isolation of GND. But does it work? What can be the potential problems?

What are you switching with the relay? If mains voltage you need opto isolation, can you post a link to that relay module?

outsider:
What are you switching with the relay? If mains voltage you need opto isolation, can you post a link to that relay module?

It seems to be much the same like in the schema drawing of the OP: LINK

My setup: I have a 24V DC Power Supply driven by 230V AC. This 24V from this Supply I switch with the relays. I also drive with this 24V the 5V supply. With this 5V supply I drive the 3.3V Arduino pro mini through the RAW pin and the JD-VCC of the relay module.

This way the GNDs get connected, because the same 5V supply gives GND to Arduino and relay.

Thanks!

OK, here's that diagram again:

And the question: Do you need complete isolation? Probably not.

However, what isolation is concerned with, is segregating the currents that drive the relays, from the power supply to the Arduino. So you can use your buck converter module to power both. Note the diagram: You must have one pair of wires running from the output terminals of the buck converter to Gnd and JD-VCC on the relay module. When I say "pair", I mean the wires run together.

You now have a second pair of wires running from the same output terminals of the buck converter to Gnd and Vin/ "Raw" of your 3.3 V Arduino. That wire from VCC on the relay module travels together with the "IN" wires from the relay module back to the Arduino Vin pin. This means that you have a quite separate circuit from each part back to the output capacitor on the buck converter, minimising the tendency of impulse currents from one (actually, the relays) to affect the other.

So why a 3.3 V Arduino Pro Mini? Pro Mini itself is perfect, but 3.3 V an odd choice. You are clearly not saving power!

Note of course, that the 3.3 V Pro Mini outputs switch between 0 and 3.3 V, while the relay module VCC comes from 5 V. This is absolutely correct - the relay module has two LEDs in series on its input with a combined voltage drop of 2.6 V or so, so it may not reliably switch from 3.3 V alone and will certainly not conduct at the difference between the 3.3 V HIGH and 5 V, but when the outputs go LOW it will see the full 5 V and operate reliably.

OK, to help you follow this, here is the circuit of the relay board:
OptoRelayChannelData-800.jpg

Thank you. This sounds like I wanted to solve it!

Paul__B:
So why a 3.3 V Arduino Pro Mini? Pro Mini itself is perfect, but 3.3 V an odd choice. You are clearly not saving power!

Not because of power saving. I need to run a RF24 module which needs 3.3V.

Paul__B:
Note of course, that the 3.3 V Pro Mini outputs switch between 0 and 3.3 V, while the relay module VCC comes from 5 V. This is absolutely correct - the relay module has two LEDs in series on its input with a combined voltage drop of 2.6 V or so, so it may not reliably switch from 3.3 V alone and will certainly not conduct at the difference between the 3.3 V HIGH and 5 V, but when the outputs go LOW it will see the full 5 V and operate reliably.

Sorry. Perhaps my english is not good enough... I can not really conclude from what you are saying if it is a problem to use the 3.3V Arduino for logical input.

Paul__B:
while the relay module VCC comes from 5 V.

Oh, to this point: Do you mean relay module VCC or JD-VCC? My plan to set it up like in the schema you postet: VCC gets the Arduino 3.3V, JD-VCC gets the 5V from the buck converter.

CrossRoads:
, leave the jumper in. Having an optoisolatar and the relay seems like overkill to me. Most applications just drive the transistor to drive the relay.

Actually no, its not unknown for mains switching relays to generate enough interference to crash microcontrollers, the opto-isolation can be a real improvement in reliability.

timmorn:
Oh, to this point: Do you mean relay module VCC or JD-VCC? My plan to set it up like in the schema you postet: VCC gets the Arduino 3.3V, JD-VCC gets the 5V from the buck converter.

Please look at this drawings. It is not clear to me which version I should choose. Or does none of this versions work because of the 3.3V?

Neither is correct.

Please consider carefully and follow my explanation above.

Paul__B:
Neither is correct.

Please consider carefully and follow my explanation above.

Can you help me and tell me what in my drawings is not correct? The only difference I can find is, that you said GND and 5V should run from the buck converter to the relay. But because the same Buch converter Powers the Arduino and the relays, GND is at all interconnected and so it should make no difference in my eyes if GND comes from Arduino or directly from the Buck converter? Is there one more difference?

The second of my drawing is in my eyes the same as the one you shared. Only difference: 3.3V from arduino instead of 5V.

The first one gets 5V to the logical side of the relay. Here I would be afraid that the Arduino gets damaged when logical pins are low and get 5V through it.

timmorn:
The only difference I can find is, that you said GND and 5V should run from the buck converter to the relay.

That is indeed what I said. Directly from the buck converter to GND and JD-VCC on the relay board.

timmorn:
But because the same buck converter Powers the Arduino and the relays, GND is at all interconnected and so it should make no difference in my eyes if GND comes from Arduino or directly from the Buck converter? Is there one more difference?

Yes. It is this matter of isolation as MarkT mentions. Short of providing a separate power supply to the two parts as in the diagram I quoted, you want separate wiring from the one power supply - the buck converter in this case - to each separate part, and as I emphasised, to keep the wiring to each section paired.

This is the real "noob" mistake - presuming that it does not matter how the wires are run as long as they eventually connect one part to another.

Well, we are not dealing with house wiring (and in fact, it matters there too!) here but with electronics and especially electronics that operates at radio frequencies - in fact ten times the frequency of broadcast radio - it matters a lot as wires are now radio antennae to transmit or receive! :astonished: If you doubt that, just try holding your radio - on AM or FM - right next to your operating Arduino.

timmorn:
The second of my drawing is in my eyes the same as the one you shared. Only difference: 3.3V from Arduino instead of 5V.

So it is clearly wrong then on both scores. It shows the relay GND returned to the Arduino instead of the power supply (and it should be run in parallel with the JD-VCC connection), and it shows the relay VCC going to 3.3 V instead of the "Raw" pin.

timmorn:
The first one gets 5V to the logical side of the relay. Here I would be afraid that the Arduino gets damaged when logical pins are low and get 5V through it.

OK, you have it seems, read enough discussions here to be cautious about what voltages you connect to Arduino pins. That is excellent in itself but you will just have to read the last paragraph of my original explanation a few times in order to understand it.


OK, to help you, here is the circuit of the relay board: (Actually, let me attach that to my first post for convenience)
OptoRelayChannelData-800.jpg
You will note the two LEDs in series, which means that until the voltage between VCC and IN reaches 2.6 V or so, no current will flow so it could never pull the Arduino pin higher than 5 - 2.6 or 2.4 V, which is much less than 3.3 V.

Please have another go at getting the diagram right - it will then be useful for others.