# Interfacing microcontroller and mains via a relay

I am thinking of starting a project where I will need to interface a microcontroller output and mains for a lighting system. My question is about relays. I have found this one. And I am wondering will it be ok to put 230v through the switch of the relay? Also what am I looking for in the data sheet to tell me what is the maximum voltage that the switch will take?

The relay is a good one for resistive loads like incandescent lamps. The AgSnO2 contacts can handle higher inrush currents than AgNi.
Note that all given currents refer to cos($\phi$) = 1, i.e. fully resistive loads. If you want to switch reactive loads like fluorescent lamps you're limited to a fraction of the given maximum current. You also want a safety margin for the inrush when switching a cold incandescent lamp when the voltage is maximum.
Your 10 A then become 1 A. Since a 60 W bulb draws 0.25 A at 230 V you should be able to switch up to 4 lamps with 1 relay.

edit
Forget I mentioned incandescent lamps. I was in the supermarket today and I needed a replacement bulb. While in the past there was an offer of at least 30 or 40 different incandescent bulbs in all sizes and shapes today they were all gone! Same variety in CFL (compact fluorescent), so that's no problem, but I didn't think the incandescent effectively would be gone before 1st January 2011.
Anyway, for your relay. Relays like the resistive load of an incandescent bulb much better that the reactive load of a (compact) fluorescent lamp. While in theory you should derate the relay further for the changed load, in practice CFLs are only 20% the power of incandescent lamps, so your load will remain within the limits set earlier: you should still be able to switch 4 CFLs with 1 relay.

• I feel compelled to reinforce the idea that incandescent lamps are NOT resistive loads from a relay standpoint. Given that this is the "accepted" answer, I feel like it shouldn't contain misinformation. Commented Dec 31, 2010 at 17:01
• Also, it's not my suggestion, I provided a reference for that factor, fwiw. I don't think an answer should be accepted on the basis that it tells you what you want to hear. Commented Dec 31, 2010 at 17:07
• @vicatcu: if incandescent lamps are not resistive, can you tell us whether they're capacitive or inductive? And what's their cos phi? My data says cos phi = 1. Commented Dec 31, 2010 at 17:11
• they fall into their own category - as described in the appnote I linked to my answer (cp.literature.agilent.com/litweb/pdf/5988-6917EN.pdf). While they are generally speaking "resistive", they have special temperature-based material properties that must be taken into account. Commented Dec 31, 2010 at 17:27
• @vicatcu: Exactly, inrush current, I'm not denying that. IMO the people at Agilent are overly cautious; they also recommend a series resistor for the bulb, don't they? Have you ever seen this in an actual installation? My point is that in my experience a factor 4-5 will do. And I take exception to your insinuation that I tell the OP what he wants to hear. Commented Dec 31, 2010 at 18:01

If you are in any doubt about dealing with mains power - don't do it.

• My main concern was with the relay it melting on me. And im going to mount a plug on a pendant so i can keep my eye on whats happening to it during testing.
– Dean
Commented Dec 29, 2010 at 20:16
• @Dean, use a fuse rated for your maximum load + ~10%. Commented Dec 29, 2010 at 22:47

If money is no object, then the first thing I go to is a solid state relay (SSR), instead of the mechanical switch variety. I've had to switch 120VAC with a DC control voltage many times in the past, and I've alwyas started with Crydom SSRs. SSRs make interfacing with AC voltage really, really simple. Crydom has several models that can switch 230VAC.

That said, everything I have used them in is for prototype and R&D automation. It would be interesting to hear how others here feel about it.

I've done this kind of thing before, and it worked fine. The relay you've chosen looks about right, and as long as your not switching a huge load it will be fine.

If your unsure about the load, then do a simple calculation, for example if your switching a 100w bulb on and off, then 100w divided by 230v = about 0.4 amps. The datasheet says that the relay is rated at 10A... so its way more than enough.

If your calculations are out, and things go wrong the worst that can happen is it burns out a cheap relay, or blows a fuse or MCB or something... it's not the end of the world.

• On the other hand, if you had 3 100W lightbulbs you should probably be using a relay rated for at least 13amps (Applying 10% derating, one 100W lightbulb should be good with about a 4A relay). Likewise you use conductors and breakers that are adequately rated to that load or you could have a fire hazard on your hands. I would also be cautious in suggesting that all relay failure modes are "safe," as that has a lot to do with the context in which it's used. Commented Dec 29, 2010 at 19:18
• @vicatcu - 400mA not 4A, the relay should be good for 3x100W. Commented Dec 29, 2010 at 22:13
• @Thomas, derating by a factor of 10%, I believe, means you should divide current by 0.1 (i.e. multiply by 10). I got 4A from 400mA * 10... Commented Dec 30, 2010 at 17:09
• @vicatcu, no, that is equivalent to derating by 90%. You should get around 400mA * 1.1 = 440mA for 10% extra (or you could derate the relay to 90%, to get 9A, either works.) Commented Dec 30, 2010 at 18:47