how to hookup this relay?

I got this: http://www.sainsmart.com/arduino-pro-mini.html, and it looks straightforward enough, but wanted some clarification on the proper connections I should make to my Arduino Uno to control it (I don't want to fry anything).

As you can see this relay-board has a jumper to choose "JD-VCC to VCC" or "VCC to GND" (I assume).

Then there are the connection pins: GND, IN1, IN2, and VCC.

Can someone help me out with an example connection to the Arduino side to control the two relays?

For bonus-points, it specifies that the two relays can each be driven with 15-20mA. If I want the two relays to work simultaneously, I think the 40mA available on the Arduino I/Os is enough to just connect both relay signals to one Arduino I/O pin?

Thanks in advance, AJ

The "JD-VCC" refers to a second power source. You can either connect a small, separate battery on JD-VCC and GND to power the coil [u]or[/u] you can link JD-VCC with the VCC from the Arduino (using the jumper) and connect the two GND to the Arduino as well. Using the latter method means you no longer have optical isolation. That's the reason for the second set of connections -- to keep the Arduino isolated.

Just to be clear, you would never jumper VCC with GND.

IN1 and IN2 connect to Arduino I/O pins; it's here that I believe the device needs 15-20ma to drive it. VCC and GND connect to 5V and GND on the Arduino, respectively. If you want optical isolation you would connect a second power supply to JD-VCC (+) and GND (-). If you don't want optical isolation you would jumper JD-VCC and VCC together and connect the GND together as well.

Thanks so much for the detailed reply!

To be clear, “optical isolation” is almost always desired, right? Do you know of a link for me to read the pros-and-cons of using the optical isolation versus not using it?

Thanks again!
-AJ

[quote author=AJ Weber link=topic=102978.msg772811#msg772811 date=1335368858]To be clear, "optical isolation" is almost always desired, right? Do you know of a link for me to read the pros-and-cons of using the optical isolation versus not using it?[/quote]

The con is the complexity -- the requirement for a second power supply. If you've got something attached to the relays that has large surge currents, is at risk of shorting out, blowing up, getting hit by lightning, or is otherwise electrically noisy then it's a good idea. If it's just a set of holiday lights then it's not very useful.

[quote author=AJ Weber link=msg=772728 date=1335362522]

For bonus-points, it specifies that the two relays can each be driven with 15-20mA. If I want the two relays to work simultaneously, I think the 40mA available on the Arduino I/Os is enough to just connect both relay signals to one Arduino I/O pin?

Thanks in advance, AJ [/quote] If you want to control both relays simultaneously, then you don't need to connect both (IN1 and IN2) to a single arduino pin, but rather connect just one relay input (IN1) to arduino pin, and connect both controlled devices to the one relay.

Chagrin: ...If you don't want optical isolation you would jumper JD-VCC and VCC together and connect the GND together as well.

I know this is an older thread, but could you clarify what you meant by the text highlighted above in red?

I'm new here and to Arduino's, and I'm working on a garage door automation project that I'm using this very relay board in.

It sounds to me like you mean to say the GND on the VCC/3-Pin header should also be connected to the GND (Arduino?)... along with the GND from the 4-Pin header that's already going to the Arduino.

Am I reading that right? Could you explain why (hope that doesn't sound too douchey, lol)?

Any help is greatly appreciated :)

i just want to share my personal experience.. i have an arduino uno and the 5v 8 module relay as well.. i'v been using an adoptor of 5v-2amp as power supply.. unfortunately my ATMEL chip was been damaged.. so i buy again a new arduino uno.. i removed the damaged ATMEL chip and placed the new ATMEL chip and its working.. so i conclude that the ATMEL chip really stops working.. i bought another 5v-2amp adoptor and dedicate this to power the relay.. so i have 2 power source 1 for arduino and 1 for the relay.. wire the GND-IN1-IN2-IN3-IN4-IN5-IN6-IN7-IN8-VCC through the respective pins of the arduino if you wish to use it all.. at the lower right of the relay remove the jumper in VCC JD-VCC... wire the GND to the NEGATIVE and JD-VCC to the POSITIVE of your 5V adoptor.. this will power the coil of the relays.. till now mine is still working good..

meerkats: so i have 2 power source 1 for arduino and 1 for the relay.. wire the [u]GND[/u]-IN1-IN2-IN3-IN4-IN5-IN6-IN7-IN8-VCC through the respective pins of the arduino if you wish to use it all

From what I read elsewhere, if you use the separate power source for the relay, JDD, you mustn't connect the relay board ground to the Arduino. If you do you compromise the isolation. It's not necessary for the control of the relay, since Vcc and a low/high i/o pin will control the opto's transistor.

Can someone help me out with an example connection to the Arduino side to control the two relays?

Opto Isolation Connections:

The higher the power rating of the load you’re controlling, the more desirable it is to use opto isolation. Also, contact arc suppression becomes more and more important. Using both arc suppression and opto isolation is the best solution for high loads. Here’s a good link to review.

For bonus-points, it specifies that the two relays can each be driven with 15-20mA. If I want the two relays to work simultaneously, I think the 40mA available on the Arduino I/Os is enough to just connect both relay signals to one Arduino I/O pin?

Its not good to go above 20mA on one Arduino pin as it degrades life expectancy of the output. If the actual current is <=10mA for one relay, then one output can be used to control 2 relays. Otherwise, if you have an unused pin available, I would just use that.

I know this is an old post, but having a picture helps SO MUCH. I read about a dozen forum posts before stumbling across this. THANK YOU.

Thank you for the picture it really helps!

Hi! I know this is an old post but...

I already removed the jumper between the VCC and JD-VCC pins and connected my 5V 1A adapter and IN1 pin to my Arduino Mega but it still doesn't work.

Mind giving me an advice?

ksan0626: I already removed the jumper between the VCC and JD-VCC pins and connected my 5V 1A adapter and IN1 pin to my Arduino Mega but it still doesn't work.

You need 4 connections, if you look at that pic in #8. (JD-Vcc and gnd from power supply; Vcc and in1 from Arduino). You only mentioned 2...

edit: or you may have accounted for 3 if "connected my 5V 1A adapter" means 5V and gnd. Still one wire short....

elvon_blunden: You need 4 connections, if you look at that pic in #8. (JD-Vcc and gnd from power supply; Vcc and in1 from Arduino). You only mentioned 2...

edit: or you may have accounted for 3 if "connected my 5V 1A adapter" means 5V and gnd. Still one wire short....

Oh, I got it! Thanks :)

