I designed a PCB which matches the dimensions of a receptacle box (the blue ones, just gonna call it the box). It is meant to mount next to an outlet in a double gang box and has a relay controlled by an esp to control the outlets. The components face into the box, and an led faces out, but is flush with the out-side of the board. I'm wondering the legality (code-wise) of installing a custom device like this into an electrical box. All it's doing is breaking or making the live connection to the outlet, but for now the design necessitates soldering the Live wire directly to the board, which I'm pretty sure I don't wanna do. If it had proper screw terminals for Live would that be ok? I'm having trouble finding information on this, maybe my Google-fu is off.

  • With appropriate creepage and clearance distances, there's no problem with routing mains voltage on a PCB that also has user-accessible areas. Determining the appropriate distances depends on a bunch of details, and verifying the design is a matter for a licensed engineer. – The Photon Jun 19 '20 at 3:28
  • I can't give any kind of definitive statement, but putting something that is not UL certified in there is asking for trouble with your homeowner's insurance, if something were to happen. – DoxyLover Jun 19 '20 at 3:54
  • Is there a reason you are trying to do something this chintzy instead of using something off-the-shelf for the mains switching? – ThreePhaseEel Jun 19 '20 at 3:56
  • Thank you for the comments. There are no user accessible areas, the entire PCB will be screwed into the box and fits exactly, just like an outlet or switch, and will be covered by the plate. As far as why I would do this instead of buying...this is the diy forum right? I can have the boards manufactured and parts bought for 10 of them for a fraction of the cost of one off the shelf piece, and I have complete control over the software, I don't have to use third party Chinese apps. A raspberry pi acts as the mqtt broker. – HaLo2FrEeEk Jun 19 '20 at 12:49

That would not be code-compliant. The NEC requires that all installed equipment be listed by a recognized testing laboratory (i.e. Underwriters' Laboratories, "UL", in the US) who has performed safety testing.

One way to deal with this is to outsource the switching job to a listed relay that mounts in or to a junction box, so that the mains voltage is completely contained in the junction box. Outside, the relay gives you terminals (for either closing a circuit or providing a voltage) to control the relay. Your custom IoT gadget can control the mains circuit without needing to be listed itself, because it is isolated from the mains power.

Random example relay

  • 2
    Can OP keep the "concealed" appearance of their IoT device? Putting it in a separate single-gang box near the mains voltage box and relay, for example? From this answer, it sounds like as long as mains isn't in the same box as his unlisted equipment, he'd be OK, but getting LV power to run it could be tricky... – Khrrck Jun 19 '20 at 17:27
  • I'm very interested in maintaining the concealed look. The PCB I've designed has the esp switching a transistor which switches the relay. There are no slots in the board yet but I could easily add separation slots between the tracks and the LV/mains sections. The board is set up so the LV side is at the top and the mains comes in, is switched, and leaves the board at the very bottom, so there's significant separation already. – HaLo2FrEeEk Jun 20 '20 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.