Saturday, February 2, 2013

Web connected outlet - part 4


Connecting the pieces

This is the dicey part.  Dealing with 120VAC is potentially lethal. So, if you don't know what you're doing, don't do it. You've been warned.

So far, I've cobbled together a transistor switch that will allow a GPIO output pin to open and close a relay. I wired it up on a little Radio Shack project breadboard and tested it with 5V on the relay and a 3.3 V signal.  I've loaded the software on the RPi and demonstrated that it controls the GPIO.  I tested the breadboarded relay with the GPIO software just to hear that satisfying click one more time...

Danger, Will Robinson!

 When you're wiring up the circuit to the mains there are some things to be careful of:
- separate the low-voltage and high-voltage parts of the system as much as possible.
- insulate the high-voltage parts
- include a properly rated fuse to keep the house from burning down if there's a problem
- solder everything together - don't just twist wires together and wrap them in electrical tape...
- tie down any loose wires and bolt the components to the case
- remember the wiring codes / color codes for your location - they're there to protect you. In the US, black is hot, white is neutral and green is ground.  On electrical cords and sockets in the US, the wide spade is neutral (wide/white/neutral is how I remember it) and the narrow spade is hot. The round pin is ground.
- protect the system from poking fingers and pets (put it in a box)

I've hacked apart a small 5V 2A supply from a wall wart that was used for some equipment that's no longer in use and shortened the mini-USB cable to hook up to the RPi.

Exciting Video:
Test setup on the bench
Here's a link to a video of me switching on and off a table lamp. Before you watch this, you should sit down and scooch toward the edge of your chair - just to be prepared. It's riviting stuff. http://youtu.be/69POMqXjwls

I didn't have a plastic case that will fit all the pieces, so I ordered a couple of plastic project cases from Amazon.  I'll box it up when they arrive in a week or so. (I'll drill some holes in the case so the RPi can breathe.)

While I'm waiting, I'll get this hooked up to the WiFi network - I've just been using an Ethernet connection for the testing.  I'll discuss this next time.

No comments:

Post a Comment