I'm designing a microcontroller controlled switch. I idea is to have a 120V outlet controlled by time of day, or a motion sensor, etc. The plan is to have a lamp plugged into the outlet.

I will switch the 120V with a relay, which I plan to have on the same board as everything else. Since I have the 120V anyway, I thought I would use a Recom AC/DC Converter to provide 5V.

My questions are more mechanical than electrical, but important to the design:

  1. How do I get the 120V to the board? Can I use a lamp cord with a standard plug on one end, with the other end connected to a terminal block?
  2. Can I use a 2-conductor cord (i.e. no separate ground) ?
  3. If I use a terminal block, what gauge wire should I use to connect from the block to the realy?
  4. Let's say I decide to make a "real" board out of this...can I put 120V through traces?
  1. Yes, you can. Research "creepage and clearance" to be sure you route the high voltage conductors properly.

  2. Yes, you don't need a third wire ground. If you are mounting this whole thing in a metal chassis a third wire ground would be a good idea. (Connect the ground wire directly to the metal chassis.)

  3. Depends on your maximum load. Search for AWG vs. load to see the appropriate recommended conductor for your lamp load.

  4. Yes, assuming you follow the creepage and clearance and insulation isolation rules, as well as sizing the traces for the amount of current.

A fuse mounted somewhere in series with your AC line input would be a good idea as well.

  • \$\begingroup\$ I would definitely not put 120VAC on the usual plastic breadboard, but it is fine to put it on a "real" PC board, with due allowance for clearance between the 120V leads, and between the 120V leads and low voltage wiring. \$\endgroup\$ – Peter Bennett Mar 2 '14 at 21:23

Can I use a lamp cord with a standard plug on one end, with the other end connected to a terminal block?

Such a cord is called a "suicide cord", for good reason. Treat it with extreme respect!

Plug it into the wall only when you're ready to test your circuit, and you're absolutely certain there are no stray (unintended) connections between it and anything else (including you).

Unplug it from the wall before doing anything else to your circuit.

Keep one hand in your pocket whenever it is plugged in. (This keeps you from creating a direct electrical path through your heart.)

One other point — you're using a microcontroller, and it's more than likely you have this microcontroller connected to a PC of some sort for software development and debugging. Even though it sounds like you have the microcontroller adequately isolated from the line with the relay and the power supply, I would still recommend that you always disconnect the PC from the target system before plugging the cord into the wall. It's just too easy to create an inadvertent short between the line and the microcontroller, and this could easily destroy your PC, which would completely ruin your whole day. Trust me, I've seen it happen.


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.