On Thingiverse I’ve posted a model and schematic for a relay-switched outlet box. This will let you switch an outlet on/off with an Arduino pin. That’s nothing new, but it’s a box that puts all the components together in a neat and safe package.
The model holds a U.S. power outlet, IEC C14 power inlet (for use with common PC power cables), a cheap arduino-compatible 5V relay module, and a small Dupont connector for the control relay module’s inputs. The wiring diagram below shows how to make one outlet switched with the other being always on.
The intent of this model is provide a switched outlet for my Mostly Printed CNC machine (MPCNC). It’s designed to be narrow so it could mount on the side of the machine to (a) provide always-on power to the power supply and (b) provide switched power to the AC spindle motor. That said, this model is a general-purpose switched outlet, so you could use it for any automation of AC power you need.
See photographs below for assembly directions. Notes:
- The faceplate is a standard one cut down to fit the width of the box; you could modify something like this if you had to print one.
- Relay modules tend to vary in size — move the screw posts in the model if needed.
- The relay control wire is just three double-female dupont jumper wires taped together and hot glued in place.
WARNING: This switches high voltage! If you are unsure how it works or how to build it, consult someone with electrical experience before proceeding! This isn’t hard to build, but it can kill you if you touch the guts when it’s live, and it can start a fire if wired wrong or with insufficient gauge wire (18AWG to probably not die, 14AWG to meet code).