Go Down

Topic: Safely connecting a relay board to external power supply  (Read 11722 times) previous topic - next topic

Giddyup

Hi folks,

New here and I've spent the night researching pages and pages of this topic to help with me project, but I haven't found a straight answer...at least for my limited cranial skills.

I'm basically a noob when it comes to electronics, so don't assume I know anything. I'm looking for some help to safely connect up some hardware I recently purchased.

Project Context: we have some custom hardware, harnesses designed for a 4 lane slot car track. I've wired 4 tracks before with a basic power relay to cut all track power, but this project is much more advanced.

Project Details: We have a harness coming off our Arduino board that needs to be connected specifically to a 4 relay board (in the attached picture). The relay board will be controlled by an Arduino board via a race management software (RMS) system on our computer that will cut (individual lane) power to the track when a car runs out out of "fuel". Side note for more context, a full fuel tank is set to a certain number of laps - or less, if lap times are below a certain user defined threshold.

FYI - I have picture attached of what I'm going to outline - it does contains an error, on the terminal side where it says "closed", it should state "common".



We are using an Arduino board which is connected to (and powered by) our computer via USB cable. The Arduino board has 4 pairs of pigtails already connected to it, that correspond to certain lane numbers. We've tested each pigtail with a multi-meter noting that it puts out a 5v charge when the RMS triggers it (i.e., a signal to cut power). So that appears to address powering the relay board.

We have been instructed to connect each pigtail into IN1 (for lane 1), IN2 (for lane 2) and so forth. With the associated ground for each pigtail to be connected to the GND.

We are assuming we need/should jump the 4 grounds together and connect to GND - please advise if that's not appropriate.

On the terminal side of the relay board, we want to use the normally closed (NC) spots - as we want the track power circuit on when racing, until triggered - ie., a signal from the RMS via the Arduino cut to track lane power.

So I assume that a specific track lane positive wire connects to the corresponding NC with a specific track lane's negative wire connected to the common. Let me know if that's appropriate.

Hopefully, I'm on the right track. Where I really am at a loss is how to then connect up the track power supply to the relay board.

Our power supply is rated at 10A, 5-20 VDC. The track voltage will most likely be running between 9-10 DC volts for some context.

First question about the power supply, the board should be able to handle that ongoing 9-10 (DC) volts based on its specs to handle up to 30 VDC, I assume I'm correct here, right?

Second question, I need to connect both the positive and negative posts off the power supply to the relay board.

