Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful!

Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices.

Above all, be extremely cautious!

I can't stress this enough.

EDIT: For more information: http://tubelab.com/Safety.htm



Better yet: Don't connect your Raspberry Pi / Arduino at all to mains electricity unless you use an opto-isolator, or you have training in designing such circuits.

The usb relay is NOT designed for this! See the picture: http://www.circuitgizmos.com/products/cgu451/cgu451.shtml

In a device intended for hybrid hi/low voltage there is a clear gap between the high and low voltage components, and an isolation transformer or opto-isolator between them.


I have training in designing such circuits and I'd still use an opto-isolator.

This is not manufacturing. It's a one-off project. It's not a highly refined design. You don't have to worry about finessing a marginally lower build cost because of what it will mean in 10k unit quantities. Just use the opto-isolator.


You're overreacting!

An isolation transformer would be of absolutely no use here and the optoisolator would provide the same functionality that the existing relays on that board do.

I can't see how the PC board is laid out so I can't verify if there is inadequate separation between the control side and the isolated side of the relay (even so, you only need about 5mm separation to be minimally safe at 120V), but barring that, it's fine!

Yes, this particular device is not explicitly designed to deal with all the hazards of switching a high voltage load, but I don't see anything that leads me to believe that it's unsafe for that purpose.


Others have mentioned the Belkin WeMo, which seems to be the best solution for anyone who doesn't want to mess with circuits (though I have no experience with, so can't comment). Does anyone know if it is available in a 220v format?

But if you do mess around with RasPis or Arduinos for that, I can't stress how useful the PowerSwitchTail is http://www.powerswitchtail.com/Pages/default.aspx - you give it a low power signal, and it switches a high power one. They have a 220v version as well.


Thanks a lot for the link. I've been idly pondering a couple of projects that would involve switching mains power with a microcontroller, but didn't encounter anything like that at a price that made me want to consider it. You may have saved me from a fiery doom.


It's sold in New Zealand where I am, and we are on 240v.


LEDs would be much better suited for this.

In fact if I had the free time then I'd build a binary display for page hits using a series of LEDs on a Raspberry Pi (sadly I have a million other projects going on at the moment - such as finishing my website so I can get hits to begin with hehehe)


Indeed. For your own good, don't do this: http://palace-dci.sourceforge.net/images/electronics.jpg

Amazingly, I never had a single incident with that parallel port->breadboard+transistors+relays->lights setup from my high school days.


Pro tip: avoid hardware, stick to software. Just kidding.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: