Mains control out of the box?

Just want to hang out with other Makers and chat about stuff? This is the place to do it.
Post Reply
User avatar
MikZ
Posts: 18
Joined: Thu Nov 03, 2011 1:57 pm

Mains control out of the box?

Post by MikZ » Fri Nov 04, 2011 2:33 am

G'day peeps,

I'm looking for an easy and safe way to do mains control. I know the principles; I'm just lazy. ;) Anybody know of a source in Australia for something like Sparkfun's inline power control board (premade or kit form) or something similar?

Cheers,
MikZ.

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia
Contact:

Re: Mains control out of the box?

Post by jonoxer » Fri Nov 04, 2011 2:44 am

Funny you should mention that. One of the switchboards in my house is fitted with DIN-rail mounted relays connected to an EtherTen, but with the interface built on a prototyping shield. For months now I've had a design sitting in Eagle ready to fabricate for a 16-channel relay driver board to do it properly, but I haven't got around to producing it yet. I'm having a third switchboard installed in the next couple of weeks so it's about time I got on with it though.

The board I've designed isn't a direct replacement for that Sparkfun module: it's the interface part, but the relays are mounted separately (on DIN rails in my case). I intend to also do a module similar to that one you linked to, but with a set of solid-state relays instead.
--
Jon

richii
Posts: 12
Joined: Tue Nov 01, 2011 10:31 am

Re: Mains control out of the box?

Post by richii » Fri Nov 04, 2011 4:24 am

jonoxer wrote:I intend to also do a module similar to that one you linked to, but with a set of solid-state relays instead.
Please do - it'll come in very handy for my project! Also do one that can take a PWM signal and drive a fader. :-)

LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

Re: Mains control out of the box?

Post by LukeW » Fri Nov 04, 2011 7:30 am

You can get a mains relay off the shelf pretty much anywhere. For example, the Jaycar SY-4042 is one that I think is nice that I've used a few times.

http://jaycar.com.au/productView.asp?ID ... rm=KEYWORD

You just have to bring in your mains active and load wires and crimp on a couple of spade terminals, plug it into the relay, get a couple more wires, crimp on a couple of spade terminals, plug in the coil voltage, and you're basically done.

In fact, if you use female spade terminals that have a complete insulation that covers the entire metal piece, then you've got the 240VAC completely insulated, it's not exposed anywhere, so it's very safe.

For comparison, if you stick a PCB-mount relay on a PCB along with a screw terminal, all the solder joints on the bottom of the PCB for the relay and screw terminal should be covered or protected.

Also, with a PCB like the little Sparkfun breakout board, you have to think about what the maximum acceptable current will be for the tracks on the PCB and for the screw-terminal connector, if you're going to be operating the system at the high end of the system up there towards 10A of load current.

The only disadvantage here is that you need your transistor and diode and resistor assembled on your Arduino proto-shield or whatever in order to switch the relay coil, and you'll need a power supply rail of +12V or so.

In this regard, using a power relay with a 5V coil is a very big advantage if your project only has a +5V supply rail.
The SparkFun relay board you mentioned, for example, uses a relay with a 5V coil.

I think that with a lot of electronics beginners, they encounter a big psychological hurdle the first time they ever get to a point in a project where they need a 240VAC switch but they don't want to wire up a 240VAC cable to a relay or whatever, because they don't believe that they can do it easily and safely and they won't die or burn their house... when in fact it's not that hard.

The hurdle of psychological resistance that keeps beginners kind of crippled sometimes because they don't think they are able to do any assembly of surface-mount components is similar.

SparkFun used to have a product in stock - I can't find it on their website right now - which had two cables with a 110VAC mains plug and socket all completely wired up and packaged, with a little black box in the middle with a LED and a two-pin screw terminal on it where you applied the 5V TTL input switch signal.

This was a good product, because it didn't require you to wire up the relay at all - even if wiring up the relay isn't that hard.

There is another option, which is to use a solid-state relay. Solid state relays come in DC type, which is basically just an optically-isolated gate driver for a high-current, high-voltage MOSFET, and the AC type, which is basically just an optically-isolated driver for a power triac.

Because a MOSFET can't switch AC and a triac can't switch DC, you need to have the right one chosen for the right type of load current.

The optocoupler input circuits in these kinds of devices typically draw very little current, and they typically work from a very wide voltage range, something like 3-25 V for many devices, at a current of something like 10 mA.

So you can just plug them straight into an Arduino, and you don't need a transistor low-side drive or anything like that.

You can just get a 240VAC solid-state relay and connect the two mains wires up and connect two wires to the Arduino and it really just works, so it's really easy to use. No transistor needed, no other components needed, no +5V rail needed.

There are a couple of small disadvantages to solid-state relays, though. One disadvantage is relatively high cost compared to conventional electromechanical relays, and another disadvantage is that it can be hard to get solid-state relays that will operate at high power. Say, for example, you're switching 10A at 240VAC. Very easy to find a conventional relay with an appropriate rating, but it's not so easy to get a solid-state relay. Even if you can get one, it will be relatively expensive and it will probably get a bit warm during operation, requiring either mounting on a heatsink or mounting on a chassis.
richii wrote:
jonoxer wrote:I intend to also do a module similar to that one you linked to, but with a set of solid-state relays instead.
Please do - it'll come in very handy for my project! Also do one that can take a PWM signal and drive a fader. :-)
That kind of mains control - like a light dimmer - is actually non-trivial to do, and it's quite different from normal PWM.

You need to detect the mains zero-crossing point (by interfacing the microcontroller to the 240VAC voltage waveform, basically, and then after each zero-crossing the microcontroller waits and measures out a certain amount of phase-angle before firing the triac at a certain point into the cycle.

User avatar
MikZ
Posts: 18
Joined: Thu Nov 03, 2011 1:57 pm

Re: Mains control out of the box?

Post by MikZ » Sat Nov 05, 2011 10:31 pm

Answering my own question: I just found a relay shield at Little Bird Electronics. It's currently sold out and doesn't solve all the problems Luke mentions, but it's probably a good solution for some people stumbling upon this post.

richii
Posts: 12
Joined: Tue Nov 01, 2011 10:31 am

Re: Mains control out of the box?

Post by richii » Mon Nov 07, 2011 2:01 am

LukeW wrote:
richii wrote:
jonoxer wrote:I intend to also do a module similar to that one you linked to, but with a set of solid-state relays instead.
Please do - it'll come in very handy for my project! Also do one that can take a PWM signal and drive a fader. :-)
That kind of mains control - like a light dimmer - is actually non-trivial to do, and it's quite different from normal PWM.

You need to detect the mains zero-crossing point (by interfacing the microcontroller to the 240VAC voltage waveform, basically, and then after each zero-crossing the microcontroller waits and measures out a certain amount of phase-angle before firing the triac at a certain point into the cycle.
Right - which is exactly why I'd love to find a pre-build module that I can just buy and plug in!

Post Reply