The Smart Power Strip

A Web-enabled outlet tells you how much power an appliance is consuming and lets you turn it on and off remotely

5 min read
The Smart Power Strip

I’ve always been a big fan of home automation. My first project, back in the days of X10 controllers, let me turn off the lights in the living room from the bedroom. As handy as that was, it required a centralized computer that cost more in electricity than it could ever possibly save. That’s true for all too many home automation projects.

A Web-enabled four-outlet power strip would go a long way to solve that problem—you could turn appliances on and off remotely or on a schedule. And while we’re at it, shouldn’t it show how much power those appliances are using?

This month’s project is a smart power strip that does all that. One big caveat: The total build exceeds US $500, which is an insane sum for an outlet strip, no matter how smart it is.

Here’s another caveat: safety. Obviously, making a power strip is going to mean working with alternating current. You’ll need wire of the appropriate gauge. Make sure none is exposed, and be careful not to confuse signal lines—probably 20 gauge—with AC lines, which should be 14 gauge for a 10-ampere project. And of course, check your local electrical code. I got a very powerful reminder when an upstairs lighting fixture in my house caught fire because of improper grounding. Remember, AC power can kill within the blink of an eye.

The two main components of the build were a SheevaPlug Development module and a Phidgets input/output board with four current-sensing modules and two 10-A dual-relay modules. The Phidgets I/O board is a sweet little guy. Mine has eight digital inputs and outputs and eight analog inputs, which use a standard connector type that also supplies +5 volts and ground. The dual relays need a digital input for each relay (on or off), but they also need a certain amount of ”wetting” current—the current needed to break through any thin film of oxide that may have formed on the contact surfaces of the relay switches. That current is supplied by the analog input ports, so I ended up using six analog inputs (four current sensors and power for the two relay modules), four digital inputs (switches), and four digital outputs (LEDs and relays). One of the nice features of the board is that the digital inputs have built-in pull-up resistors, so you can just hook a switch up between ground and the input.

I first attached the relays and the LEDs to the Phidgets board to see if everything worked. The SheevaPlug was going to take a while to arrive, so I used my Mac as a stand-in. Once I had determined that the Phidgets board was alive, I took a standard square electrical box and drilled a number of holes around the base for four switches and four LEDs—I wanted to be able to see whether each receptacle was live by checking an LED next to it. In other words, the LED would be on if—and only if—the relay was active, even if the computer went nuts and started sending garbage to the board. I consider this a basic safety feature, and it’s easy to do by running parallel wires to the relay input and the positive side of the LED.

For me, every do-it-yourself project has a milestone, and this one will be remembered as The Build That Made Me Finally Buy a Drill Press. Using a hand drill, putting the first hole through the electrical box took three drill bits and 20 minutes of the most awful noise. A nice 12-inch (30-centimeter) drill press was on sale at my local Home Depot. With it, the remaining seven holes took about 20 seconds apiece.

Wiring up an AC receptacle makes necking in a VW Beetle seem easy. I took extra care to think out the wiring scheme, which I envisioned in two layers. Up at the top were the four individual neutral (white) wires for the plugs that led to the relays, two live (black) wires that ran to the plugs in common, and two grounds (green). As with most receptacles, you can choose whether to wire the two plugs in common by breaking a metal tab on each side. By breaking one tab and leaving one in place, I was able to supply the live wire in common to each of the receptacles while delivering individual neutral lines for each plug, allowing them to be switched individually.

smart strip

Photos: James Turner
SMART STRIP: Lay in wires for the buttons and LEDs first [upper left]. Mount an I/O board with sensors and relays [upper right] on a piece of wood—and make sure your enclosure is big enough [lower left]. If you wired correctly, an LED will light up when a plug is live [lower right]. Click on image for a larger view.

The second, lower layer has eight wires for the LEDs and five for the switches, along with plenty of cable ties. (I daisy-chained the ground wire on the switches to reduce the wire mess, something I should have done for the LEDs as well.) The two live lines ran to a common terminal strip that would also provide power to the SheevaPlug; the neutrals ran to the current sensors, then to the relays, and finally to another terminal strip. The grounds went straight to a grounding bar attached to the chassis. The LED grounds and switch grounds went to the input and output digital ground terminals, respectively. Finally, the LEDs went into the digital output ports in parallel with the relay control lines for the same circuit, and the switch lines went into the digital inputs. I kept things simple, with digital output 1 controlling the relay that energized the circuit measured by the sensor connected to analog input 1, controllable by the switch going into digital input 1.

A few weeks later, I was back at the drill press with a larger, specially ordered electrical box. One of the things you quickly realize about projects that move a lot of AC current around at significant amperage is that the wires are thick. Too thick, in fact, for the first box to still have room for the SheevaPlug. I had to pull all the components out and move them into a new home. I also special-ordered some bus bars, normally used for marine applications, to safely distribute the hot and neutral lines.

At last, the SheevaPlug came. It turned out to be a real joy, with the Debian Linux operating system, 512 megabytes of onboard storage, an Ethernet port, a normal USB port, a micro-USB port, and an SD slot. At full bore it draws 5 watts.

Rather than create a cross-compilation system for the ARM processor on the Sheeva, I installed the Gnu Compiler Collection and the Emacs file editor onto the device itself, and developed my software right there. I wrote a C-based program that interfaces with the Phidgets APIs to poll the switches on the outlets every 250 milliseconds to see if any have been pressed. If so, the program turns the relay on for that outlet and also for the LED. It further checks a first-in-first-out queue to see if any commands have come in, and every second it writes out the current relay settings and power consumption to a log file. I then wrote a Perl-based Web application that reads the last line in the log file every 2 seconds and displays the current relay settings and power usage, with buttons to send commands to the queue to turn outlets on or off.

Everything worked like a charm. I was able to surf to the power strip’s Web server using my iPhone and turn the outlets on and off from anywhere in the house. I could also look at the watts consumed and see whether anything plugged into an outlet was actually turned on. Still on the to-do list: Configure the outlets to be locked out at certain times (so that little Johnny can’t turn on his XBox when he should be doing homework, for example), and use the log file to graph power usage over time.

Like many DIY projects, this was enormously fun and educational but not tremendously practical. For one thing, the finished unit is pretty big, about the size of a small PC. It also was pretty durn expensive. I figure it will pay for itself in electrical savings in about 30 years.

This article is for IEEE members only. Join IEEE to access our full archive.

Join the world’s largest professional organization devoted to engineering and applied sciences and get access to all of Spectrum’s articles, podcasts, and special reports. Learn more →

If you're already an IEEE member, please sign in to continue reading.

Membership includes:

  • Get unlimited access to IEEE Spectrum content
  • Follow your favorite topics to create a personalized feed of IEEE Spectrum content
  • Save Spectrum articles to read later
  • Network with other technology professionals
  • Establish a professional profile
  • Create a group to share and collaborate on projects
  • Discover IEEE events and activities
  • Join and participate in discussions