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:
Big Lots Outlets

Parts List:

Similar outlets on Amazon
And/Or here is an update, found the exact outlets at Home Depot: the indoor ones and also here are the indoor/outdoor ones. (Thanks Mr_Quagmire)

Compare that pricing to one unit of the Belkin WeMo Switch

Here’s a 315MHz Android-compatible transmitter/receiver on Amazon: SMAKN 315Mhz Rf Transmitter and Receiver Kit

All the code is on Bitbucket. That includes a simple remote control Android application (as seen in video).

And the brain it runs on (I used the Arduino Ethernet model, there may be better choices now…): Arduino Ethernets on Amazon

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!
Completed Circuit

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: {IP address}/outlet?outlet={outlet}&channel={channel}&state={state}

And of course the Android comes in with a basic UI over top of those URL permutations, so you can click a toggle button for all the outlets, rename them, etc.

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!
Wireless Remote instrumented

Feel free to provide critique or suggestions!

I can control an LED from my LAN now. No biggie. Next steps is to use this RF transmitter to send out on/off commands for these $6 Big Lots wireless outlets. And then… THE WORLD. I mean, an Android app. Anyone else have smart house technology?

via Facebook

North Korean satellite ‘tumbling out of control,’ US officials say

Trying to understand where they found their science-hating ‘officials’ to quote in this article?

“The officials said that it is indeed some kind of space vehicle, but they still haven’t been able to determine exactly what the satellite is supposed to do.”

Song Reader

Beck’s new album… is… sheet music…?

For About $20, Cardboard Bicycle Could ‘Change The World,’ Inventor Says : NPR

The video at the bottom of the story is great, highly recommended.

Hope he succeeds to mass produce it. I’d buy one!

Red State, Blue City: How the Urban-Rural Divide is Splitting America

I saw quite a few election maps that used a distorted map (as in the thumbail) to show population density, but my favorite is the version in this article which uses bar graphs.

Which one do you like?

xkcd: Math lol

Everyone’s doing Halo 4 campaign first? Well… okay. When are we gonna rumble online?

via Facebook

No line to vote! And there were a plenty of unused garbage cans, too… Benefits of a small precinct?

via Facebook

Additional values for HTML rel tags

Apparently there are some new rel tags I’ve seen flying around the internet. rel=me. rel=author.

I’ve noticed that a lot of the trust-worthy “social” sites starting using the rel=me tag instead of the disappointing rel=nofollow.

So I’ve made sure to update my homepage, and update a lot of incoming links too. Hopefully the shift away from every link having nofollow will benefit legitimate blogs and websites representing real people who don’t blogspam daily. At least I can dream. Rankings for my name in search engines have fallen pretty drastically recently. I’ll make a followup to this if I see a noticeable boost.