How do I connect a relay?

I am trying to learn how to use the Arduino and are trying to use my christmas lights blinking using the source of the Blink example.

The christmas lights runs on 12V så I thought i would put a Solid State Relay betwen the power and Arduino.

How should i connect my relay to the Arduino board? It needs minimum 3V to work.


Try to read this :

Hi, I don't think that relay will work for switching low voltage dc., you'll need a different style ssr for that.

+1 digger
You'll need a SSR for the specific DC voltage you're trying to control. If all you're controlling is +12V you can just use a transistor and turn it on and off with the arduino, provide an external +12V to the transistor tie the grounds together and you're done. If the transistor mentioned in the following article is not enough then a mechanical relay is your next cheaper step.

High current loads
http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

That circuit should work - BUT WATCH OUT FOR THE MAINS (240 volts) on your bread board !! DANGEROUS !! IF you are controlling a 240 voltsAC to 12 V transformer via your relay for your lights! . If you are controlling 12V DC you will need another type of relay as mentioned above.

Woah I didn't think of that having 240vac in there.

Don't breadboard the AC with the DC use another board, preferably a insulated terminal board. Or keep the arduino connections off the breadboard.

The SSR needs 3 -32 vdc and not much current 3.4ma at 5vdc so the arduino will do fine. DC ground goes to terminal 4 and the arduino digital output goes to terminal 3, you can pick any digital output. If you use the blinking led example you can watch the light blink when you power on the arduino.

http://www.crydom.com//userResources/productFamilies/24/crydom_S1.pdf

Believe it or not I have exactly that relay. You made me remember I had one.

First get that LED blinking. Make it blink!

Then remove the resistor and LED and replace it with the 3-32v control input of the SSR, be sure polarity is correct. Negative to ground and positive to the digital output.

I have an old clamp on lamp that IMHO sucks, the clamp is useless. So I cut the hot lead and stripped the two ends. Then I hooked one lead of the hot lead to the AC terminal on the SSR and the other lead went to the other terminal. Polarity does not matter.

I plugged the lamp into a socket and it merrily blinked a CCFL bulb.

OOPS!!!

It's bad to blink Mr. CCFL as he does not like this and I drove him to suicide!
AWWWWW Poor Mr CCFL died in the name of science!

But incandescents work just fine. :wink:

Earlier I managed to extend the Arduino's IO ports so that I have 16 extra minus the four control ports. In general I have 12 (though with some program trickery I can recover two of those four for other uses). With 16 SSRs I can have some fun with any AC powered device. :wink:

I just got excited reading this post. I have a similar project I am currently working on with the Arduino that requires a relay. I need a way to hard boot a PC. Would the above part work fine?

I found this on Mouser: http://www.components.omron.com/components/web/PDFLIB.nsf/0/08509325F0FDF7BE85257201007DD5BB/$file/G3TC_0607.pdf

Would any additional components need to be used to shut the power off for 10-15 seconds and then bring it back on?

I'm thinking of a relay as follows:

  1. Relay is normally on when Arduino does not apply 5V to the output pin.
  2. Arduino code sets the output pin high for 10-15 seconds to allow the system to completely shutdown.
  3. When finished the code sets the output pin to its normal low value to turn the PC back on.
  4. It accepts power on/off commands via Serial interface (I'll be using C# on the PC side for control).

Makes me wonder if I should just pull the PC case apart and just hook up the reset pins to Arduino to allow Arduino to just reset the damn thing.

I'm in the same game as TheKidd.

I use Director which can chat to Arduino via the serial xtra. My application needs to keep telling the Arduino that everything's ok so Arduino keeps the power coming. In the event of a software failure, Arduino will 'pull the plug' for a maybe 30secs then power everything back up. The Mac will think there's been a power cut and spring back into action. A minute or so later my application will start reassuring Arduino that all's well with the world and they'll continue their day happily together. :smiley:

All I need is a simple SSR circuit that will look after the power for the Mac.

In my reading so far there seems to be some potential issue about switching transformers... which I assume will include the Mac.

any experts in this field?

cheers

Beardy

Beardy, thanks for bringing up something I didn't even think about. Granted I was gonna go through the Arduino on the battery backup but forgot to think about what would happen if the UPS failed. Thanks for bringing that to my attention.

I guess keeping the system on normally whether through transformer or motherboard reset/power/sleep switch was always the idea. My main objective is to save the system from having to come home to turn it back on after a power outage.

I just ordered a few different transformers so I'll report how that goes either way.

hey

for the folks talking about running a DC load on an solid state relay- you have to check the specs to see if it will work.

The big SSR's are based on SCR's and triacs, which will just latch "ON" when they get DC.

There's a series of small industrial solid state relays that are easy to find. The generic name/number for 5V to DC output is "ODC5", meaning 5V in will control a DC load. Similarly, "OAC5" controls an AC load. these relays are ideal for small things like a 100W light bulb, or a solenoid running on 24V. They also make input modules called.. wait for it.... "IDC5" ( 5V DC input).

The advantage of all these modules is you get optical isolation between the Arduino and the load. This is an industry standard, and lots and lots of companies make them. You can get them new for about $10 a piece, or on ebay cheaper. Here's a few links:

OPTO brand ODC5

Same module from Allied Electronics

Grayhill brand ODC5 as sold by Digikey: about $9. This one can switch up to 60V DC at 3A from a single 5V input. No PWM, mind you!.

And here's a whole page describing some of the OPTO brand ODC/IDC modules.

These modules are a very good design solution where you have a few bucks to spend, need a lot of outputs, and want something reliable fast.

D

Is there any benefit to using these solid state relays over just wiring a diode into the circuit of a mechanical one?
They seem so much more expensive!

I am also wondering, if anyone would like to weigh in:
I'm about to order parts for a project in which I need to switch 120VAC to a 2A device, and 24VDC to a solenoid, in addition to a lot of relays to other low amperage devices. Is there any benefit to using small .5A relays for the low amperage devices and 12A relays for the 120VAC (all 5VDC coils), other than price, or should I just order all 12A relays if they cost the same?

thanks!

I'm NO expert - but you know that already, so I can't help with your questions.

Just to say that I understand the mechanical relays can bounce when the contacts close which can spike sensitive equipment and if you have a high current draw on them at switch on, the contacts take quite lot of electrical stress (arcing?) so tend to burn out prematurely.

That's all I've got. More expert information would be useful here too.

[m]

Can I Just directly connect the relay?

Can I Just directly connect the relay?

Directly connect it to what? The Arduino? The mains? What sort of relay?

You can sometimes connect a relay coil directly to an Arduino output pin, if the relay coil draws less than 40mA. You will still need a back-EMF protection diode.

What do I need to connect a relay to the arduino?

If it's a standard electromagnetic relay, you'll need a resistor, a transistor and a diode. There are several examples of this kind of circuit on the forums and in the Arduino playground.

So the thing next to the diode in the schematic is nothing to worry about?

The thing next to the diode in this schematic:

is the relay coil. It's a funny symbol, I must say, but that's what it is! The dotted line represents the magnetic connection to the switching contacts of the relay.

You will need to know, for your actual relay, which pins connect to the coil, and which pins (or terminals) connect to the switching contacts.

As a general point, I wonder if we should have a reference page somewhere that shows commonly-used component symbols, and explains them? Or do we already have one?

what is the relay + at the top and the relay - at the bottom