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.

Comments

  1. cgmark says:

    I would never use triacs to switch power with a micro unless there was a specific reason that a triac was required. I would use a relay which provides as good as isolation as using an optoisolator and you don’t have the risk of getting shocked by the tabs like on the triac in the picture. Also triac produce heat and switching large loads generates a lot of heat. Relays are a proven method that is used in millions of homes in everything from microwave ovens to central heat and air.

  2. stunmonkey says:

    This is something that could finally make the Arduino truly useful instead of a pointless toy.

    I don’t see a problem with it, I think its great.

    The 5v guys tend to freak around serious current because they develop bad safety habits. Sort of like people who only handle Airsofts are incredibly dangerous and unwittingly careless when you hand them a real gun.
    Working with real current does take some getting used to, but it just isn’t that dangerous or hard to get in the habit of using best practices, and it opens up SO many new realms.

  3. jomei says:

    well thats very basic.

    if you look at a commercial product there HAS TO BE a distance between the logic(5V) circuit and the 240V circuit.

    Obviously arduino users donÄt know about this…

  4. cgmark says:

    @jomei
    Yeah that is something else I just noticed. Anytime you design a board with mixed low and high voltage you are supposed to isolate both areas to different parts of the board. Having connectors to the breadboard directly next to live triacs is an accident waiting to happen.

  5. macpod says:

    Relays are good for on/off setups, but what if folks want to do something like dim an ac light?

  6. cgmark says:

    http://www.futurlec.com/Opto_Relay_4.shtml

    $15 for 4 connections and way safer.

  7. macpod says:

    …I just wanted to point that out since you know how fond the Arduino crowd is of blinking led lights.

  8. cgmark says:

    For light dimming I would not do it on a shield attachment. I would build it on a board to itself in a proper enclosure with screws on one side for the micro connection and screws on the opposite side for the loads. The tabs on a TRIAC are LIVE when connected to AC and pose a shock hazard so they should never be left just sticking up on a board.

  9. GabrielSalvatori says:

    Great proof of concept. Would I ever use it? No. Never. Always be excessively careful when working with high voltages. That being said, if it’s ever updated and the problems fixed, I’ll be buying a few of these.

  10. Sobachatina says:

    I like triacs. Relays are far more expensive- like 3-10x than triacs with drivers. Relays are slower, have limited lifetimes and capacitance in the driven line can cause arcing.

  11. MaBerY says:

    FYI
    I just ordered 10 pieces of 39MF22 integrated Solid State relays.
    0.9A@600V With 4kV isolation and zero cross circuit.

    my case I need to control a Elevation/Azimuth CCTV motor for controlling an Sat dish or 13cm HAM antenna. This is a 24VAC unit so voltage is not a real issue. I probably design a separate PCB and not a shield just in case I need to control something at 230VAC

  12. I would not do it like this, the triacs get hot so its smarter to align them so you can screw on some cooling tabs. The circuit is not unusual, its just to small to be safe imho.

  13. threepointone says:

    yeah, there’s a right way and a wrong way to do it. i’d say you can design them on the same board if you do it right, and this isn’t being done right. unfortunately there’s no schematic or board layout image provided, but from what i can tell, the optoisolators are actually not performing a large part of their function here: the HV trace goes right across one of them, removing a lot of the inherent transient protection they’re supposed to provide. the layout is pretty terrible from the safety and protection standpoint, and honestly it’s not hard to do better.

  14. stunmonkey says:

    Damn, if it isn’t optoisolated correctly, and with separate supplies to each side, that would be a ball of magic smoke waiting to happen.
    I have no issues controlling some seriously scary current with 5v, but that 5v comes tapped from a USB port on my control computer and is grounded back there, too, through its separate ground plane. Everything talks through an opto board.

    There should be no possibility of connection anywhere between 5v and working current, nothing shared. I’ve seen too much feedback up shared grounds or through an un-isolated chassis in badly set up systems.

  15. I have been doing some research on my next cleaner/safer version of my grow box controller. Though codes still varies my city/state/country, the consistent rule I have seen is low voltage and high voltage can co-exist as long as the solid 16 gauge wire is used for both low/high voltage connections.

    That being said, for safety’s sake I would recommend moving the high voltage completely away from the low voltage since trying to “safely” reattach one wire while the system is live is definitely not recommended.

    With respect to HV this could be a “safe” solution, though I probably wouldn’t start selling these without setting up a LLC or have several pages of lawyer talk in the order form.

  16. Matt says:

    Solid state relays are expensive, and mechanical relays are slow. I tried to make a Christmas light controller with mechanical relays, and the best I could get was 1hz flashing. I tried to go faster, but I quickly started frying relays. The relays were fast enough with no load, but they just couldn’t handle fast switching with a load.

  17. Skitchin says:

    This is one of the rare cases where I have to agree with the safety crowd – electricity out of the wall is nothing to play around with, and 120V REALLY sucks to get shocked by. I got zapped around the age of 6 by a loose VCR plug. For those not familiar, the instant you touch it, the electricity tenses your muscles, more than likely making you hang on even tighter. I was stuck for atleast 5 seconds, let out a loud scream and eventually was able to sort of stumble back away. My lips were cold and pale for a good bit after..

    A circuit like this should really have a fuse, perhaps even a thermistor.

  18. DaveDaveDave says:

    No doubt an opto isolator is required and this thing could be a lot safer. My first thought was to add what us tube guys call “Death Caps” for protection ;)

    But geez guys, some of you are REAL WIMPS when it comes to 120AC. Try building a tube amp with some nice hot 480VDC, and then integrate an Ardiuno into it!

    Dave

  19. ZZZOOOLLLTTTTT! says:

    Quite honestly, this should never go to market, be used, or even be handled in it’s current form.

    First, use isolated tab triacs, it’s a no-brainer.

    Second, at least put a lexan shield around the entire high voltage area.

    Third, heat-sinking will be an issue, so include some in the design.

    Fourth, use proper isolation technique, such as routed slots between the high and low voltage sides.

    That being said, it is innovative, and if you fixed the safety issues, added a regulated 5V power supply, and had it properly potted in an enclosure with guarded screw terminals off the topside for the AC, I think it would work quite well.

  20. Buzzkill says:

    Seriously @DaveDaveDave. This crew is a buncha wussies. 120v on a board like this? Why the hell not? With those triacs, we are not talking about 20 amp loads. You are looking at 1-2 amps max. And with no heat sink, closer to 1. This would be just fine for adding a little blinky flashy to something, or running a halloween prop, etc. Would I run 240V through it? Probably not. I have seen this tried on some of the DIY lighting automation sites. Unless you are going to reposition those triacs, you may end up with arcing which would end your blinky flashy fun pretty quickly.

  21. ZZZOOOLLLTTTTT! says:

    mmm, tubes…..

    Plasma tweeters come to mind :D

  22. cgmark says:

    If you want to do it and do it right use something like this layout.

  23. dstrcto says:

    @Skitchin:
    Aren’t you glad we don’t use 120V DC, hehe… Needless to say, you need to know what you are doing here. DC is pretty easy stuff, AC gets tricky, and not knowing the basics of either will have consequences. Nonetheless, this is a semi-useful shield if it’s in the right hands.

  24. jomei says:

    @skitchin

    “and 120V REALLY sucks to get shocked by”

    240V suck even more. 480V(between two lines@240V here in europe) even even more.

  25. Darryl Smith says:

    The main problem is the TRIACs and their tabs. The simple way to improve safety is to use insulated tab TRIACs. These are a bit more expensive, but much safer. Whilst you are at it, also use zero switching opto’s

    Darryl

  26. vic says:

    What’s wrong with using low voltage to trigger a higher voltage ? It’s being done all the time without any problems. He does it properly with optocouplers, as should be. Relays are easier but slower, more expensive, and limited in their applications. The real problem here is not the circuit design, it’s the way the high voltage traces slither between the low voltage ones, nullifying the isolation. Probably OK for 110V, but problematic for 240V. Next problem is that he’s selling it (or was, 9 months ago), and obviously does not respect the regulations regarding handling of mains voltage.

  27. mosheen says:

    I’ve seen two AC projects this week missing the same thing: a fuse. That magic little glass device will keep your house from burning to the ground. Try to match it to your intended load too, not the absolute max of the circuit.

  28. ianc says:

    I wouldn’t use this design. I would encase the 120ac board in a seperate plastic or metal (grounded) box with appropriate strain relief.
    I love those big grey plastic boxes you can get at home depot for outdoor electrical.
    Some kind of pin connector could connect to another box with the arduino and the low voltage stuff.

    ps

    How come I have never gotten shocked so bad that I couldn’t let go? I’ve been shocked many times, but I always jerk away from it? Is it because my hands are dry?

  29. Lucassiglo21 says:

    you shouldn’t be so afraid, it has optotriacs, that’s pretty safe if you keep your hands off the tabs, fuses are a good idea, but the board is isolated from the electronics.
    this is much safer that another project i did, it used a transformerless power source and all the project was floating in the AC voltage, so i could switch the triac directly.
    if you keep your hands far from the wall voltage you shouldn’t have problems at all.

  30. burnsy says:

    This could be the instigator of a great tutorial.

    Once circuit diagrams and board layout files are released, someone could redesign it safely, and make a tutorial going through all the changes they made, and why those changes needed to be made.

    Would help people use those principles in their later projects.

    I can’t do it, my head’s full of bits and buses.

  31. brad says:

    @mosheen – Correct.

    Don’t forget to put them in your DC projects as well.

    A must if batteries are involved.

  32. Lucassiglo21 says:

    you can’t use triacs with DC, they will remain in ON state until you cut the current.

  33. Manfre says:

    @ianc, DC voltage contracts muscles making it very difficult to pull your hand away. An advantage of AC voltage is that it doesn’t share this property and is the reason you were able to jerk your hand away.

  34. mosheen says:

    @Manfre
    I am an industrial electrician and that is incorrect. The only reason you’re able to pull away is luck. Let it catch you the right way with enough sweat and a good path to ground and your dead. 120vac will put you under, and 480 will burn the crap out of you….and put you under. Please be careful everyone. 120vac is so common we take for granted what it can do if you don’t respect it. GFCI outlets are a good idea for working with projects too.

  35. Godi says:

    People just need to fucking die! Whatever happens to achieve that goal is fair play.

  36. Thanks Mike and Hack-a-day for the post!

    This whole idea started with me wanting to dim an AC based light bulb with an Arduino at low cost. Triacs are really the simplest and lowest cost way to go. They are also very standard, I got much of the idea from an oven controller in my house that has a very similar circuit that uses a PIC to drive opto-isolators and triacs (CE certified, and there is not even a full case around the PCB!) Also, if you pull open an old rotary dimmer, some have a similar triac circuit.

    I was getting two worried about any testing over a few watts using a breadboard, because that was really not safe. So the shield idea came up to do a proof of concept for light dimming. Well the idea and circuit did work fine with the few lights I tested it with, never more than 1-2 amps for a few minutes at a time. (For all the worried people, don’t worry I only made 2 prototypes for my use!)

    Check out this thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230333861) for the code side of this project. Many people have worked on the code to get the Arduino to accurately dim AC devices!

    I have actually been working on many more revisions since. I think I am on about the fourth revision. The board is now a dedicated 2″x3″ board that with have a casing around it. (FYI, the prototype had e-tape and hot glue covering any exposed AC connections, not that that makes it too much safer.) There is much more isolation between the 5V and AC power with completely separate AC and 5V GND planes on both sides of the board. The nice thing about the board is that the components are cheap and can be made for $20-30 for 4 channels VS some of the much higher SSR based dimmers.

    Thanks for all the comments, I certainly understand both sides of the story. I myself used to work on concert lighting and sound, having to worry about getting zapped by 400 Amp 3-phase that you needed to hook up live! You need to be more careful with high voltages, but AC is also very common place. Just make sure you are comfortable with it and know what you are doing before attempting anything.

    I’ll post again in the Arduino forums and on my site when/if there is something worthy of having other people try out. Thanks

  37. Sean says:

    We built several similar boards for an art project supporting 8 channels without problem. Our boards had screw terminals for each channel. These were NOT shields though.

    My main comment would be to take the plug off the shield and connect it via cord. I wouldn’t really want to be holding the Arduino and shield to provide the necessary counter-force while I plugged it in.

  38. Loren says:

    So i take it one should not get drunk before using this?

  39. ladz says:

    Solid state relays are the only way to go for hobby projects. They’re all over the bay for 5-10 bucks. Not even counting the advantage of zero-cross switching, the convenience, safety and reliability is well worth it.

  40. kpetoh says:

    I second the proposal for some screw down terminals and physically isolated potted hi-volts.
    Unless we’re stuck in the 1930’s I see no need for relays; SCRs are the way to go.

  41. salsa says:

    The safety concerns people have mentioned are quite valid, especially that the tabs should be isolated.

    The real issue, though, is mounting– a shield is really not a very safe way to build something like this, for two reasons.

    1) Since there are or may be pins sticking up from the Arduino (or other shield) underneath, those could get close to the AC side of this board.
    2) Arduinos are not typically mounted to /anything/, in spite of having standoff mounting holes! So, this thing will be skidding around a tabletop or held to something with rubber bands and/or hope.

    This is not a dangerous idea per se, it’s just a matter of implementation.

  42. tantris says:

    i agree, this might lead to fewer arduino-posts.

    but first, we will get more arduino posts:
    people, blinking their porch lights
    an arduino, that will turn on the toaster, when you receive email.
    someone dimming his microwave.
    a computer that turns on the gas stove, when someone tries to reconfigure it.

    this will continue for a week or so, than the posts will slowly disapp ..ehhr.. die off.

  43. Mickey says:

    To be fair – the developer was doing his best, and while there are plenty of people that can do better – we all made simple errors when we started out. Some of us had mentors to put us right, and others… well they’re not here now.
    Keep this effort within sight at all times, and remember when you do fire it up (no pun intended) – make sure it is well isolated, fused and ideally on an earhtt leakage circuit to protect the vulnerable that are downstream fromthe box. Kids, pets and falling stuff all have the innate ability to find live circuits faster than a sparky.
    Making non-lethal mistakes is as good a way of stimulating positive criticism. Just don’t let your ego run away yet – or you may face liability and insurance problems you never dreamed of!
    Good luck – and keep on developing stuff.

  44. Agent420 says:

    “Seriously @DaveDaveDave. This crew is a buncha wussies. 120v on a board like this? Why the hell not? ”

    Couldn’t agree more. I’ve done many similar projects, it’s fine. Take off your training pants and build a project controlling some real power. jeez.

  45. Tachikoma says:

    To people who are freaking out over using triacs: They have been used in $5 touch lamps for many years now, and they utilise the shitty-est capacitive sensor circuits.

    Anyway, regarding this project, it’s hard to tell from the photo, but I don’t think I’d be satisfied with the layout. I would probably tear up the PCB design and lay them out for better physical isolation.

    For the circuit design perspective, again it’s hard to tell without seeing the schematic, but it appears this thing is using MOC3022 optos (the white 6-pin DIPs). Those are rated at about 400V, which provides adequate electrical isolation, IMO.

  46. Tachikoma says:

    Oh yeah and i forgot to add, put a heat shrink tube around the triacs for insulation.

  47. Agent420 says:

    … And to all those suggesting relays, I’d like to see your version of dimming…

  48. Mike77 says:

    Sweet mother of crap! Is he nuts? Or has he perhaps never seen an opto-isolator?

  49. lejupp says:

    @Agent420: No problem, let the relays do PWM and implement an automatic relay changer with a 1000 relay magazine.

  50. Francisco says:

    I can’t see any problem with the circuit, however, I haven’t seen the PCB layout.
    The Insulation and separation of the 5V and mains coud be provided with adecuate routing and smart use of both sides of the PCB.
    The use of non-isolated tab triacs is OK if the circuit is to be put in an adequate enclosure.
    Any real hacker must not have fear of mains voltage, only sufficient knoweldge and respect for it.
    I’ve learned it the hard way with more than ten socks from 230V mains in the first 25 years of my life without consequences (the differential circuit breaker worked in all the cases).
    Some years ago I built a light sequencer using 4xxx series CMOS logic, controlling triacs without isolation (all the 5V circuit floating at mains voltage) and I never get shocked by it. This circuit was built in wired prototipe board and actually the circuit is working today without trouble.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 96,376 other followers