Go Down

Topic: how to choose a suitable relay? (Read 17570 times) previous topic - next topic

aetjansen

Hi All,

I have recently started with an Arduino starter kit. Now that I have done the experiments and played with the kit a bit, I want to make something more interesting.

I would like to make something I saw in a Make Magazine: Garduino, to measure and control an indoor garden. For that I would like to switch on and off growlights and a waterpump.

I understand what is needed and have set the thing up, but I do not konw what relays to pick to switch on and off the pump and lights. I know I have to switch on/off devices running from outlet power: 230v AC in Holland, while the arduino is able to output 5v DC, correct?

Anyone have any tips, tricks, resources for me on how to get the right relays?

Regards,
Arno

Grumpy_Mike

The trick is to get a relay with the right rating on the contacts. You just want on / off control so a single pole, single throw or single pole change over is what you want.
This in turn will determine how much current at 5V you need to drive the relay, the bigger the contacts the more current you need to switch the relay. So the trick is not to over specify the relay contacts, but don't under specify them either.

Also think about the coil voltage, do you want to use the 5V or is there a higher DC voltage you have available? Using more voltage on the coil means less current through it.

aetjansen

Thanks for the quick reply!

Now, I am a newby in this area, so I hope I did my homework correctly when answering to your reply:

If I look at this drawing of a relais:


The S1 and S2 are connections made to the ground and the arduino, right? For that I have the 5v that the Arduino can deliver.

Then the 2 wires that are on the powerchord of the lights, I would cut one of them and connect one side of the cut wire to the C (common) and one to the NO (Normally Open). Plug the chord into the poweroutlet, put the switch on the light itself in the ON position and trigger the relay to switch on and off the lights.

So, would that mean I am looking at the relay with coil voltage of max 5v DC and the C and NO contacts will have to be able to handle 230v AC (not sure how many Amps)?

