Internet controlled wireless high power relay outlet
Warning: This project could easily kill you. Improper high power design will lead to electrical fires, resulting in loss of life and property. This design is not tested by any recognized testing agency.
This project is at once very simple and very complex. I have done what I can to make the device safe. However, given the amount of power the amount of power being switched is up to 15 A at line voltages, the design of this project has made me more than a little nervous. The basics of this design are trivial. I mean completely trivial. Put a voltage on a pin and close a relay. The rest of the design is just interfaces, and part selection. Neither ended up being completely trivial. I will get to both in a moment.
But first I should answer why bother? Well why bother indeed. There are lots of home automation products in existence already after all. This is true, but switching a lot of power is not the most common design. Plus you are stuck with their software and way of doing things. My goal was to be able to turn on my heat (plug in radiators) with my cell phone or laptop. This way I could save energy while not at home but still have a warm apartment to come home to. Simple enough. On to the design process.
A basic design for a big high current relay that is switched can be found at SparkFun's website. However, I would like to point out how very unsafe the design they have is in spite of the big relay. The PCB should fail at high currents or at least get very hot... There are a lot of trace width calculators online but here is a pretty simple one. You can see for say a 15 A steady current the trace width on 1 oz copper is pretty large, at 30 A it is over an inch wide. Since all the power will be drained to a point the calculator is probably misleading in the it will still get hot near the hole though point.
PCBs are expensive in small numbers and I wanted to try something friendly like batchPCB which only has 1 oz copper so clearly these considerations preclude using the PCB for power. That leaves two options. One have a wire on the bottom of the PCB soldered directly to the pin, or use a different kind of relay. Enter the quick connect terminal.
There are a lot of choices out there for relays, which do you choose? I'm not sure I want to give advice. However, I choose a 5V TMP type relay from Panasonic that has a contact rating of 30 A, this relay has .25" quick connect terminals and coil pins for the control, just what I needed. This avoids sending any real power though the PCB.
Getting parts rated up to 30 A is not easy. My actual load was going to be 12.5 A. A lot of parts you can get are rated to 15 A though, so I designed there, getting higher power when possible. To protect the transformer from overload I added a PTC. They are pretty neat. Also I added a 15 A fuse to protect the system as some of my circuit breakers are 20A, and some of my parts are only 15 A. It wouldn't have mattered though if the breaker was 15 A, I'd still want local redundancy.
There are two rails at 5 V and 3.3 V and an XBee 2.5 series radio. The transformer is a 9 V 2.3 W (they say VA for whatever reason) transformer from Pulse. Basically that is it as far as hardware. I am going to come back and talk about hardware mistakes after I'm done with the software.
So the hardware and control signals are very simple. Get a logic one to a buffer transistor to put a current from a rail though a relay and turn on an outlet. Make sure the parts won't explode or melt at load and you are done. Well almost.
In my case, I wanted to control this relay from the internet. There are a lot of ways that might be done. Security considerations and dynamic IPs on DSL caused me to have second thoughts of having a server running. Having a secure webpage for controlling the outlets would be fine except for issues with WAP only cell phones and the fact that I'd be paying for the bandwidth. So I settled on email. Cell phones send text just fine. Thus my choice was to create an extra email account and use the body of the email as a command prompt. The basic idea is shown at left. The red is some random device that can send email. The blue is software that sits on a computer that has the wireless master controller on it. The green is hardware.
At present there is no real controller connected to the computer at my house and I simply am leveraging the fact that XBee radios with API mode do what I need. However, they are one of the largest costs for this design and I would like to get rid of them and also come up with a design that is more independent of the underlining hardware. I would like to at least remove the API firmware dependent part from the POP3 software so that it can be used more generally without having to rewrite it for each set of hardware.
This could be done by having an abstraction run on a microcontroller that takes friendly commands and manages the state of the nodes known to it. At present the state would be lost on power failure at my apartment. Having a managing microcontroller with values stored in EPROM would be a way around this. All this can be rolled together with replacing the XBees with a less expensive alternative.
In testing this design I found that heat sinking was needed for the LDOs. The 3.3 V rail draws only about 50 mA at most, so I was kind of surprised how hot it got. The solution to this was to not have the radios on all the time, which makes the average power used tiny. Goodbye hot 3.3 V LDO. The 5 V LDO there is no way around heatsinking it. You may notice I have two heatsinks back to back. That's because it still gets quite hot pumping out 0.8 W to the coil when on.
In retrospect I should have used a 12 V relay and a 12 V transformer and eliminated the need for one of my LDOs and its related heatsinking. Still as designed there are two thermal checks on current draw out of the transformer. The PTC and the thermal shutdown of the 5 V LDO.
Also in retrospect the PCB design could have been a light tighter and saved me some money. This was my first real PCB design (I did a handmade 1 layer PCB as an undergraduate) though so it was a learning experience. I made a couple mistake in the PCB but nothing hard to fix. I made the wrong pin out for a part in Eagle and had to bend it to make it fit the PCB. Also, XBees blow up really easily if you exceed the rated voltages... I realized my pin out for an external manual on/off switch, didn't have a resistor between the logic one level I'd be applying and the logic zero of the XBee pin. I would hope they would let you short high output to ground but given I blew up a radio while breadboarding, I decided to cut that trace and add a wire wrapped resistor. The external switch isn't attached in the picture at the top though.
Actually driving a 1500 W load for an hour, the box heats up some. Mostly, I believe because the fuse has to heat up to blow and 12.5 A is about 70% of the current rating of the fuse so it has to heat up a fair amount.
In quantity the design would be cost competitive with what is on the market though, and it does work so I consider it a success.