ksan0626: Oh, I got it! Thanks :)

And remember it's active low....

To be really clear, as some of these posts wander... See note 4) if you are short of pins.

1) The signal only drives the (gallium arsenide?) LED in the opto coupler, not the coil. Through a resistor.

2) The coil must have 5V @ ~75mA

3) There may be a flyback diode on the coil as well.

4) If you do not have a pin for the 5V additional VCC, it is intended for you to use the jumper pin itself.

5) But take care not to tie two differing supply voltages together, as you would when programming from a USB to serial adapter (as for a pro mini).

6) Even though it is a coil, and should act as a choke, your decoupling capacitors may not be enough to filter out droop or spikes. As well as it picking up any local interference by acting as an antenna.

7) Opto-isolation protects the microprocessor and the signal in case of trauma or failure, especially in automotive applications. The trauma would have to be severe for the switched voltage to affect anything upstream, and in those extreme cases opto-isolation may not help. (Crowbar, earthquake, car wreck).

8) If the relay will not trip, and the output led is weak, check your pin is an OUTPUT pin, high in the DDR for that port. You may be able to get 3.3V as an input signal, but the coil still needs 5V, and this would be another case for 5V supply.

danger355: I know this is an older thread, but could you clarify what you meant by the text highlighted above in red?

I'm new here and to Arduino's, and I'm working on a garage door automation project that I'm using this very relay board in.

It sounds to me like you mean to say the GND on the VCC/3-Pin header should also be connected to the GND (Arduino?)... along with the GND from the 4-Pin header that's already going to the Arduino.

Am I reading that right? Could you explain why (hope that doesn't sound too douchey, lol)?

Any help is greatly appreciated :)

I think the two VCCs on arduino board are internally connected. It's the also the case with the two GNDs.

First thing, which Arduino? The Arduinos that work on 3.3 volts don't work well (or at all) with this type of relay module and none of them can supply enough current to power 2 relay coils (75 milliAmps each) at once.

Hi Folks,

Thanks for posting the picture diagram Dlloyd, it really helped. I have been successful actuating the relay but am having issues wiring up a LED to simply turn on and off. My setup looks very similar to this (see attached) with two modifications, running it off an Arduino Uno and wiring up the JDVcc and GND to a separate 5v power source.

LED is not illuminating at all, however the relay is actuating and making a click Any help would be greatly appreciated! Thanks.
-Mike

CaptureRelay.JPG

My setup looks very similar to this

How is your circuit dissimilar to the fuzzy picture, exactly?