Introduction: Mains Voltage Relay Test Jig

For some reason I always end up needing a reason to switch a mains powered device with a microcontroller so I decided to finally make a test jig with some spare parts I have lying around. Hopefully this will be much safer than having exposed mains wire floating around everywhere. :)

Before attempting this project you:

  • MUST be comfortable working with mains voltage
  • Have access to a 3D printer (or be able to fabricate the box somehow)

Step 1: Bill of Materials

This example I used in this project is using an ESP8266-01 to control the relay. Case is made for a 5x7cm prototyping board, so you can adjust as necessary.

  • 1 x IEC320 C14 Panel Mount Plug
  • 1 x NEMA-5-1 Snap Mount Receptacle (Panel Cutout: 1" x 1.1")
  • 1 x Panel Mount Fuse Holder
  • 1 x 5A, 6 x 30mm Glass Fuse
  • 1 x On/Off/On 20A/125VAC Snap Mount SPDT Switch (Panel Cutout: 25.5mm x 10.2mm)
  • 1 x 5 Position Terminal Block
  • 1 x 5V Relay Board*
  • 1 x USB Charger (AC to DC 5V Switch Mode Power Supply)*
  • 1 x 5V to 3.3V Regulator Module*
  • 1 x ESP-01 ESP8266
  • 1 x Male & Female Pin Headers
  • 1 x IEC320 C13 to NEMA5-15P AC Power Cord
  • M3 Nylon Nuts, Screws, Standoffs
  • Mains Rated Wire

*These are what I used in this project since this is what I had lying around. If you have a AC to DC 3.3V Switch Mode Power Supply and a 3.3V Relay Board you won't need the 5V to 3.3V Regulator Module.

Tools

  • Soldering Iron
  • Screwdriver
  • 3D Printer
  • Wire strippers

Step 2: Printing the Case and Mounting Parts

You can get the 3D models for this project from Thingiverse:

http://www.thingiverse.com/thing:1474924

Once you have completed printing you can go ahead and mount the panel mount plug and secure it with the M3 nuts and bolts. The receptacle, switch, and terminal block are snap fitted to the case and the fuse is tightened with the nut that comes with it.

Step 3: Schematic and Wiring Up

Circuit is pretty simple. Mains voltage comes in from the C14 Panel Mount Plug, to a fuse, and splits to the SPDT switch (High Voltage) and switch mode power supply (Low Voltage).

High Voltage

The SPDT switch can either be set to go to the Common on the Relay, Off completely, or directly to the NEMA-5-1 Female Receptacle which bypasses the relay. The Relay in my setup is wired up as normally open so that if the switch is set to the it, the microcontroller will have to trigger the relay in order to power the female receptacle.

Low Voltage

The switch mode power supply steps down the voltage to +5VDC which powers the relay coil, and is further stepped down to +3.3V via linear regulator to power the ESP8266. The digital pin on the ESP8266 is then connected to the trigger pin on the relay module.

Wiring Up

I used a terminal block to make the mains voltage wiring a little easier and more flexible in case I wanted to change the setup. The case accepts a 5x7cm prototyping board and is mounted using M3 standoffs. Depending on the size of the switch mode power supply you may need to make some adjustments on how you lay it out on the board. I used headers on the board so that the parts are not permanently fixed in case I need to change anything. Reference main picture for wiring setup.

Step 4: Power It Up!

I'm not going to cover how to trigger the relay with a microcontroller I'll put some links in the reference section for that. But if everything goes well after plugging in the AC power cord to the the male plug you are done! You now have your own test jig.

Step 5: References