Go Down

Topic: how to hookup this relay? (Read 49009 times) previous topic - next topic

aweber

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

Chagrin

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 or 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.

aweber

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

Chagrin

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?


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.

VanJ

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
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.

danger355

...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 :)

meerkats

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.. 

manor_royal

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  
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.

If this was a Civil Engineering forum would there be posts like "I need to build a bridge. Someone send me drawings."

dlloyd

#8
Jan 26, 2017, 02:51 pm Last Edit: Jan 26, 2017, 03:12 pm by dlloyd
Quote
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.

Quote
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.

mudmin

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.

aalexjacob

Thank you for the picture it really helps!

ksan0626

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?

elvon_blunden

#12
Mar 07, 2019, 10:59 am Last Edit: Mar 07, 2019, 11:01 am by elvon_blunden
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....




ksan0626

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  :)

elvon_blunden


Go Up