On Cheap Home Automation; Part 1

Inspired by a recent Lifehacker post, I wanted to write up one of my favorite hardware projects. (My less favorite hardware projects will also get written up…eventually.)

Home automation is not cheap. The more robust solutions tend to cost $40-$100 per device or switch. However, most of what the average consumer really wants out of home automation can be done cheaply with off-the-shelf parts - security goes out the window, so this is great for lights and fans but not recommended for locks and alarms.

I’m going to focus on how to do this with an Arduino but it’s substantially similar on the Pi. No soldering necessary if you buy a nice transmitter and receiver kit that’s already broken out in to pins. This approach also works for IR - just substitute a 38khz IR receiver and an 950nm IR LED for the transmitter (although some additional components will be necessary to drive the IR output high enough to get remote-like range.)

Before you get started…

  1. This is not a very in-depth look. I’ll revisit it later and will happily answer questions via e-mail.
  2. I’m assuming a moderately advanced level of Arduino and programming knowledge; I’ll cover more in part 2.
  3. Not every outlet kit works on 315mhz/433mhz; legality varies from country to country. The general principles are frequency-independent.
  4. Don’t disassemble, ever, the outlet - that is, the part that plugs in to the wall. High voltage AC is not a good weekend project.
  5. These instructions should be considered under the Apache 2.0 license.

What you’ll end up with…

Three (or more) outlets that can be remote-controlled from an Arduino. In a later article, I’ll write up how to build a simple remote control web service that will let anyone on your WiFi network (you, your guests, etc.) control your outlets.

Hardware

  1. Some kind of Arduino-like device. ($20; get an Arduino Uno R3 if you don’t have a preference, but really, anything will do.)
    • The correct programming cable for the Arduino is necessary as well.
  2. A cheap set of remote control outlets. ($varies; I find 3-packs with remote for $10 at my local Target around the holidays.)
  3. The correct transmitter and receiver. ($5-9; read on for how to figure out what you need.)
  4. Misc. jumper wires to connect transmitter/receiver to your Arduino. ($10 for several projects’ worth.)

Total: ~$50 to control three outlets. Note that outlet packs usually come in a particular “channel”: it’s possible to control every channel using one transmitter. The Target outlets (Westinghouse Command1 433mhz) come in four channels. This means that it’s possible to control 12 outlets (three outlets per pack times four channels) at ~$7/outlet.

Software

  1. The Arduino IDE
  2. The rc-switch library

Guide

1. Determine what frequency your outlets run at.

As mentioned above, there are a few bands that are in common use worldwide; 315mhz and 433mhz. (Anything advertising 434mhz will also work with 433mhz - the transceivers aren’t that precise.) I’m not going to go over the legalities involved as they’re quite complex - Linx Technologies has a nice writeup (here)[https://www.linxtechnologies.com/resources/documents/an-00125.pdf] that explains in a fair amount of detail what the FCC will and will not accept. Please seek out qualified legal advice if you are concerned.

There are three approaches to sorting this out.

1.1. Open up the remote (NEVER the outlets) and look at the transmitter.

90% of the time the transmitter will be a metal cylinder that looks like this: in this example, one of the product pictures shows “R433A” which (obviously) indicates this is a 433mhz transmitter.

1.2. Buy both transmitters and see which one shows activity

The rc-switch library comes with a simple test sketch called ReceiveDemo. Build a simple receiver circuit as shown here and test with a 315mhz and a 433mhz receiver. Whichever one registers a signal is the frequency of your outlet kit. I’ve also successfully used an oscilloscope and a logic analyzer to do this, but since an Arduino is needed later anyways…

1.3. Fancier equipment than I have

It’s possible to buy devices such as SeeedStudio’s RF Explorer; $99 to detect activity on certain frequencies. I can’t personally vouch for this approach but it seems sound, if expensive.

Coming Soon

  • Part 2: how to use the rc-switch library to sniff and repeat codes.
  • Part 3: building a web service to talk to the Arduino and a basic web application


comments powered by Disqus