I am working toward using a 5v arduino to flip 110v devices, using this relay here -
I used a relay long ago to turn car stereo equipment on and off. I remember the loud "clack" it made, and the guy at the shop thought I might have hooked up the relay wrong. That said, it worked fine, until I totaled the car.
So, I suppose I am trying to figure out the correct way to use this particular relay. Does the coil provide enough resistance for my GPIO pins to never fry themselves or should I add more resistance?
Also I am currently controlling the relay using a 2N-3904 transistor to drag in 9v power. As a quick experiment, I ran my GPIO control straight to the relay coil and it flipped on and off great. Should I bother with the transistor at all?
Also I noticed that in using transistors with DC motors, most circuits add a cap and a diode to protect the rest of the circuit. Is that specific to DC motors, or should I provide similar protection when using this relay as well?
I am hoping to wire up some relays and control household devices, and a little scared of doing 110v work. I have in the past, but that was a younger, stupider me, and I shocked myself several times.
For starters, I will be using this relay here -
It says it will do up to 250v, 5A. But the pins are so tiny! Is this supposed to be safe or will it melt as it approaches that kind of power? What about my jumper wires that typically have 5-12v, or the breadboard I use them with?
Any suggestions on what I should do for connectors and wire, for the business end of this thing? What about keeping myself safe while wiring it up and testing? I know enough to keep it all unplugged until go time, but more pointers never hurt!
As I noted in the other thread where you posted this, be careful with mains voltage and don't jam that thing into a breadboard (or string it together with a bunch of clips for that matter).
Yes, using a 3904 to switch that is a fine idea. A diode across that collapsing relay coil is a really fine idea. Optoisolation is a fine idea, but you might be able to get away without it. A pin resistor and a pull down resistor on the 3904 base would be a fine idea.
If you aren't using a premade relay module (and even if you are) the thing to pay attention to is wires and traces carrying mains voltage- where they are and what they are doing.
Not sure that relay will operate effectively at 5V (is rated to 12V) they say it will.
If the GPIO is the Arduino, 5V/320ohms ~ 15mA, within the limits of 20mA.
I have got into the habit of always using a transistor to drive a relay.
You should always place a protection diode across a DC coil.
LarryD:
Not sure that relay will operate effectively at 5V (is rated to 12V) they say it will.
If the GPIO is the Arduino, 5V/320ohms ~ 15mA, within the limits of 20mA.
I have got into the habit of always using a transistor to drive a relay.
You should always place a protection diode across a DC coil.
to drag in 9v power
Don't know what you mean.
I meant that I added a 9v (battery for now, real supply later) to run the relay, via the transistor. The way I have it now, the + end of 9v is connected to the relay on one side, and a 2N3904 completes the connection to ground when activated. Make sense? Good idea or no?
If what you are saying is that you are powering the Arduino from one source and then using a transistor to switch power from a 9v battery to the relay coil, then yes, that is a fine idea.
Sorry, one i was trying to be the answerer and help that other fellow out with transistors, and two, I was trying to ask about relay specifics in terms of handling the coil and resistance, here I was trying to get high power recommendations for wire/connectors/safety.
Maybe i was a little bit nervous about this, and thanks for the help!
if your arduino is able to drive the relay, use the upper circuit which drives the relay directly.
if not, use the downer circuit which drives the relay with a NPN transistor (you can use whatever NPN transistors in this case)
I suggest you get a relay with coil voltage 5V or 4.5V, to omit the transistor (4.5V is more ideal, because arduino output is usually @ 4.3~4.4v when powered at 5v).
NC means Normally Closed, NO means Normally Open.
choose which one to use depends on your application.
if your relay has only switch pin, just connect one to your load another to ground.
the diode is to protect your arduino, there might be a flyback current from the coil.
mechanical relays do clicks, get a solid state relay if you really hate the click, but it's like 5 times the price.