Android/Arduino RF Outlets Selector
Here’s a great little project I implemented with Arduino and Android – switching outlets from my smart phone!
I started with off the shelf RF Wireless Outlets. At $6 per outlet, they are a complete steal. I got lucky and found all 4 channels of these wireless/RF outlets at a local Big Lots. I’ve seen them at Home Depot too. And of course they’re available on Amazon. Compare that pricing to one unit of the Belkin WeMo Switch
315MHz Wireless Outlets –
Woods 13569 Indoor Wireless Outlet (3-Pack) on Amazon
Woods 32555 Outdoor Outlet on Amazon
- 315MHz Chip –
SMAKN 315Mhz Rf Transmitter and Receiver Kit on Amazon
- Arduino –
Arduino UNO R3 on Amazon
- Arduino Ethernet Shield –
Arduino Ethernet Shield R3 on Amazon
All the code is on Bitbucket. There is also a simple remote control Android / IPhone application available in the Google Play and ITunes stores. (Better looking than in the video, too!)
In the last year or so, there may be better options than Arduino for the brain, but that code rewrite will have to wait until another day. This is what the circuit looks like… very simple, just hook up the 4 pins of the transmitter to the correct place and you will be ready to load the code onto the Arduino!
The Arduino can hook up to your router via the Ethernet shield, and when it’s turned on will be running a web server at the URL:
And of course the Android and IPhone app comes with a UI added to those URLs, so you can click a toggle button for all the outlets, rename them, etc. See more about the App here.
I based the code on a cool outlet project that was pretty mature, called RC Switch, but in Europe the RF protocols and outlets are a bit different. There was also a reference from Instructables, but those RF on/off timings didn’t match my outlets. If you don’t have luck with my code as-is, modify the pulse length timings to match what is found here. There may be more variants that look the same, as a lot of these outlet modules look the same but are rebranded.
Reverse Engineering / Troubleshooting
Hopefully during the project you can implement it in a straight-forward way, but if the same protocol does not control the relays, read on to how I troubleshot this project originally…
To figure out the problem above, I used the Arduino as a logic analyzer to figure out what exactly wasn’t working, and that was probably the most fun part of the project. I soldered leads onto the stock wireless remote to spy on the signal that was being transmitted, and saw the digital signal graph on my TV screen. Amazing! As a programmer, I forget sometimes that there is electricity flowing through everything and changing direction every few nanoseconds.
This Arduino logic analyzer is a great open-source code project, and saved me big time here. It has 500 kHz max resolution, but since there is only 1kb of RAM, you’re limited to 1024 samples. That resolution was actually so good, that the first few times I thought it wasn’t working… I was zoomed in too far and didn’t see any transitions. As soon as I zoomed out to 1 kHz, I saw everything! And 20 kHz was finally the sweet spot to measure the timings accurately.
This is how I instrumented the remote control for use with the logic analyzer. I soldered many jumpers onto the circuit — only 2 carried the signal I wanted. The orange wire, and the right-most white wire both had the correct waveform — though the white one was inverted. I also provided power from the Arduino, since the remote had a 12V battery, some traces might have been carrying too much juice for the Arduino!
Feel free to provide critique or suggestions!