On a website (conrad.nl, sorry in dutch), I saw a Sharp S202ES4 (sorry could not find a page in english describing this product) that switches 250V AC, and uses 6-12 V DC to control the switching. That would be good for this purpose then, right?
(product page here, in dutch: http://www1.conrad.nl/scripts/wgate/zcop_nl3/?~template=pcat_product_details_document&object_guid=DD0B7B3B5FF4615AE10000000A010220&master_guid=&master_typ=&no_brotkrumennavi=&ownrow=1&p_load_area=0214315&p_artikelbilder_mode=Ein&p_sortopt=object_description&page=1&p_catalog_max_results=20&cachedetail=#)

I am excited to make something "real" and useful, but the relais are a bit confusing to understand as there are so many different ones available...

Thanks for all the help so far! Great community!

brtech

yes, s1 and s2 are the relay coil.  You can connect s2 to ground, and s1 to an arduino pin (or the other way around, it doesn't matter), but only if the coil will activate with less than 40 ma.  Bigger relays need more current than the arduino can source.  You MUST put a diode across s1 and s2.  Search in the forums for the explanation.

You will only get 3-4 V out of your arduino output pins, so you need a relay that will operate that low.  A 6V relay won't.  Many relays advertised as 5V actually will (because they are intended to be used with digital electronics powered from 5V, but actually delivering 3.4 - 4.1v on their outputs), but don't forget the current rating.  Sometimes, you only get a coil resistance and voltage.  You can convert that to current using Ohm's Law, I = E/R, in this case Amps = Volts / Ohms.

The contact has to handle your load.  You may need to convert watts to amps, because the contacts are rated in amps.  Power (in watts) = EMF (in volts) times current (in amps), so I = P/E.  230 watts at 230 volts is 1 amp.  Make sure the contacts are rated for 230 volts.

It would be slightly safer for you to make sure that you cut the "hot" side of your power cord to your lights, allowing the "neutral' side to remain connected.  However, you did describe the connections correct.   Conventionally, the power source (plug side) would connect to the C, and the lamp side would connect to the NO, but it will work fine the other way.

With a lamp load, you might consider a 'solid state relay', rather than a mechanical relay.  It is easier to drive an SSR with an arduino than it is to drive a mechanical relay.  They are usually designed to be driven directly by the output pin, although some need a series resistor.

If you use an SSR, make sure you heat sink it appropriately.

aetjansen

Thanks brtech! Your explanation is great info to me! I think I understand what you said.

This relay (http://nl.mouser.com/ProductDetail/Omron-Electronics/G6CK-2114P-US-DC5/?qs=sGAEpiMZZMs8I5ltipPMAAOaFkZXfkhf) states is switches at 5V with 200mW. The coil section of the linked datasheet states 4mA at 5VDC.

So, this could be a good relay to use? And I do not think additional heatsinks are required, is that correct?

Regards,
Arno

Grumpy_Mike

#5
Jan 11, 2010, 07:47 pm Last Edit: Jan 11, 2010, 07:51 pm by Grumpy_Mike Reason: 1
Quote
states is switches at 5V with 200mW.

No it says 5V at 280mW consumption.
Volts times Amps = power in watts.
So this relay will take 56mA to power it. This is too much for the arduino to supply.

In the data sheet for coil data it says 5V at 40mA not 4mA. This is still too much for the arduino.
It is common for data sheets to contradict themselves.

However it is rare you will find a relay that can handle contacts with a good load and switch on so little current.
You have to boost the current of the arduino with a transistor. See:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html
the first part is about driving relays.
With a mechanical relay like this you do not need a heat sink. A solid state relay (SSR) has no moving parts and can be switched direct from the arduino but it is sensitive to the current it switches, too much will destroy it. You have to know how much current you want to switch.

aetjansen

thanks grumpy_mike, that was an interesting read. Bookmarked and I will do experiments this week I hope.

However, I pasted the wrong link by mistake, I meant this relay:
http://nl.mouser.com/ProductDetail/Omron-Electronics/G6D-1A-ASI-DC5/?qs=sGAEpiMZZMtSzCF3XBhmW1LHcIr8U6KtXdKIPZTIaSY%3d

that one states 200mW consumption and a 5VDC coil voltage, which means 40mA, correct? I believe I saw this one used elsewhere on an arduino project, but could not find the link.

Grumpy_Mike

Yes 40mA is still too much current. While people say that is the current limit the manufacturers say that is the absolute limit and sustained operation at that limit will cause damage. So you are better off using a transistor as well they are only a few pence.

aetjansen

I understand that the transistor is there to increase the current. However, due to my lack of knowledge, I do not understand why sustained operation would cause damage? Is it because of the current going through the coil that would damage the coil or something?

On a side note, elsewhere in the forum I found someone using this relay: http://www.crydom.com/en/Products/Catalog/s_1.pdf which takes a typical input current: 3.4 VDC, 20mA. This would be a bit more energy efficient I suppose?

Sean

Sustained operation of a relay that takes more than 40ma to power the coil will burn out the pin on the Arduino microprocessor, unless you use the transistor to supply the current. Arduino turns on the transistor that then uses its greater current carrying capacity to turn on the relay.

Grumpy_Mike

#10
Jan 12, 2010, 09:37 am Last Edit: Jan 12, 2010, 09:38 am by Grumpy_Mike Reason: 1
Quote
I do not understand why sustained operation would cause damage?

Simple because the chip manufacturers say so.

For things that could go wrong see the end of this page:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

Yes 20mA is better, but this is one of those solid state relays that we mentioned earlier.

aetjansen

ok, so all in all, ideally I would be looking at a non solid state relay (in order not to have the heatsinks) that can switch at 5VDC, around 40mA, with a transistor to do the switching in order not to have the arduino pin continuously running the relay (and by it running the risc of damaging).

Now, I have to do some math I guess to figure out what transistor to use and the resistor to use...

thanks all, learned a bit here and lots of interesting links! The learning process is fun :-)

PaulS

#12
Jan 12, 2010, 01:13 pm Last Edit: Jan 12, 2010, 01:13 pm by PaulS Reason: 1
Quote
The learning process is fun  :)


It sure is. :)
The art of getting good answers lies in asking good questions.

crlf

Quote
I understand that the transistor is there to increase the current. However, due to my lack of knowledge, I do not understand why sustained operation would cause damage? Is it because of the current going through the coil that would damage the coil or something?


View it as this: the transistor isn't there to increase the current, the transistor is there to separate the circuit that drives the coil from the arduino pin (although in most places you see people saying that a transistor amplifies the signal, in most cases you can think of it as two circuits sharing a ground). Without the transistor, the current passing through the coil is the same as the current passing through the pin circuits inside the arduino chip, which can only tolerate low currents.

Whatever the current specifications for the relay, use a transistor to separate it from the pin, it's safer and cheap (much cheaper than buying a new atmega after burning a pin).

aetjansen

Quote
View it as this: the transistor isn't there to increase the current, the transistor is there to separate the circuit that drives the coil from the arduino pin (although in most places you see people saying that a transistor amplifies the signal, in most cases you can think of it as two circuits sharing a ground). Without the transistor, the current passing through the coil is the same as the current passing through the pin circuits inside the arduino chip, which can only tolerate low currents.


Ah, that makes sense. You use the smaller currents from the Arduino to "open" the transistor, which in turn will switch on the relay...

So, I guess I am looking to get an Omron G6D-1A-ASI (5VDC version), with a 2N2222 transistor (datasheet) for each device I want to switch on/off (lights and a pump). I saw here that a recommended diode would be the 1N4004 (400V, 1A).

Each combo will set me back less than ? 5 (relay, transistor, diode), which makes this one of my cheapest hobby's :-)

Go Up