# Where can I learn to safely deal with mains electricity? [closed]

I want to start working on projects that directly interface with the mains in my house. I know this is dangerous. I don't want to design something that will fail in a year and burn down my house. We had one lecture on mains electricity in my EE program. So I basically know a bit about inductive and capacitive loads, and that is about it.

Things I would be interested in learning:

-Directly power a microcontroller from the mains lines.

-Sense power running in a line

-DIM lights from a micro

I want to do this properly. What classes could I take that would teach the appropriate knowledge?

## closed as primarily opinion-based by PeterJ, Leon Heller, Daniel Grillo, JYelton, Andy akaSep 8 '14 at 17:09

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

• A little knowledge can be a VERY dangerous thing. My advice is to avoid using any mains equipment until you know for certain what you are doing. Your first mistake may well be your last (ever)! – JIm Dearden Sep 8 '14 at 15:03
• If you had an electrical engineering degree and license and electrician training and license you might know enough to be said to be safe. But even highly trained people make mistakes and deaths happen. – Spehro Pefhany Sep 8 '14 at 15:14
• There ought to be some course somewhere, surely? There's specific design safety standards such as double insulation and creepage distances that people cannot be expected to just pick up. – pjc50 Sep 8 '14 at 15:46
• @SpehroPefhany, I managed to get 3 EE degrees without ever being taught the least thing about electrical safety. Two days of a UL class, on the other hand, at least gave me enough that I can usually get a design past inspection by a PE on the first go. – The Photon Sep 8 '14 at 16:31
• @ThePhoton yes I know which is why the qualifications about said to be safe and licensed (so as to know where the liability lies). I'm not sure UL classes without background will allow you to be safe, but an engineering background will lead you to UL, electrical codes etc where appropriate. – Spehro Pefhany Sep 8 '14 at 17:12

That's sort of a vague question. You could go through a technical school for electricians and learn the general concepts of house wiring. The concept of AC rectification is probably all of two lectures in a 200 level college course.

The problem is that there isn't just one class, it's the class(es) leading up to that 200 level course. Even if you cover that, that's just the basics of turning AC into DC, you probably still wouldn't know enough. To get into switching loads and dimming lights would get into semiconductors, and that'll probably be a 3 or 400 level class. Basically ... it's not one class, it's a degree.

It's not a fun thing to say, but you probably should stick to commercial products for most of what you listed. AC-DC plug in adapters, commercial dimmers, etc if they're directly interfacing with household power, at least until you're done with your EE degree.

Things I would be interested in learning:
-Directly power a microcontroller from the mains lines.


I'd say: forget this. It is in nearly all cases not worth the trouble. Get a wall-wart (nowadays you can get a decent 5V output switcher for almost nothing).

-Sense power running in a line


There are various isolated ways to do this. One of my favorite is to wrap a few 10's of turns of your (isolated!!) AC wire around a reed switch.

-Switch loads


Get a relay or a (zero-crossing) opto-triac.

-DIM lights from a micro


Get a (non-zero-crossing) opto-triac, and use an opto-coupler to sense the 0 moment.

Doing such things with a micro-controller is fun in itself. Don't let you be distracted by the mains side. That's a full study in itself, but much less fun than micro-controllers.

I want to do this properly.


Only one proper way: don't. Concentrate on the micro-controller part and you will have more fun. And for a longer time.