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. 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. 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. 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. @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. 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.

  6. 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.

  7. 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

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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.

  13. 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

  14. 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.

  15. 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.

  16. @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.

  17. 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

  18. 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.

  19. 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.

  20. 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?

  21. 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.

  22. 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.

  23. @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.

  24. 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

  25. 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.

  26. 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.

  27. 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.

  28. 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.

  29. 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.

  30. “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.

  31. 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.

  32. 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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.