Because this can be deadly, and is best left to someone qualified; advice for hobbyist projects on the web are reluctant to offer advice on safely handling mains connections. The get-around is to offer battery, wall wart or power brick based designs.

Perhaps there are already instructions somewhere on the web/in print that avoid liability but manage to advise on how to do this safely.

How to wire up e.g. a mains inlet, fuse, filtering/suppression if any, switch and transformer primary to the mains, done for maximum safety for yourself and for your end users?

  • 6
    \$\begingroup\$ If you have to ask, the safest way to wire it up is to hire an electrician. \$\endgroup\$ – PlasmaHH Mar 7 '16 at 10:46
  • 1
    \$\begingroup\$ Plenty of great online instructions for baking cakes and making curry but I reckon that at least one in ten readers screw this simple task up and end up spitting the meal onto the floor. The trouble with instructions is that idiots are given the confidence to try things out. \$\endgroup\$ – Andy aka Mar 7 '16 at 11:15

You can follow the professional design requirements: https://en.wikipedia.org/wiki/Appliance_classes

Most power bricks are class II:

The basic requirement is that no single failure can result in dangerous voltage becoming exposed so that it might cause an electric shock and that this is achieved without relying on an earthed metal casing. This is usually achieved at least in part by having two layers of insulating material surrounding live parts or by using reinforced insulation

However, if you're building a transformer-based device you may find it easier to put it in an earthed metal case and make a Class I device. In that case, wire everything directly avoiding running mains on a PCB shared with non-mains power. That saves you having to worry about creepage distances.

You also need to make sure your cable is mechanically attached properly with a strain relief, or use an IEC plug/socket arrangement like PC power supplies. You cannot allow solder to take any force of users pulling on the cable.

There is also this Apple charger teardown and another article on the same blog about the design errors of fake Apple chargers which cover key issues.

If you're shipping it commercially, you will need to make it CE/UL compliant, and this increases the testing cost. That's why most manufacturers prefer power bricks these days.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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