How to safely use 220V relays?

Hi all,

I bought these 220V relays working off 12V recently and I’d like to hook them up to the 220V mains to do interesting things.
However, I am very concerned about electrical safety? What is the best practice to avoid electrical shock when prototyping? I was thinking about making custom PCBs to solder the relays on and screw the main wires into those little screw connectors (if you see what I mean) but that still leaves some live 220V wire exposed.

How do you deal with this particular issue? Also, should I fuse anything? I have lived in the UK in the past and I know plugs have 10A fuses inside them there but is it really necessary?


  1. Yes, I would make a pc board for your project. solid traces on a pc board are much safer than trying to wire up something(especially with 220).

  2. I would DEFINITELY include a fuse on your incoming mains power line!!! Safety!!! You can have a real bad situation if something would short out on your board or something attached to the board.

  3. I would use opto-isolators between the Arduino and your control board. Just have them as your first connection from the Arduino. It protects and isolates the Arduino from the mains power.

You would have the Arduino connect to the control side of the opto-isolator. Use a 12 volt source to go through the isolated side and to your relay. Then your mains would go through the relay from a fused input on your board.

Hope this helps.

The basic rule is keep high voltage wiring away from low voltage wiring - on a PCB that means a copper-clear zone of 10mm or so. All high voltage side wiring must be insulated (this means solder-resist on a PCB), no bare copper visible. The low-side circuit should be earthed (unless the relay itself is rated as "double insulated" and its connectors are separate for coil and contacts??).

If there is a way to accidentally touch the mains wiring, its not safe (so the reverse side of a high voltage PCB must be inaccessible or covered by insulating screen). If an ant (for example) crawling over the circuit can touch both high and low voltage conductors (other than mains earth), its not safe.

Also check the official regulations in your territory. Remember both shock and fire hazards exist with mains supply, use appropriate fuses / breakers.

I would suggest picking up a Variac if you'll be messing with mains voltage more than once. This will let you run very very low voltage through the 220v side. Then, you just adjust the dial on the Variac to raise the voltage a little. Test, make sure you're not shorting anything; check for presence of expected voltage. Then raise it some more. Continue until you're at 100% power.

I've designed a few simple PSUs this way. One of them popped a voltage regulator I had wired backwards, but it would have been a lot more interesting had I hit it live with 120v from the start.

A PC board isn't necessarily going to make it safer, since with a PCB, you've got copper traces that can shock you if you touch them.

What kind of relay is it? Can you put heat-shrink tubing over the terminals? Usually, I use heat-shrink over the terminals (including the low-voltage and any unused terminals), AND I put everything inside a box.

At some point, you'll probably be testing or troubleshooting with the cover off the box. Just be careful! Technicians & engineers that work with really high voltages (over 1000V) take a couple of precautions. They wear rubber sole shoes, and they put one hand in their pocket, or behind their back to prevent the possibility of current flowing through their body. (You do NOT want to ground your body.) This means you need a clip on your meter's ground lead, so that you are not holding a probe each hand. You won't get killed if current flows through one hand. I beleive most electricians (working with 240V or less) use both hands, but they knowwhat not to touch....

Depending on what I'm building, I usually like to put all of the high-voltage control-stuff in one box, whth the low-voltage stuff in another box. The relay (or opto-isolator, etc) goes in the high-voltage box, so there are some low-voltage wires going into the high-voltage box. (I might actually have AC going into the low-voltage box too, if there is a power supply for the Arduino, etc. But, this AC voltage only goes as far the transformer.)

If you use a metal box, the box needs to be connected to earth ground. That keeps everything safe if an AC wire accidently comes loose inside the box and touches the case. If that happens and the cse is grounded, you can't be shocked by touching the case, and the fuse/breaker will blow.

What's connected to the other end? if you are going to plug-in something like a lamp, it's often handy (and economical) to put the relay in a regular [u]electrical box[/u] (the kind that's normally inside you wall) along with electrical outlets and outlet covers. On the AC input-side, you can have a cord & wall-plug. And sometimes it's cheaper & easier to cut-up an extension cord than to assemble a cord & connector.

A fuse does NOT make it electrically safer. (Less than one amp can kill you.) The fuse basically prevents a FIRE, or it prevents wires (and copper traces on a PCB) from burning-up. A fuse rarely protects electronics (semiconductors) because the electronics usually 'burns up" in the fraction of a second before the fuse blows.

An opto-isolator won't do much for you either. The relay coil is already completely isolated from the contacts.