[Tim] was looking for a way to control his power outlets using WiFi. He looked into purchasing a WeMo but he realized that he could build something even better with more bang for his buck. He started out by purchasing a five pack of Etekcity wireless remote control outlet switches. These are kind of like the WeMo, only they aren’t controlled via WiFi. Instead, they come with an RF controller. [Tim] just needed to find a way to bridge the gap between the RF remote and WiFi.
[Tim] decided to use a Raspberry Pi as the brains of the controller. He also purchased a SMAKN 433MHz RF receiver and transmitter for communicating with the wireless outlet switches. The wiring for the modules is pretty simple. There are only four wires. There are power and ground wires for each module. Then the transmitter needs two GPIO pins while the receiver only needs one.
[Tim] began with a fresh installation of Raspbian. He then installed Wiring Pi, which gives you the ability to interface with the GPIO pins in a way that is similar to Arduino. He also installed Apache and PHP to create a web interface for switching the outlets. The last step was to write some custom software. The software included a script that allowed [Tim] to sniff out the controls of his RF remote. The correct codes are entered into the “toggle.php” file, and everything is set. All [Tim] has to do now is browse to his Pi’s web server and click a button. All of the custom code is available via git.
More informations about the protocol used by the outlets (what does these codes means) ? There is already a lot of stuff like this. See https://hackaday.io/project/465-raspbox-home-automation-cloud for example of outlets using “Home easy” protocol.
Or you could use pilight, which has drivers for many many rf sockets and other devices. Works a treat for me and I wrote drivers for my kambrook rf sockets and my pet-training “beepy” collars.
I added the HTML shortcuts to tasker and now control everything from my phone!
The only real problem with these kinds of rf sockets is that there is no feedback – you can never be sure what state it’s in.
If you need feedback, there’s always X10.
I didn’t think X10 provided feedback, but I’m probably wrong.
While I’m on the topic, links to using CM17A, PL513 and TW523 X10 modules with Arduino.
http://playground.arduino.cc/X10/CM17A and http://arduino.cc/en/Tutorial/x10.
x10 also doesnt provide 2 way feedback. you need zwave/zigbee.
some models do.
bigger problem, trivially easy to ‘hack’. some would say the same for zwave/lo-pan but it requires much more sophistication and access to pull off. these things can be controlled by anyone.
Just constantly refresh them by resending the command over and over.
Standby power consumption of RF switch?
Has anyone an idea how power-hungry those RF switches tend to be in standby?
One of the applications those things are touted for is avoiding standby of electrical appliances, but considering there’s a solid state AC relay with all the snubbing around it and a power supply for a radio receiver (and the radio receiver itself, of course) — perhaps it exceeds the 0.5W standby of my TV: this application would be out, no?
Swithching a lamp on or off would be something completely different, of course.
I haven’t measured power usage (my switching is for convenience rather than energy saving), but my now-old-fashioned X10 modules use latching relays, so it only requires switching power when changing state. I hope the new fangled RF IoT ones do the same, otherwise they could be adding a Watt or two when switched on, as well as receiver power.
With a ‘feel test’, I would expect my HomeEasy sockets draw less than 1W.
If using a pi to control them, it would be wise to look at openhab or misterhouse to do the ‘everything but RF’ part of the job, to save reinventing wheels. Openhab was quite limited on the pi (I use mh but expecting to move to openhab as it seems to be more actively developed just now), but hopefully will be faster on the Pi 2.
Hey, Nigel — thanks for this data point: a “feel test” is already much more data than I’ve got :-)
Besides, I think consumption will vary wildly on device maker. Latching relays sound like the ideal solution, but I fear that they’re going out of fashion in favour of “solid state relays” (a glorified TRIAC or something more newfangled), whatever they do to leakage currents.
> my switching is for convenience rather than energy saving
This, of course stays a legitimate use. I was rather thinking of replacing a manual switch: that would only make sense if the machine behind it (TV, backup server) has a significantly higher standby power usage than the switch itself.
And if Okian’s fears in another post are still material, we’ve lost compared to the waste going into replacing the switches every couple of months anyway ;-)
But what of the rf listener part?
It is not about the relay, it is about the fact that you use a transformer less power supply. It will consume about the same amount of power whether you load it 0% or 100% of its capacity. Latching relay or not….
I did, about 1.1W, check here: http://www.electrobob.com/idle-power-consumption/
I would assume it is the same for all of them, the designs are rather similar.
The original X10 Appliance Module has a custom mechanical “relay”. Works a lot like those pens in which you press a button to extend or retract the tip. It’s driven by a solenoid only when a change of state is required, so no power is required by the switch otherwise. Off the shelf, you can buy “latching relays” that are held in either state via permanent magnets and perform a similar function, for about $5.
But it still has a primitive internal power supply that draws about 1W when idle. Most small switching power supplies draw at least 0.5W. If you really want to trim away every possible watt, you need to be able to switch multiple AC outlets per device.
Looking at the reviews for the outlet product, it seems these outlets tend to stop working after a couple of months.
Usually what happens is, in the instant of burning out an incandescent lamp will overload the SCR and burn that out as well. Probably HF voltage spikes that wouldn’t normally bother a lamp would do this as well (as in “lightning strike”).
Has this vulnerability been fixed in a different model/type, or will all remote outlets (SCR type, not relay type) burn out in a short time?
Most of them are relay based, but the cheap ones have small current capabilities. There is a fuse(most common i have seen is 4A) that usually blows with the incandescent light bulb. Also common for the cheap ones is to have a non replaceable fuse.
Woah, thanks a million!
Really, really nice writeup: you made my day.
As regards the fuse, the older RadioShack X10 models had a wire jumper on the circuit board that acted as the fuse. When one burned out, you could crack it open, see a pair of holes where a component might go, and note that there was a line of vaporized copper between the holes.
Solder a new wire across the holes and if the triac isn’t also burned out this repairs the device.
Just thought that might be useful…
The two kinds of outlets I have used had a 4A fuse that was soldered with 2 wires to the PCB. You could replace it, but it required quite a lot of work. I remember a friend having some early and expensive ones that had a user replaceable fuse.
I’m using something similar as an example of my Arduino web server project: http://www.awot.net/projects.html#rc-switch
http://www.pilight.org/ exists for some time now. Quite a good project. It does not yet support the WeMo though…..
And it allows to control a wide variety of devices + it has smartphone front-ends …
Thanks guys for checking out my post. Please leave a comment if you have any questions and I’ll do my best to help.
I built something like this a while ago. Gave in and purchased the Hue Lux starter kit. Yay 2 way communication!
The main advantage to this is you can control 5 power outlet for less then $35. It’s also fun to built it yourself.
build your own with 5 outlets for under $35 IF you already own a Raspberry Pi.
I have always wondered what it will be like with a near strike and lotsa e-switches and e-lamps to replace.
I long knew that incandescents were good at killing dimmers when they die. Just like dimmers kill AM radio with their filthy power.
Ive bought a few cheap wifi controlled power sockets off aliexpress.
That kankun even has a google plus group dedicated to putting openwrt onto the thing. For about $17 including shipping it really does show what a rip some of the other less featured products are.
The $17 is from aliexpress, where you can also buy 3 classical ones for the same money. But yet in a store they will cost double that. Let’s not forget the kind of prices and products each store has.
It is not fair to say that a well designed wifi controlled outlet is expensive at 30-40, because it is a different quality product. With the arrival of cheaper wifi connectivity you will get cheaper products, but I would not think that one costing under $20 is good enough quality, simply because it will take some money to put in a good relay, fuse and an efficient power supply.
A $10 per outlet 15A switch that does not blow the fuse when the light bulb goes down is worth buying over a $5 per outlet 4A that blows after one year.
I’ve built the same thing with my RPI, but also included a IR-transmitter, so I can control the TV :)
http://npham.dk/
If you want to skip the whole receiver and sniffing part of this, you can make your own codes for the outlets to learn like this:
http://hackaday.io/project/4298-autoflower/log/14215-reverse-reverse
Greasy does this mean you can set the outlets to multiple codes?
One problem I’ve found with the RF433 modules is “bit error”. I am using two to control aspects of my heating and hot water system. Occasiaonly the wrong switch gets triggered. On inspection it looks like there is only one bit difference between the control sequences for the two units. I am not sure if it is the wrong thing being transmitted or the unit is triggering off the wrong command. I am using a raspberry pi – so thiere is the possibility that the control strings are being altered by multi-tasking. I send three identical pulses at a time to try to avoid this.
Hello. What is the git url for the custom code associated with this project? Thanks.
Checkout the full project here: http://timleland.com/wireless-power-outlets/
Github: https://github.com/timleland/rfoutlet
i had made a web interface for this sort of thing for the uk. http://www.github.com/txt3rob/RPI-Control/ sure i need to do some bug fix’s for security but it still works
This is like the Pilet!
http://provotronics.com/