From what I've read and researched, I've read various articles that have conflicting statements. I read here: http://yourduino.com/sunshop2/index.php?l=product_detail&p=201
....that I should connect the positive from the power supply to JD-VCC and power supply negative to board GND. Confirming that in this post (http://forum.arduino.cc/index.php?topic=157144.0) I read "If you remove the jumper and wire an external +5vdc to the JDVcc pin and a ground pin somewhere then the relays will get there coil voltage from your external +5vdc voltage source." I assume the GND on the board...

In other articles and forum posts (eg., http://forum.arduino.cc/index.php?topic=131224.0) I've read that power supply negative goes to the GND with the positive going to VCC. Another post (http://forum.arduino.cc/index.php?topic=102978.0) I read said negative to VCC with positive to JD-VCC....but I believe that's if the board was taking power from the Arduino which I'm not planning....I think.

Which is why I'm here...dazed and confused - and wishing the fellow who made and sold me the custom gear would help guide me safely connect up. He won't because he doesn't want to be sued...which begs the question why he builds this stuff commercially....but that's a rant for another time.

I feel like I'm so close on this, but it's killing me but I don't want to experiment and damage the gear.

So please have a look at my crude picture, as you'll see everything I said above as well as my first assumption around wiring the power supply positive to VCC.

Many thanks in advance for any help!
Tom in Canada, eh

rogerClark

This is not a long answer to all your questions but...

Normally you only put the relay in series with part of the power feed.

i.e Switches are traditionally put in the positive wire to the load, but there is no reason not to put the relays in series with the negative wires instead of the positive wires.

However its unlikely you need to put relays in series with both the positive wires

Normally, if your PSU has red and black wires to the load (e.g. the track) you disconnect the red from the power supply and attach it to the relay

You then put a new red wire between the relay and the red terminal on the power supply.

I'd advise you DO NOT connect the Arduino Ground to your track supply PSU, there is no reason to do this, and its more likely to cause interference to the Arduino

These relay modules are normally double isolated. The inputs often use opto couplers to insulate the Arduino from the power to the relay coil, and the output contacts on a relay are always isolated from the coil contacts (as its one of the main reasons to use a relay)


I'm not sure if this answers all your questions, and you should probably wait for more responses before doing anything, in case there is special wiring required for slot car tracks, but I hope this general description helps



 
Freelance developer and IT consultant
www.rogerclark.net

Giddyup

Thank you sir, you are correct.

So, I went back and looked at how I wired up my existing track with my existing equipment:



I went through the relay (I used only normally closed also on my existing track), it looks like the ground (30) from the relay is connecting to the +'ve power supply. Which means the +'ve coming from the track power should connect to the normally closed (87a) - to ensure the power supply track power is flowing to the track, correct? Note, 87a goes to white pole on the driver station which is the positive. Refer to this to see this diagram for some context:



The other two relay pins (85 & 86) on the relay power the coil to activate the relay. And this is where I need some Arduino advice since the maker of my gear told me (and we have tested with a multi-meter) that our IN1 through IN4 harness connections will send a 5V signal to the relay board.....so, if I'm not mistaken, I wouldn't need to power my relay board separately then correct? As the power would flow through the harness with the 5v signals to trigger the relays via the harness connection to the GND and IN1-to-4. Right?

If that's correct, then I'm thinking the whole connection should look like this then..any thoughts?



Thanks in advance, eh!

KenF

The VCC is from your arduino NOT your external power supply.  The output pins from the arduino provide a signal that is relatvely LOW against this.

JD-VCC is where you put the power in from your external power supply.  GND is where you put the ground from your external power supply  (not the arduino).

I know it looks wrong because the GND pin and JD-VCC are so far apart, but that's the way they're put together.


Giddyup

The VCC is from your arduino NOT your external power supply.  The output pins from the arduino provide a signal that is relatvely LOW against this.

JD-VCC is where you put the power in from your external power supply.  GND is where you put the ground from your external power supply  (not the arduino).

I know it looks wrong because the GND pin and JD-VCC are so far apart, but that's the way they're put together.


Thanks Ken.  Not sure if you were replying when I posted the revised diagram, as I removed the VCC connection part. But thanks for addressing that question.

On a similar note, I've been told by someone who I tend to trust that the board does indeed require to be powered separately since we don't have a pigtail coming off the Arduino into VCC (and that we probably shouldn't as the Arduino probably couldn't handle it).

And thank you, as you are now the third person (two threads and you) who've said to wire the external power supply to JD-VCC and GND. So hoping no one is disagreeing with that (*fingers crossed*) Not that I don't trust you, it's just so much misinformation out there (or quite probably my inability to understand it).

Also, re: external power supply we've been advised to go with a constant 5 vdc 300mA, nor more than 1A power supply, so we don't damage the relay - does that sound right?

I think I found one here that will work - any thoughts? http://www.amazon.ca/Fosmon-100-240V-Power-Supply-Adapter/dp/B00HVLEZOI/ref=sr_1_2/180-7137917-2195415?ie=UTF8&qid=1417554862&sr=8-2&keywords=dc+5v+adapter

Thanks, eh!

Giddyup

A quick question, if we wire the the ground in from the external power supply to the GND on the relay board, and we wire the grounds in off the Arduino harness into the same GND - is that going to cause an issue?

I'm pretty sure I saw something about when isolating your Arduino and Relays that you shouldn't use a common ground....then again, I feel like down is up right now....

Any thoughts or concerns with using a common ground on the relay board for our situation here?

Thanks, eh!

KenF

A quick question, if we wire the the ground in from the external power supply to the GND on the relay board, and we wire the grounds in off the Arduino harness into the same GND - is that going to cause an issue?
Not necessarily but why take the risk?  The arduino ground should only be connected if you're using the arduino 5v to power the board.

The whole idea of the opto-issolators on the relay board is to ISSOLATE. 

terryking228

Hi Everyone,

Let's try to clear up something:

There are 3 "power supplies' involved here:

1. Arduino Board power supply.
  - May be from USB from a computer
  - Maybe be from an external supply of 7 to 20 volts connected to the Arduino External Power connector

2. Relay board +5 volts power supply.
  - May be from the Arduino Board 5V connections (Gnd connected to Arduino Gnd)
  - May be from a separate 5V power supply just for the relay board. (Needed IF you want real optical isolation between Arduino and Relay Board power). NOTE: The Vcc-JD jumper on the board must be removed if using isolated 5V relay power supply).

3. The application track power supply, which the relays will switch off on command.

See the schematic diagram of the relay board here:
http://yourduino.com/sunshop2/index.php?l=product_detail&p=201

 Each relay draws about .08A (80ma) from 5V Vcc so about 4 relays are the maximum you should run from the Arduino +5V supply.  (Running from USB it may be less) I would recommend a separate small 5V power supply in this application, both for the relay current for 4 relays and because optical isolation from the relay board and all those wires run to the track (which is a LONG wire, right?) means a lot of electrical noise is probably.

Oh: DISCLAIMER: Mentioning stuff from my own shop... which is what I know most about...

From the product page:
---------------------( COPY )---------------------
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.

If relay isolation is enough for your application, connect Arduino +5 and Gnd, and leave Vcc to JD-Vcc jumper in place.
-----------------( END COPY )----------------------
Also note that these relay boards are "Active Low", meaning that an Arduino signal that is Low or Zero will activate the relay. Why?? See the http://ArduinoInfo.Info site here:
http://arduino-info.wikispaces.com/ArduinoPower#4-8

Let us know how it goes... 
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Giddyup

Not necessarily but why take the risk?  The arduino ground should only be connected if you're using the arduino 5v to power the board.

The whole idea of the opto-issolators on the relay board is to ISSOLATE. 
I know, but I've got these 4 grounds from our custom harness pigtails (other sides go into IN1 etc) that our maker told us need to connect to the GND, yet you are correct there is no power coming from the Arduino to power the relay through VCC.

Giddyup

Thanks Terry, appreciate you weighing in here.  I've embedded some answers to your questions
Let's try to clear up something:

There are 3 "power supplies' involved here:

1. Arduino Board power supply.
.......Coming from USB from our computer

2. Relay board +5 volts power supply.
.........We will have a separate 5V power supply just for the relay board. And yes, we will remove the Vcc-JD jumper on the board to connect the +, with the - to the GND

3. The application track power supply, which the relays will switch off on command.

See the schematic diagram of the relay board here:
http://yourduino.com/sunshop2/index.php?l=product_detail&p=201

I would recommend a separate small 5V power supply in this application, both for the relay current for 4 relays and because optical isolation from the relay board and all those wires run to the track (which is a LONG wire, right?) means a lot of electrical noise is probably.

.......Maybe  we'll have some wire runs back to our driver stations around say 12-15' - not sure that's long?

If we have our harness pigtails grounds also connected into the same GND as our external power supply for our relay board, is there a risk yo thus common ground to the Arduino board potentially?

KenF

What I'd be inclined to do is cut down on the use of the relays by only switching the +ve side of the tracks.  That way you only need one relay per track (instead of 2).  So then you'll only need 2 relays.

This being the case, I'd then power the relay board from the arduino to keep it all simple.

Giddyup

What I'd be inclined to do is cut down on the use of the relays by only switching the +ve side of the tracks.  That way you only need one relay per track (instead of 2).  So then you'll only need 2 relays.

This being the case, I'd then power the relay board from the arduino to keep it all simple.
Thanks Ken, but we have 4 lanes, so that's 4 + feeds that need to be cut independently of one another?hence the 4 relays.

Looking back at your comment about isolation, my limited knowledge of opto-isolation is that you are basically isolating two power sources. If the Arduino is not supplying power to the relay board via VCC....then I'd assume there is no risk since it's just the 5v coming from the external power supply dedicate to the relay board?

Giddyup

Okay I think I've been able to make sense of most things. Someone please correct me if I'm wrong here....

Basically, "JD-VCC" is used when powering the relay board from an external (secondary) power source. "VCC" is used when powering the relay board from the Arduino.

There are different reasons for powering the relay board differently, but the main reason comes down to safety within the circuit you are making…if you can isolate the powering of the relay board from what powers the Arduino, you are basically creating a bit of a buffer to protect the Arduino board from things like power surges if the relays are attached to something with large surge currents, is at risk of shorting out, blowing up, getting hit by lightning, or is otherwise electrically noisy. The concept of isolating the power separately between the Arduino board and power relay from what I can tell is referred to as "optical isolation".

From what I have read, this isolation means that the Arduino board really only sends an optical signal to the relay (through the IN1 through IN4) to trigger the relays, with the relay board coil being by its external power supply to open the normally closed contact (in our particular case) - i.e., to cut power to the track. That's the reason for the second set of connections (JD-VCC) on the relay board -- to keep the Arduino isolated.

Still with me?

Looking at how to connect up power to the power relay board, if the power is not coming from Arduino (in my situation) it's the relay board's external  power supply (+) connecting to the on JD-VCC. The jumper for the JD-VCC needs to be removed; otherwise the jumper connects the JD-VCC and the VCC on the relay board (which would mean the power from the relay board's external power supply would be connected to the Arduino).  Then the relay board's external  power supply (-) connecting to the GND on the relay board. So, this connection JD-VCC and GND would then power the relay coils (posts 85 and 86 - see previous picture in above post as a reference) to open/close the normally closed connection of the track (+) power.

I also looked into using the relay board's VCC as a connect point in for the external (+) power source for the relay (normally used by the Arduino to power the relay); it appears that would be the same as connecting the relay board external power source to the JD-VCC (leaving the jumper on). In either case, for my particular situation because there is no power coming into the relay board from the Arduino board, there doesn't seem to be any difference and probably no risk to the Arduino since the only power (+) in this little connection (between the VCC and JD-VCC points) is coming from the relay board's external power source (i..e, no (+) coming in from Arduino). In any case here, connecting to JD-VCC, or VCC, the (-) off the relay board's external power source would go to GND.

Still with me….

So overall it looks like it wouldn't matter which of the 3 ways (connect to VCC, connect to JD-VCC jumper on OR jumper off) how we connect the relay board's external power source because it is the only (+) power coming into the relay board.

So I think the connection stuff seems to be addressed, however……… in our revised diagram below we will have 5 have ground wires all being wired into the relay board's GND.



I worried this would create "common ground" which could lead to "ground loop" issues. In our circuit we have grounds connecting back to the Arduino (from the harness connected to IN1-IN4) and back to the relay board's external 5v power supply. The signals being sent into the Arduino board are at 5v (recall we tested that with a multi-meter).

So I think we're okay because I don't believe there's any difference in their respective ground potentials? I'm worried there could be some "electronic noise" due to this ground loop which would interfere with our Arduino or relay board; especially worried as our signals from the Arduino are in a low range (5v) and I'm concerned that it wouldn't take much noise to create an issue and cause the gear to self-protect and do nothing.

Thoughts anyone on the risk with the "common grounds"? If so, what sort of ground loop protection would be recommended?

Thanks in advance, as always!

KenF

The negative wires from your track shouldn't come anywhere near your relay board.  As far as the track is concerned those relays are just switches and have no other connection to them.

Think of the relays as just a stand in for someone flicking a switch.  You don't need the neutral wire of your bedside lamp connected to the person flicking the switch.  The track only needs to be connected to the switch contacts of the relays.  And it's just the +ve side that's being switched so the -ve side doesn't belong here.


On the subject of VCC.  Consider a circuit consisting of 4 Light Emitting Diodes.  All of them have their anodes connected to VCC, their cathodes are all connected to their respective input pins.  This is exactly what you have on your board, but the Light emiitting diodes are buried within the opto-issolator chips.

The only use for the VCC connection is to power those LEDs.  On the relay board there is a track that directly connects the VCC on the long header to the other VCC pin (on that jumper).  This is purely to allow your VCC to power the relays as well. (not recommended)

To power the LEDs all you need to connect from your arduino is the VCC and the digital pins.

To power the relays and logic circuitry on the relay board, all you need to provide is GND and JD-VCC from your external power supply.

The tracks only need to have their +ve wires connected to the switch contacts on the relays.  So there's actually 3 totally issolated areas.

UNO connects to LEDS via VCC and digital pins. (nothing else)

External power supply connects to JD-VCC and Gnd (nothing else)

Tracks connect to switch contacts (nothing else)


Giddyup

The negative wires from your track shouldn't come anywhere near your relay board.  As far as the track is concerned those relays are just switches and have no other connection to them.

Think of the relays as just a stand in for someone flicking a switch.  You don't need the neutral wire of your bedside lamp connected to the person flicking the switch.  The track only needs to be connected to the switch contacts of the relays.  And it's just the +ve side that's being switched so the -ve side doesn't belong here.


On the subject of VCC.  Consider a circuit consisting of 4 Light Emitting Diodes.  All of them have their anodes connected to VCC, their cathodes are all connected to their respective input pins.  This is exactly what you have on your board, but the Light emiitting diodes are buried within the opto-issolator chips.

The only use for the VCC connection is to power those LEDs.  On the relay board there is a track that directly connects the VCC on the long header to the other VCC pin (on that jumper).  This is purely to allow your VCC to power the relays as well. (not recommended)

To power the LEDs all you need to connect from your arduino is the VCC and the digital pins.

To power the relays and logic circuitry on the relay board, all you need to provide is GND and JD-VCC from your external power supply.

The tracks only need to have their +ve wires connected to the switch contacts on the relays.  So there's actually 3 totally issolated areas.

UNO connects to LEDS via VCC and digital pins. (nothing else)

External power supply connects to JD-VCC and Gnd (nothing else)

Tracks connect to switch contacts (nothing else)


Got it, thanks. I believe my latest diagram reflects what you've said now.

The only question I really have left is the common grounds and the potential to create a ground loop issue?  Do you see any potential for this?

If so, I would "assume" I could either put in some ground protection, or just go and buy a new similarly rated 4 relay board that had 2 GNDs on it.

Thoughts?

Thanks dude!

Go Up