Power supply connector for relay?


11 posts
by Schorschi » Thu Feb 28, 2013 5:46 am
This maybe a simplistic question, but if you need to power a component that has a 2 pin style connection, i.e. 1 pin for power and 1 pin for ground, say what a typical relay would have, where can you find a connector to go from a typical 5v powersupply connector to 2 pin connector? Or a power supply that has pin compatible termination? Or is the answer just to cut the connector off and crimp single pin connectors? Such a rash trick... seems rude if not lacking in graceful implementation.
5v-to-pin.png
5v-to-pin.png (63.51 KiB) Viewed 665 times
Posts: 121
Joined: Thu Nov 22, 2012 9:38 pm
by aTao » Thu Feb 28, 2013 6:36 am
Option b for sure.
Schorschi wrote: Or is the answer just to cut the connector off and crimp single pin connectors? Such a rash trick... seems rude if not lacking in graceful implementation.

It is by no means rude or lacking in grace, it is customisation.
I once worked on a project that was installing and wiring 80 bays of equipment, the room was gutted floor to ceiling then re-built. Of all the facilities and equipment that we installed only the floor and the ceiling werent modified in some way.
>)))'><'(((<
User avatar
Posts: 439
Joined: Wed Dec 12, 2012 10:41 am
Location: Swine Town UK
by pjc123 » Thu Feb 28, 2013 12:10 pm
The easiest way to do this is to cut off the dc connector and solder some female breadboard connector wires to the cable. I am talking about these:

http://www.adafruit.com/products/266

Or, if you want to be able to remove the plug, then you need to get the matching receptacle, and wire it to the breadboard connector wires. To do this, first you need to find out what type of connector you have (They have letter codes). I don't know where you are located, but here in the US, Radio Shack will match up your plug for you and tell you what it is.

Here are the different types of dc connectors:
http://support.radioshack.com/support_t ... gde-2H.htm

Once you determine the connector letter code, you can order the associated receptacle. I just ordered both parts yesterday for a chassis application, and in my case they were "M" code parts. Here is an example of what I ordered to show you pictures of what I mean:

Here is the plug:
http://www.mouser.com/ProductDetail/Swi ... wcs5v6U%3d

Here is the receptacle:
http://www.mouser.com/ProductDetail/Swi ... 2btWt8nzuo
Posts: 910
Joined: Thu Mar 29, 2012 3:37 pm
by pksato » Thu Feb 28, 2013 12:36 pm
WARNING:
This header is not for power supply.
Its a jumper to set JD-VCC as VCC.
External power must be connect between GND (on input header) and JD-VCC. Or direct soldered to appropriate points.
Some similar module have a 3 pin header to select/input relays power source.

See this recent discussion about same relay module.
viewtopic.php?f=63&t=35155
Posts: 115
Joined: Fri Aug 03, 2012 5:25 pm
by pjc123 » Thu Feb 28, 2013 12:55 pm
That is the problem with these boards....there are several variations with little differences here and there.
Posts: 910
Joined: Thu Mar 29, 2012 3:37 pm
by Schorschi » Fri Mar 01, 2013 4:33 am
What I believe I need is illustrated in the diagram below. Oh, the relay I am using is a SainSmart 4-channel coil based not solid-state. The diagram below I believe is straight-forward and even a learning electronics beginner like me understands (cough).

rpiuln2003relay.jpg
rpiuln2003relay.jpg (34.73 KiB) Viewed 572 times


Although my project drives very low voltage on the far side of the relay/coil, and never have more than one relay tripped at time, only 5v load per channel no more. So I doubt I will have any EMF feedback issue, but I want to establish solid good habits that are best practice oriented, so if I ever do have a project that would drive higher voltage, or holding relays open for more than 1/8 of second, or multiple relays open the same time, etc., I am affirming good design.

Reading the referenced thread on how to protect the Pi, I think I understand how to use a ULN2003 or even a ULN2803 IC as well. But is there anything else I should take into account?
Posts: 121
Joined: Thu Nov 22, 2012 9:38 pm
by aTao » Fri Mar 01, 2013 9:58 am
Schorschi wrote:Although my project drives very low voltage on the far side of the relay/coil, and never have more than one relay tripped at time, only 5v load per channel no more. So I doubt I will have any EMF feedback issue, but I want to establish solid good habits that are best practice oriented, so if I ever do have a project that would drive higher voltage, or holding relays open for more than 1/8 of second, or multiple relays open the same time, etc., I am affirming good design.

Since you are providing power from the RPi to the LED side of the isolators on the board, each of which uses 20mA when on it would be better not to et 5V from the RPi GPIO connector. Sure it is good for this project where you only use one at a time, but many months/years down the line you might forget that restriction. Thats just "best practice" though.
I think though that you have not understood the EMF issue and the need for a protection diode. The load on the contact side of the relay is not significant here, it is the fact that you have a relay that is controlled by on/off (logic) electronics. The coil in the relay is, well, a coil, an inductance. Inductances will resist any change in the current flowing through them, when they are turned on they behave like a high resistance, when they are turned off they generate a voltage to oppose the current dropping, the faster you change the current, the higher the voltage. A logic signal changes very fast so high voltages are generated, just in the coil itself.

In simple terms:
A resistor opposes current flowing through it, generating a voltage to oppose that flow. The higher the resistance/ current, the higher the voltage
A capacitor opposes a change in voltage across it, providing a current. The higher the capacitance/rate of change of voltage, the higher the current.
An inductance opposes a change in current through it, generating a voltage. And, you guessed it, the higher the inductance/ rate of change in current through it, the higher the voltage.

pksato wrote:WARNING:
This header is not for power supply.
Its a jumper to set JD-VCC as VCC.
External power must be connect between GND (on input header) and JD-VCC. Or direct soldered to appropriate points.
Some similar module have a 3 pin header to select/input relays power source.

See this recent discussion about same relay module.
viewtopic.php?f=63&t=35155
[/quote]

This is completely wrong, the pins on your header are connected to VCC and JD-VCC so they are definitely suitable. In fact there isnt another connector for JD-VCC so either you use a jumper here or you use it as a power supply connector.
>)))'><'(((<
User avatar
Posts: 439
Joined: Wed Dec 12, 2012 10:41 am
Location: Swine Town UK
by Schorschi » Sat Mar 02, 2013 3:13 am
As a best practice? The ULN2003 or ULN2803 should protect the Pi (and per some is over kill at times). Is there any thing wrong with the diagram is I presented? (Which I highjacked from another thread on how to power a relay correctly, it was a rather complex discussion). As I noted before, I think I understand that power for the ULN IC is safe for the Pi, and I believe using the using VCC pin from Pi side (if you will) is only powering the control side of the relay(s) and the JD-VCC to power the coils. Thus, I have any evil impact firewalled, ah I think the better electronic term, isolated.
Posts: 121
Joined: Thu Nov 22, 2012 9:38 pm
by MorePiPlease » Tue Mar 05, 2013 2:41 am
Man I wish there was one thread for this module as it is all over the internet but not one simple howto is written with diagrams for the raspberry pi.

Here is what i am thinking of doing...
http://dl.dropbox.com/u/93105539/RPi_to ... Module.jpg

I would obviously remove the jumper but i don't have the photoshop skills to do it without retaking and redrawing hehe :D

Thoughts on this? I am only in fact planning on hooking up a single relay and using it to replace my thermostat.
Posts: 14
Joined: Mon Nov 05, 2012 1:59 pm
by MorePiPlease » Tue Mar 05, 2013 3:08 am
never mind going to rshack tomorrow grabbing ULN2003 and another power supply...i want isolation.
Posts: 14
Joined: Mon Nov 05, 2012 1:59 pm
by Schorschi » Tue Mar 05, 2013 5:18 am
Yes, that is what I decided as well. I had my project done, driving a 4 channel relay at 5v direct from the Pi, given that I have very short, 1/8th or 1/16th second relay open/close cycles, and never more than one channel active at a time, I doubt I would ever fry the Pi, but the more I read about coil based relays and how they can fail when they do fail, and not having a solid state relay, I suspected that some day some how I might fry the Pi, so ULN2803 on order with IC slockets (just because I can), and an extra 5v power supply to drive one side of the relay, and minimize power draw from the Pi. Of course, given this redesign, I isolate the Pi. Thanks to everyone that offered assistance and advice, especially aTao. The way aTao explained the issue really made the point for me. I should also mention pjc123 as well, for the insight on why and how.

I think the forum should consider answer points or something like that? I think it would be nice to award especially helpful advice. The VMware communities for example have a nice answer point model, that seems to work well.

Last I plan to very well document my project, not because I think I am all that great at basic electronics, I am not, but maybe just maybe what I learn(ed) will help someone learn faster, better, etc. After all, that was the goal of the Pi in the first place, right?!
Posts: 121
Joined: Thu Nov 22, 2012 9:38 pm