I am working on a project where I am using a microcontroller to control a 5V DC relay to control a mains device (an airconditioner).

In this circuit, I would need to connect the AC wires to my PCB at sereval points:

  1. as an input to a 12V transformer -> 5V voltage regulator
  2. to the 5V DC relay

My questions are:

  1. How to ensure the safe connection of the mains wire. After soldering them to the PC is there some kind of glue or something i can cover the solder with to ensure safety ?
  2. Do i connect all the grounds (AC ground , micro controller ground) together or should they remain separate?
  3. while designing PCB what do i need to keep in mind for the track widths for tracks handing AC current/voltage ?

Sorry if these questions sound newbish .. first time handling AC/DC together.

  • \$\begingroup\$ I would suggest you to look more into electronics before working with line voltage. \$\endgroup\$
    – Marco
    Jun 22, 2015 at 10:36

2 Answers 2


No, just putting some hot glue over dangerous points on a PCB is not enough. You will never pass safety certification that way. You need some kind of enclosure such that probing fingers can't get at the hot spots. Saftey standards will usually require a fuse in series with the AC hot line as soon as possible after it enters your box, then you can connect that to a PCB. The rest of the system must mechanically ensure that those nodes are ineccessible.

If this is a one-off for your lab bench, then hot glue, electrical tape, epoxy, etc is OK, but you have to keep in mind how these things can fail and treat everything accordingly. When working with AC power line on a bench, it's a good idea to use a isolation transformer. That adds one level of safety in that there won't be a conduction path from any of the high voltage to ground. However, keep in mind this changes if you connect a grounded scope, computer communication cable, etc, to any part of the circuit.

Something to consider: Don't use a 5V relay, use one instead intended to run directly off the AC line. This may lower the current requirements of the 5V supply so that you don't need a transformer at all anymore. For a few mA you can use a capactive charge pump, which might be enough to run your micro. In that case the whole circuit will be floating over the AC line voltage range, so you have to consider all of it dangerous. But, if this will ultimately be a sealed unit that only activates a relay, then that should be fine. After all, every AC line power circuit will have some parts at line voltage. The issue is how to deal with that properly.

Another method is to get a off the shelf "power brick" to embed into your product. These are switching power supplies that make isolated DC, in your case 5V, that you can then safely run the rest of your circuit on. In that case it would be easier to use a 5V relay as you originally said.

If your power requirements are only a few Watts or less, then you can push the power supply external. In that case you use a wall wart type power supply and only the isolated DC ever enters your unit. These are small sealed units with only the AC prongs exposed and come pre-certified to various safety specs. Customers understandably find them annoying, but the economics usually dictate something like that for up to around 5-10 Watts.


  • \$\begingroup\$ how about something like keeganmann.files.wordpress.com/2011/12/img_1261.jpg does anyone know whats that green enclosure called ? \$\endgroup\$
    – Ankit
    Mar 20, 2012 at 2:31
  • \$\begingroup\$ The green "enclosures" are a form of terminal strip. Those are not safe for general use unless enclosed. The top screw is electrically connected to the wire, and as your picture even showed, a small length of uninsulated wire can protrude from where it is clamped. \$\endgroup\$ Mar 20, 2012 at 15:05

Borrowing Olin's writ:

  • "If this is a one-off for your lab bench, then hot glue, electrical tape, epoxy, etc is OK," ...

... IF you do not mind dying every now and then.

Buy connectors that are DESIGNED & SOLD as mains connectors.
Talk to a local supplier of such components.

If YOU can access metal *(wire or whatever) at mains potential then somebody else can as well.

Hot melt glue fails to bind in from months to a few years.

Answers from here about track widths,clearances,copper thicknesses and more are a useful guide BUT you MUST have a complete and traceable information source on such things if you are going to live long and prosper. Find websites on such and ask advice from knowledgeable people on how useful they are. Usually a web page creator has spent tens to 100s of hours on a page or set of pages - far more than will usually be possible for a single question here .


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.