Electronic – How to connect a relay to 220 Volts outlet

accontroloutletrelaysocket

I used relays before but just for simple 5V DC signals control using a Raspberry Pi. Now I'm quite cautious and would like to ask for some help from professionals because I'm not planning to set my apartment on fire.

What do I currently know about this?

I currently use the relay to switch on/off my computers. Doing this is very simple. Since computers turn on by shorting two terminals, I just took a branch from the power buttons of my computers and hooked them to a relay (like the one in the picture) to the terminals are not connected by default. I have a little script that switches the relay for 0.5 seconds, which is enough to turn computer on.

enter image description here

The problem:

Now I would like to use this to control some 220 Volts power outlet. For that, I bought a socket, like the one in the picture, and mounted it on a plastic project box:

enter image description here

From that socket comes 3 terminals, two terminals (call them black and red) and earth in the middle (call it green).

I would like to install an IEC socket on the box, too (like the one in the following picture):

enter image description here

The question:

How should I connect the outlet socket to the IEC through the relay? Please advise.

If you require any additional information, please ask.

Best Answer

If you have a properly rated relay, you don't need to do anything fancy. Just use the right gauge wire for your power requirements.

Route the hot line through the relay, don't route the neutral line. Then of course connect the earth and neutral from each connector together. If you don't know what hot, neutral and earth are, now would be a good time to get yourself up to speed on residential wiring.

However, you will want to be a little bit more deliberate and careful than you would with 5V lines, which might include heat shrinking over any soldered connections, and carefully routing the wires inside your enclosure so that they don't move around or come loose and short out. The stiffness of the thicker gauge wire may require a little more forethought and planning while cutting and placing, but you'll figure it out quickly enough.

Lastly, everything needs to be enclosed, you can't just leave it out in the open like you can with 5V.