Pages: [1] 2 3 4   Go Down
Author Topic: How do I connect a relay?  (Read 59936 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


« Last Edit: December 03, 2007, 11:10:57 am by Norwegian_User » Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try to read this :

http://www.arduino.cc/playground/uploads/Learning/relays.pdf
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

+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

Logged

If it was designed by man it can be repaired by man.

Cornwall UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 04, 2007, 06:05:23 am by myozone » Logged

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

If it was designed by man it can be repaired by man.

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



« Last Edit: December 09, 2007, 09:06:21 am by mrmeval » Logged

If it was designed by man it can be repaired by man.

Dallas, TX
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
3) 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.
« Last Edit: April 15, 2008, 05:21:40 am by thekidd » Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Freediving, spearfishing, alt energy, motion control, christian
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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
Logged

Dallas, TX
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Full Member
***
Karma: 0
Posts: 227
Intransigent prototyper
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: April 25, 2008, 10:38:22 pm by Daniel2 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Freediving, spearfishing, alt energy, motion control, christian
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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]
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I Just directly connect the relay?
Logged

Bristol, UK
Offline Offline
Edison Member
*
Karma: 1
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2 3 4   Go Up
Jump to: