SoWe used a Raspberry Pi to control AC power through a 5V relay switch, we just did thiswired through the breadboard. At least with our The breadboard had no metal terminals on the bottom-- it was plastic all around. We experienced inconsistent behavior, everythingbut we found out that it was okthe RaspPi sending a 3. It does seem3V control signal, which wasn't always enough power to mess upcontrol the pin holes after5V relay.
We also had the whole system behind a few uses15A breaker (cut an extension cord into 3 parts, but I guess it's safe.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. I mean sort ofjs 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. I mean take this with If it receives a grainmessage, it uses the pi-pgio npm module to control pin 12 of saltthe Pi, which triggers the relay and turns power on or off on our receptacle. Anyways here's
Here's the videofinished product: https://www.youtube.com/watch?v=OmcQZD_LIAE
Ingredients:
- Raspberry Pi, running Ubuntu and Node.js, using the pi-gpio module
- Raspberry Pi GPIO pin header
- USB wireless card
- 5V Relay -> RadioShack
- Breadboard and cables -> RadioShack
- 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!