Switching 120 and 220 volt outlets
Switching wall outlets remotely, via the parallel port of a computer, a microcontroller (e.g., Arduino), or other simple switches, is desirable in many rigs. For example, timing/triggering lights in a behavioral environment, switching equipment on and off remotely, or coordinating the startup of complex rig (no more manual checklists for turning things on and off in the correct order). Rigging this up is a basic skill any experimental equipment rigger should know. There are a lot of different ways to do it, and this is one of them.
First of all, for the general audience: don’t try building anything with high voltage unless you’re properly trained. No one can take responsibility for your safety except you.
Afrotechmods have a lot of nice, basic tutorials on Youtube. The one above is on MOSFETs, which is one way to turn line power on and off remotely. But since most of us work in institutions with safety guidelines, I’ll cover a slightly more expensive, but considerably safer, solution.
For general purpose applications, an easy way to go is to use a solid state relay of the appropriate rating. For example, Allen-Bradley has a line of optically isolated solid state relays that will suit most needs. (datasheet) Check out the 700-SH40GZ25. It will switch 24-240 VAC @ 40A using a control signal of anywhere from 5-24VDC. These are a drop-in solution. You’ll need a heatsink, and possibly a diode (if you’re switching an inductive load, like a refrigerator; see the last page of the datasheet). Then all you need is an “on” signal. This could be a TTL logic signal, a digital out from a DAQ, a pin off of a parallel port, a microcontroller digital pin, or any other 5v source.
I strongly recommend using a ground fault circuit interrupter outlet. Also, make sure all finished projects are properly wired and enclosed before plugging them in. I don’t recommend using electromechanical relays for this application; although they will work with many devices, they have some shortcomings when it comes to high inductive loads.
A kit alternative is this quad TRIAC from AllSpectrum.