# Can you put a 120vac positive line into a breadboard?

Is there anything I need to know about putting a 120vac positive line in my breadboard? (Like, for example, if it's a bad idea to do that to begin with.) It will just be a christmas lights strand at less than a quarter amp. I will only be putting the positive line into a DIP relay. I've only heard a few instances where people have done this and my only electrical experience deals with 5vdc so i've never been shocked. I know that I will not be touching this while it is actually plugged in as well.

I also will have 5vdc control wires on the other side of the breadboard. Should I throw in some diodes to protect my Arduino, or should the relay keep the power isolated pretty well?

• Phew, glad this community is open to that. Feel as if questions over things like this that seem simple to others aren't taken as well on other SE sites! – Kyle Sep 22 '11 at 1:30
• As a long-time user of SO and the extended family, I've always believed that simple questions are important. And sometimes, the seemingly simple questions lead to really interesting, deep answers. – RBerteig Sep 22 '11 at 1:34

Do not put 120VAC on a breadboard. While there's nothing preventing you from putting 120VAC on a beardboard, that's really dangerous so don't do that.

Get a perfboard to solder your relay in. Mount said perfboard with the relay into a plastic project enclosure box. That way, you won't accidentally short any of the relay contacts. Drill a hole in the box to allow for 120VAC connectors.

You can get all those items at your local Radio Shack or Fry's electronics. Or just about any electronics supply store.

According to your comments, you have a HSR412. You should still get a perfboard and plastic box and solder this device into it to protect it and to protect yourself and others from a potential shock. The datasheet says that it provides "4,000 VRMS Isolation", so w.r.t. isolation you should be fine.

The datasheet specifies that the control LED has a voltage drop of 1.6VDC @ 10mA. Assuming that your Arduino outputs 5VDC, you need a resistor in series with the LED to drop 3.4VDC while passing 10mA. This is to get the 5VDC down to 1.6VDC. You can use Ohm's Law ($V = IR$) to figure out the required resistance:

$R = V/I = 3.4\text{ V} / 10\text{ mA} = 340\text{ }\Omega$.

There isn't actually a resistor that's exactly 340 ohms, so select a 390-ohm resistor. Now, calculate the power across the 390-ohm resistor:

$P = IV = I^2R = (10\text{ mA})^2(390\text{ }\Omega) = 0.039\text{ W}$.

So a 390-ohm, 1/8 watt resistor connected in series with the LED should be appropriate. So you can connect your Arduino to your relay like this:

     Arduino                             HSR412
----------------+                     +----------
|       390 Ohm     1 |
control pin +-------/\/\/\/-------+----+
|       1/8 Watt      |   _|_
|                     |  _\_/_
|                   2 |    |
|             +-------+----+
|           __|__     |
|            ___      |
|             _       |
|                     |


The maximum pin source current from an Arduino is 40mA per pin IIRC, so you should be able to just drive the LED and resistor directly. Again, it's best to put your relay in a plastic enclosure to protect yourself from the 120VAC that will be present.

• Really dangerous? Sweet, glad you told me! Wait, is prefboard that stuff you can get at radio shack? – Kyle Sep 21 '11 at 20:50
• They are actually solid state relays, still have kickback? – Kyle Sep 21 '11 at 20:56
• @Kyle: Oh, they're solid state? Since they don't have coils, then there are no inductive kickback. But would you mind giving us the exact part number? They come in even more varieties than mechanical relays. For example, some SSRs have control pins that can be connected directly to a microcontroller pin, etc. – In silico Sep 21 '11 at 20:59
• It's a HSR412 and the datasheet is at here. I don't care for it being DIP, but it was cheap. – Kyle Sep 21 '11 at 22:58
• Okay, this answer is top notch man. You've helped me with several things. Thanks for this all! – Kyle Sep 22 '11 at 1:29
1. That the 120 V AC line doesn't care that you plan to use only a quarter of an amp. You are only current limited by the circuit breaker at the mains. Could be 15 A.
2. Don't do it

As others have said, bad idea. I understand you don't plan to touch the breadboard, but stuff happens.

Take a look at the bottom of the breadboard. Some have the bare metal of the clips exposed there. Even those that don't usually have just a paper sticker over the bare metal. Are you really sure it's rated for 120 VAC insulation strength? I'm not.

• Yeah, I wasn't really sure what to think of doing it. I wasn't going to do it without consulting experts like yourself though =) – Kyle Sep 21 '11 at 23:33

We used a Raspberry Pi to control AC power through a 5V relay switch, wired through the breadboard. The breadboard had no metal terminals on the bottom-- it was plastic all around. We experienced inconsistent behavior, but we found out that it was the RaspPi sending a 3.3V control signal, which wasn't always enough power to control the 5V relay.

We also had the whole system behind a 15A breaker (cut an extension cord into 3 parts, one that plugged from the wall to the breaker, one from the breaker to the relay, and the last from the relay to a standard wall receptacle you can buy from Lowes). This way, if we messed up somehow and the power ended up going back up the line, it would trip the breaker and not kill the electricity in our office.

As far as software, we used a Node.js on the Raspberry Pi to talk to a Socket.io server. The client maintains a persistent connection, listening for "pin up" or "pin down" messages over the socket. If it receives a message, it uses the pi-pgio npm module to control pin 12 of the Pi, which triggers the relay and turns power on or off on our receptacle.

## Ingredients:

• Raspberry Pi, running Ubuntu and Node.js, using the pi-gpio module
• Raspberry Pi GPIO pin header
• USB wireless card
• Extension cord -> Lowes
• 15 amp breaker -> Lowes
• Electrical tape -> Lowes
• Wall power receptacle -> Lowes

## Next steps:

• Transformer to convert the AC line to DC power (before the relay) to power the Pi
• Replace the Pi with an arduino and rewrite the socket client

In summary, yes, it is possible, and yes you can do it safely. Obviously, you need to be very careful handling any of this system when the power is plugged in. If you have access to anyone who's worked residential electric, it helps to ask their help, mainly as a sanity check and to give you the confidence to actually go through with it :)

Hope that helps, and good luck!

• It is impossible to tell what exactly that video is showing. Issues of live line power on a breadboard were never discussed, nor is it obvious in the brief view of the electronics. In short, the video is irrelevant, so it's just spam. – Olin Lathrop May 27 '13 at 21:22
• Hi Olin, I edited with some more details. Hope that helps! – mikermcneil May 28 '13 at 1:51
• "In summary, yes, it is possible, and yes you can do it safely." != "Obviously, you need to be very careful handling any of this system when the power is plugged in." # If something's safe, you don't need to be careful. // To make a class II device dangerous, you'd actually have to try. I'd be pretty surprised if someone would manage to accidentally get a lethal shock from a toaster (class I). A light bulb socket would probably be "class 0", 'cos you'd have to stick your finger in there. But mains voltage on a breadboard is either -I or -II, ie not safe. – Oskar Skog Mar 2 '17 at 22:42