AC Shield will take your breath (heart beat) away.

[Ryanjmclaughlin] came up with the idea of a Arduino shield that uses TRIACs to switch four channels of AC power. The forum thread he started delves into several interesting discussions covering what it would take to convert this for use with 240v power and of course, a debate about safety.

A reader named [Victor] sent this tip to us and mentioned that this shield might significantly reduce the number of Arduino related projects we see. That’s because mixing high voltage alternating current with delicate 5v logic circuitry can be a bad idea. We’re not saying the creator of this didn’t know what he’s doing, but if you don’t you could fry up your Arduino, or your body.

69 thoughts on “AC Shield will take your breath (heart beat) away.

  1. This “wuss” had many years in power control (240/415, to 100kW) including lots of live board work, and this project seriously sucks. There is nothing wrong with the *idea*, it’s done all the time, it’s the *implementation* that gives me the willies.

    Instructive redesign is a really good suggestion.

    Triac or relay? That depends entirely on the application.

    “I tried to go faster, but I quickly started frying relays.”
    Which is why frequently operated relay contacts are fitted with a CR snubber to minimise contact arcing, and you have to do something similar with triacs and SCR’s if the load is anything but purely resistive or they will stick on. The current and voltage *both* have to go below threshold before the triac will switch off.

    Edison’s marketing myth from his battle with Tesla resurfaces. Muscles effectively rectify by contracting whichever way the current is flowing. The primary determinant is what happens when you get the shock and your muscles contract – is your hand going to grip the conductor, or move away? So if you *must* touch, always test with the *back* of your hand (after using your trusty neon screwdriver). And yes, I have given myself a richly deserved black eye.

    Unless of course you are in a lightning-prone area where a 1930’s relay will outlive a dozen semicons; or you are switching a reactive load (when triacs will often stick on); or DC; or where a shorted triac could produce a dangerous situation; etc. Triacs and SCR’s are also prone to dv/dt firing. The failure modes of relays and triacs are different, but the difference in overall reliability isn’t as great as some seem to think.

    400V is not enough for a 240VAC supply – 1kV minimum.

    Okay, so this is for dimming. So where are the switching supression components? I have built light dimming racks for theater use and consider an earthed metal box for all the high voltage to be mandatory. Recycled computer power supply cases, available free from your local computer shop, are near ideal for this sort of project.

    A word about ELB/CBR/’safety switches'; if you are not well earthed and manage to touch both the active *and* neutral you are simply part of the load and will FRY. ELB’s also fail quietly and I’ve found more than a few that won’t trip at all. An ELB is not your main protection, that comes from good practice, the ELB is your last gasp reserve ‘chute and if that doesn’t open you’re toast.

    If OP is selling this I hope he understands that his liability insurance will not cover inherently unsafe design.

  2. LOl… you do realize that the common ac recepticle and light bulb socket base would likely be deemed deathly dangerous by todays UL world, especially if run by this crowd here ;-)

  3. @agent240:
    not likely, most definitely. the american plug makes contact before the contacts are out of user’s reach. the european plug is recessed so you can’t get your fingers near the hot pin. and at least with the 3-prong one not the pins but the plastic part carries the mechanical stress.
    but then again, 240V needs better insulation than 120V. in europe, you don’t see lamp sockets with paper insulation either.
    well, ok they might have them in italy, because your electrican’s cousin good them from a friend in the us…

  4. ok, a try on constructive criticism:
    1. xmas light switches. wait till after xmas, then get one of these xmas light outdoor switches on sale 50% off, the kind that turns the light on at dusk. with black electrical tape, tape a led over the light sensor and connect the led to your arduino: led on= 120v off, led off= 120v on.
    the good: safe and easy, no danger
    the bad: no dimming, not dangerous enough to get hack cred with 13yo (if that’s what you’re after)
    the ugly: for two ac outlets you also need two switchers -and of course an additional arduino for each led ;p

    2. some low voltage controlled ac-switch from surplus or the thrift store. examples: there are computer modules that switch 120v with a 5v dc hookup. i think hp made them, but i don’t know what for. i got one for a couple bucks. rf remote light switches: a few bucks a the thrift store. not x10 but the even cheaper ones where you glue a fake light-switch to the wall: at some the light switch needs new batteries and the thing ends up at the thrift store.
    good: safe
    bad: some customization required
    ugly: “that’s not a hack”-comments.

    3. your own triac controlled i-am-not-a-wuss controller. what everyone already said: fuse, metal box, opto isolator. in addition: get a metal gang box for electrical work in wet rooms, put a receptacle and a face plate on it, make it three prong, have the box grounded. dc from your arduino should come in through a separate port. also: the triac is not enough to turn this into a proper ac dimmer. don’t ask your uc friends about it, go to an old-school electrical website and find a decent ac dimmer with zero crossing detection and nice noise filters. your arduino won’t switch the dimmer directly, but the analog from the arduino (through an opto-coupler of course!) will replace the potentiometer in the conventional dimmer. the dc-voltage simply sets the on-off percentage for the dimmer, but the dimmer circuit does the switching. you might need a fet.
    good: noone will call you a wuss anymore.
    bad: your home insurance will likely deny coverage
    ugly: the other kids dancing around the fire

  5. Stupid thing! But at least now the Arduino fans will get the Darwin awards they deserve. Triac circuits connected to mains should be kept away from young children.

    And you’re not saying the creator of this didn’t know what he’s doing? You should. This board design breaks the basic principles of high voltage safety. Check any high voltage design manual, and you will see how you should respect isolation distances between low and high voltage parts of a circuit. This board absolutely does not.

  6. Just a note about shock hazards. I follow the rule of one hand kept in pocket when working with live voltages present, helps to keep you from completing a circuit. The other thing is that most people killed by getting shocked were not killed by the electricity itself, but by their reaction. You are standing on a ladder changing a light bulb and the switch is still on, you get shocked, what is your reaction ? To jerk your hand back, losing balance you fall off the ladder and break a bone or worse. Happens all the time especially in factories near heavy machinery.

  7. @Roly
    The MOC3022 optos I mentioned have an operating voltage if 400V, but the isolation is about 5kV. I should have made that clear earlier…

  8. To the best of my reading so far- the “Hack by itself” here is expanding what a “shield” board can do. I’d call it a “Proof Of *CONCEPT* Prototype” And, as such, the original builder gets an “attaboy” round of applause for advancing Hacking! Safety is what speaking for myself only, I describe as situational. Different rules for each situation. Hacking is a situation divergent from “appliance operation” Are we not Hackers?

    There’s a phrase that appears in my mind EVERY time a comment thread veers to Paranoid or Darwinbaiting extremes. **Be careful, but not too careful**

    And, I owe a beer to someone who knows it was them, that put it on wall signs in a Hackerspace:)

    There’s another sort of wisdom that goes in and out of fashion in Design Science itself. It’s called Design For Usage. IIRC there were/are several variants of that as textbooks,and the ones I read of the type, influence my Hacking for the better. I point our thoughts to the comment by tantris RE: using those Christmas Light” switches, and an Arduino controlled LED.

    As in so listing, tantris has applied the “less risky” path. Hacked something an Industrial Designer who may have applied the “Design For Usage” courses to making UL approved- in a way that does not appear to lower that safety factor we presume is in an approved shrinkwrapped unit.

    Hacking lives-or we DIE in wrongly choosing which approach we use. Shrinkwrapped with non-invasive=least risk hacks- or this EXCELLENT for it’s “Lab POC prototype status” AC Shield= Darwinbait to the untrained/unlucky.

    Kudos to the Hackers of both approaches.

  9. @orenbeck: in principle i agree with your hacker-manifesto. there are safe and well traveled paths and then there are excellent, but slightly dangerous daring proof-of-concept hacks. unfortunatly, these aren’t the only two categories. if something doesn’t fall in category one, that doesn’t automatically make it a member of category two.

    something that is dangerous is not automatically an “excellent” hack. and if something has been done (better) for 30+ years, one can’t call it proof of concept either.
    duino-fans aren’t the only hackers out there. long before arduinos became popular, people built their own dimmers. this isn’t just reinventing the wheel, it’s more like showing up at a ham-fest with a string and two yoghurt containers.
    so, build one of the “traditional” dimmer designs from circuitcellar or tomi engdahl’s tutorial, replace the potentiometer with a transistor and the result will actually work without putting too much noise on your ac-net, or ac through you.

    here’s tomi engdahl’s tutorial:
    half way down, he also shows a safe way (still a hack) of dimming ac with low voltage dc.

    and something similar here:

    replacing the potentiometer not with a fet or a digital potentiometer, but with an optocoupler.

  10. Ok, you “safety” guys are missing a critical detail, this is a part, not a whole solution. Whoever uses this part needs to add the obvious safety features to the solution they are producing. A fuse and a proper enclosure are certainly required for a 120v solution but they don’t belong on this part anymore than they belong on every individual relay. Assuming someone makes a little black plastic box with this and a fuse inside and a plug and socket on the outside to make their christmas lights flash joy to the world in morse code or whatever they’re doing with it, where’s the danger ?

  11. The same idea is used on heater controllers that are used for plastic injection molding systems. Analog circuits or a microcontroller sends a signal to an opto-isolated triac driver. These are used in 240V AC three-phase standards. the Triacs can handle up to a 40 amp load (in my case). Two protection circuits are used, first a standard set of fuses on both sides of the AC, then a relay on both sides of the AC, also controlled by the micro. The micro is located at least 1/2″ away from any AC. On the board, standard separation from AC line to line is 250 mil, as well as AC to DC, all 250 mil (quarter inch). The board is covered by a heatsink, attached to the back of the Triac (isolated tab). If the triac gets too hot, it will go into what’s called a thermal runaway. If it gets shorted, it will also put out full power, but if that happens, that’s what the relays are for, if the micro senses something out of the ordinary, such as excessive current, or if you have a temperature sensor or even a light sensor, you can have it automatically kill the relays before damage is done. Of course, this would take more board space, and a good knowledge of basic routing practices for pcb’s.

  12. You miserable fucks. 120v, 240v, are NOT high voltages. It’s NORMAL voltage. And the current it SUPPOSED to kill you when you mishandle it. That’s how we keep the gene pool clean.

    Also, Relays make noise, and cannot be dimmed. NOT AN OPTION.

  13. Even though I add the occasional breaker to power panels with the power still on, I concur on doing this the safe way, including creepage / clearance on the PCB layout for optocouplers. There are reasons this is in electrical codes.

    One reason is lightning strikes to the power-line network. Want your project and computer to still work after a storm? Whoops, forgot to unplug it.

    Another reason is that since power lines go down in storms, tree branches fall, pole transformers fail (I’ve heard the occasional boom), power poles get hit by cars and tools or metal ladders can fall on pole transformers, it’s reasonably possible for the (in the US) 1.25kV feeding the power-pole transformer outside your house to get momentarily into your home’s power wiring. For instance, our power-pole transformer also feeds a house across the street. About two years ago a dump-truck with the dump bed left up caught the power lines crossing the road and ripped the transformer right off the pole! Hard to guarantee isolation when that happens.

    Oddly enough, the people writing electrical codes don’t seem to like homes catching on fire or people being electrocuted when these sorts of things occur. Wimps.

    I hope “The Cheap Vegetable Gardener” was kidding about 16 gauge wire taking care of safety.

    A fuse will help prevent fire but won’t save you from shocks. It only takes milliamps to kill, which won’t pop even a 0.5A fuse. And it takes amps to make me turn in my status reports.

  14. I just use relays if I need to switch small AC loads.
    If I need to put something together fast there are solid state relays that can take a 5v logic inputs.

  15. Hacking lives-or we DIE in wrongly choosing which approach we use. Shrinkwrapped with non-invasive=least risk hacks- or this EXCELLENT for it’s “Lab POC prototype status” AC Shield= Darwinbait to the untrained/unlucky.

    Kudos to the Hackers of both approaches.

  16. AC shield… bad idea? You guys are all pussies. This is what opto-isolators are for. Electronics people do more stupid stuff than this every day. If all everybody does is LED and hobby servos, Arduino will remain pathetic. There is no reason that the micro can’t control high power, high voltage stuff. If you want to scare the amateurs off, then write some scary stuff, and that’s that, but it’s a product that people want, so give it to them. Better to have a proven piece of hardware out there than to have some idiot putting triacs in a breadboard!!! I’ve seen it!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s