Computing stuff tied to the physical world

TRIAC trials

In Hardware on Jun 23, 2011 at 00:01

To start some tests with TRIAC control of 220V AC mains devices, I’ve built a trivial setup – based on the S216S02 TRIAC, which goes up to 16A and includes a built-in opto-isolator and zero-crossing detector. That last part makes it unfit for dimming (that requires phase-controlled switching) but it should be fine for turning lights and heaters on and off.

The circuit is very simple, but I really wanted to have something that wouldn’t expose me to 220V no matter how much I start goofing around. Here’s the basic idea:

Dsc 2556

There’s a small heatsink on the TRIAC, since the datasheet says that it’ll only go up to 2A without one.

Now just Splice, Solder, and Seal:

Dsc 2558

And voilá – nothing fancy:

Dsc 2557

Trivial stuff, I added a 220 Ω resistor in series with the LED, making it switch reliably on 3.3V, with under 10 mA current, i.e. fine for an ATmega.

The ends of the power wire are attached to a plug and a receptacle, respectively – making this an extension cord.

Baby steps, as I overcome my fear of the unknown, eh I mean 220V AC mains…

  1. What are the pros of triac to relay?

    • Solid state, no contacts to burn out. Faster/cleaner switching on (and off).

      In the case of the one JC has chosen, a zero crossing triac, the switch on will be extremely clean, the triac only turns on as the AC cycle crosses zero, which means there is no sudden current surge as would happen if you switched on 90 degrees into the cycle (peak voltage).

      Switching off is always clean. Once a Triac is turned on it will continue to conduct until its threshold level is no longer met. This is generally a few volts (if not lower), and happens 100 times a second (on 50hz cycle). Once this threshold is no longer met, the triac will switch off (assuming it isn’t still been held on by the switching signal).

  2. Generally, relays are big (which is not convenient when fitting them in wall sockets) and they’re noisy (they make a clicking sound when they are switched).

    Nice to see that you’re moving towards controlling appliances though! My little project ( has grinded to a halt a while ago, but since the summer vacation is about to start I will have some free time on my hands and they are itching to get back at it.

  3. Watch out! Your socket will still be live even when the Triac is off. You should have the splice in the Live line (brown wire) rather than the Neutral.

    PS. Your fear of 220V is a good thing!

  4. Is there a reason that the triac is in the neutral(blue) line rather than the live(brown)? Its feels like the earth colour coded tape would cause a fuss in the UK.

    • The power cord here isn’t polarized. But it also shows my ignorance: I thought brown would be “safe” (similar color to black) and blue the live wire. Now I know better. I’ll splice the blue wire from now on!

  5. I don’t know about UK plugs but here you can plug the plug in the socket in two ways, so there is no way to know what is the live wire or the neutral….

    • Yes, that’s why it’ll always be dangerous. That, btw, is an advantage of relays: a double-throw relay can totally isolate its load when open.

      I’ve got a contact-less voltage tester, which properly indicates that there is still an electric field above 90V, even with the TRIAC open – so that should provide me a reliable way to check things.

    • In the UK it is impossible to connect the plug round the wrong way. The plugs all have the 3rd earth pin and a fuse on the live wire.

      Sockets have protective shutters over the live and neutral which are pushed out of the way by the earth pin, so you couldn’t push a twin pin plug into a socket, even if you tried. Well, not without pushing a screwdriver into the earth pin to move the shutters so you can force a two pin Euro plug in (because you’ve not got an adapter to hand)… This is all theory, I’ve never done it. Honest. cough

      An Englishman, moi, in mainland Europe always looks at metal electrical item with only a 2 pin plug with a sense of fear and suspicion, and why a plug left laying on the floor in the UK will invariably end up causing rude words to be said (they always seems to end up with the pins pointing upwards). This might be why UK power sockets almost always have switches. It’s far safer for the foot stabbing plugs to remain in the sockets!

      More frightening pictures here:

  6. Maybe a silly question, but why can’t you put a triac in both the live and neutral and just connect the low voltage line together? That way you would isolate both the live and neutral…

    Also what LED are you referring to as there wasn’t one in the picture?

    • TRIACs always have a residual current, even when OFF (not much – 100 µA – but still).

      Ah yes, the LED is the IR LED inside the S216S02, used in its built-in opto-isolator. That’s what the low voltage turns on.

  7. I don’t think it is a good idea to switch both wires, live and neutral. Especially when the switch is integrated into the house installation. You never know, which loads use this particular neutral line (now or in future).

    Disconnecting the neutral line is dangerous, because when the live line is connected, there will be also 230V on the neutral side of the load. For instance a light bulb, that has its live line connected and it’s neutral line disconnected, will be off (there is no current), but on the thread will be 230V (since there is no voltage drop on the load).

    So JohnO is right, switch the live line (brown), not neutral.

    Switching both lines is okay, if there is a good reason for that and if the switched neutral line does not go back into the house installation.

  8. as I said before when connected to a plug you never know what is what because in the Netherlands you can plug the plug in two ways in the socket. Only one way your colors will be right if you turn the plug then the brown wire will be the live one. So if you want to be sure you have to switch both wires.

    • If the device that you want to switch on or off can be plugged in both ways, then I should not matter which line is switched. Otherwise there would always be a 50% chance that the setup is wrong, when you plug it into a switched wall socket.

      Anyway, the distinction between live and neutral line looses its importance after such a wall socket, when plugs can be plugged in both ways. And in this situation switching both lines is safe (but not much safer than just switching one line, unless the device is defective).

      My argument against switching the neutral line refers to situations where the distinction matters, especially in house installations.

  9. If you switch both lines, when “off” it is the same as unplugging the device from the socket completely. That seems safe enough. (except if you have a residual 100 uA current, but that is not a dangerous amount, 100 mA is dangerous).

  10. Something else that may be tricky: The small (red/black) control-wires are near the blue 230V line, what happens if the soldered-joint snaps and the live wire touches the red or black control-wire? May be better to isolate some more…

  11. “I really wanted to have something that wouldn’t expose me to 220V”

    The PCB used for the S216S02 solid state relay has (unused) solder pads between the control and power connections. Looking at the photo they reduce the creepage distance to two small gaps which appear to be less than 0.5mm each! EN 61347-1 Lamp controlgear – General and safety requirements requires a minimum of 2.5mm but it would be safer to completely remove the unused pads giving a creepage distance of more than 4mm. – better safe than sorry! Also, does the heat sink reduce the creepage distance?

Comments are closed.