Stories about Software


Home Automation: The Socket Rocket

Introducing the Socket Rocket

A picture of the socket rocketIn the last post of this series, I covered adding a wall switch to a home automation network. Today, I’m going to talk about adding the “socket rocket”, or LM15A. It is commonly known as “Socket Rocket” presumably due to it fitting in a light bulb socket and I guess vaguely looking like a rocket or something. As you can probably deduce from its image, the socket rocket works by having a light bulb screwed into it and then being screwed into a normal light socket itself.

The socket rocket confers a few benefits on users. First, unlike the lamp module we covered in the first post and like the switch we covered in the most recent post, the socket rocket does not announce its working with a loud clicking sound. It turns its bulb on and off silently. Secondly, the socket rocket will work regardless of whether a lamp is controlled by the lamp’s switch, a wall switch, or both. This makes it quite versatile and extremely easy to install, requiring neither replacement of a wall switch, nor even location of the outlet into which a light is plugged. A third advantage is that a series of socket rockets on multi-light lamps allows more granular control over the lights than is possible without home automation. For example, if you had an overhead bedroom lamp with three light-bulbs, you could use socket rockets to have a setting where two of the bulbs were off and one was on. And, finally, the socket rocket can allow control over lights that are generally hard or annoying to reach. This may seem obvious, but an interesting possibility opened up here is the ability to place a lamp in some hard to reach location (up high or on a porch, for example) and control it remotely.

Read More


Adding a Switch to Your Home Automation

Last time in this series, I covered turning a lamp on and off with a keychain. Today, I’m going to up the ante and describe how to control an overhead light with your same keychain. This will be accomplished by replacing the switch for the light that you want to control with a new switch that you’re going order.

The benefits include not only the ability to remotely control the light itself, but also adding dimming capabilities to previously non-dimmable lights. In addition, their “soft” on and off behavior dramatically increases the lifespan of incandescent bulbs.


A few things to check off your list before getting started:

  1. The light to be controlled must be an incandescent light with wattage of at least 40. Do not use on fluorescents, halogens, etc!.
  2. You must have the transceiver from the last post or this will not work.
  3. Needle nose pliers, screw driver(s), wire nuts, wire strippers/cutters, voltage tester.

Also, and perhaps most importantly, you’ll need some degree of comfort changing out a wall socket. I assume absolutely no responsibility for what you do here. Working with home electricity can be very dangerous, and if you are the least bit uncomfortable doing this, I recommend hiring an electrician to wire up the outlet.

Making the purchase

The first thing that you’re going to need to do is order your part. You’re going to want to order the X10 Wall Switch Module (WS467). The price on this varies, but you can probably get it for anywhere from $12 to $20. It is pictured here:

I recommend this one because it will fit into the same space as most existing standard toggle switches. If you are looking to replace a rocker switch, you can order WS12A, which tends to be a bit more pricey, but such is the cost of elegance.


The unit itself will come with instructions, but here is my description from experience:

  1. First, remove the wall plate from the box just to peer in and make sure there isn’t some kind of crazy wiring scenario going on that may make you want to abort mission and/or call in an electrician. This might include lots of different wires using this switch as a stop along the way to other boxes or outlets in the house, for instance. Careful while you do this as your electricity is still live.
  2. Once you’re satisfied that the mission looks feasible, head to your circuit breaker and kill the power. Make sure power is off by using your voltage tester with one lead on the hot wire and the other on ground somewhere (if you didn’t figure out which was hot and which was ground, try both leads on the switch).
  3. Once you’re doubly sure power is no longer flowing, pop the screws on the switch itself that are holding it to the junction box and remove the switch.
  4. Your old switch should have two connected leads, and each of these should have one or more wires connected to each lead. At this point, you can basically just swap the old wireup for the new module’s wireup — the colors don’t matter (though I’ve adopted a convention with these guys of wiring black to hot). You’re going to need your needle nose pliers and wire nuts because unlike most existing outlets, the X10 have wires instead of terminal receptacles.
  5. Once you’ve twisted up the wires and made sure no bare wires are showing anywhere, settle the switch into the junction box and screw it back in. You’re now going to restore power at the breaker box.
  6. When power is back on, verify that pushing the button on the switch turns lights on and pushing it again turns them off. This switch will always be manually operable. Also, don’t be surprised that the lights come on more gradually than you’re used to (it may seem weird at first, but I love this, personally).
  7. Once everything is working properly, you can replace the wall plate. However, in continuation from our first post, what you’re going to want to do now is match the dials on the switch to one of the remote settings, in terms of house code and unit code, before you replace the wall plate. You can always change this later, but you might as well do it now while it’s already off


Now, you’ve got it installed, and it should work manually or from your keychain remote. Generally speaking, wall switches are always operational both manually and remotely. These are not rocker/toggle switches but pushbutton switches, so they have no concept of state. Each time you press the button either on the switch or from the remote, the command boils down to “do the opposite of what you’re currently doing.” That is, there’s no concept of manual or remote push overriding the other — it’s just flipping the light from whatever state it was last in.

In addition to this functionality, you also get dimming functionality. If you hold the button in instead of simply pushing it, the light’s brightness will change. Holding it in when the light is off causes it to ramp up from dim to bright, and the opposite is true when the light is on – it will ramp down. On top of this, the light will ‘remember’ its last brightness setting. So, if I turn the light on by gradually bringing it up from dark and then turn it off, the next time I turn it on, it will ‘remember’ its previous brightness.

One final note is that there is a manual slide below the main switch. This is, in effect, a kill switch. If you push that, you will completely break the circuit and no amount of remote presses or X10 signals can activate it in this state. This is the equivalent of unplugging your transceiver module from the last post. If power is cut, the signals you send don’t matter.


So, now you’ve got a remote control capable of controlling two lights in the house. One is a lamp and the other an overhead light that can now be dimmed and brightened manually, as well as turned on and off remotely. (Next time I install a switch, I will take some pictures of what I’m doing and add them to the instructions above).


Getting Started with Home Automation

I’m going to be doing a series of posts on home automation, starting out targeting beginner concepts and getting more in depth from there. My hope is that when these are complete, someone with some technical and home improvement acumen can read back through the series as an instruction manual of sorts.

What Is Home Automation?

Home automation is somewhat hard to define. Out of curiosity, I poked around and found as many different definitions as places offering definitions. The definition I most liked came from ehow:

Home automation [allows] individuals to automatically control appliances and security systems within their home through the use [of] technology.

Other sites talked specifically about the use of computers and various products, but this one is nice and general. To my way of thinking, home automation is the use of any technology that helps automate tasks in the home. This may include turning on lights, starting appliances, opening blinds, etc. So, anything from the “home of the future” to The Clapper can be considered home automation.

A Brief History

The concept of home automation has been around for a long time. In the early 1900s, the “house of the future” was the stuff of speculation at world fairs and in the studios of inventors. No doubt many interesting concepts came out of that, but nothing particularly interesting for our purposes here (though one might pedantically argue that appliances such as dishwashers or devices like thermostats are a form of home automation). As the 1900’s wore on, the concept of remotely controllable devices, such as televisions emerged, providing a relatively early snapshot.

In 1975, a Scottish company called Pico Electronics developed the X10 protocol. This was a way to use existing electricity wiring within a house for communication between a sender and a receiver. This protocol was used to transmit simple messages across the wire. A controller could send an “On” message and a device elsewhere in the house would receive this message and execute some appropriate action. For exmaple, a “lamp module” plugged into a wall and with a lamp plugged into it could turn on the lamp at the request of a signal sent from another room.

Over the course of time, the uses of X10 technology expanded from simple on and off to signals allowing control over home security, heating, air condition and ventilation (HVAC) and other home technologies. X10 is reliable and established, but it does have some limits, and those limits have become more obvious lately as the number of devices using house power have skyrocketed. Devices, especially modern ones tend to produce “noise” on the electrical lines, and the more devices we plug in the more noise is generated.

A number of other protocols and technologies have emerged as a result of this, including Insteon, Z-Wave, Lutron and more. And, there is still X10 itself, which is a little confusing as it is both the name of a protocol and the name of an organization that sells devices that implement the protocol. The newcomers tend either to use a different protocol over the electrical system (some being “backward” compatible with X10 and others not) or else to use wifi communication. Often these are more effective than the original X10, but also pricier.

For a time in the 80’s and 90’s, big box stores like Radio Shack and Home Depot carried X10 products, but that seems not to be the case anymore. Some of them now carry the higher end competitors such as Lutron and Insteon. But, if one is interested in purchasing any of these devices, you can find them in many places for ordering online, including ebay.

The fact that you don’t find these items for sale in big box stores does not mean that the home automation trend has cooled off, per se. As society expects more and more things to be automated, the home is no exception. The reason that these items are not carried so much anymore, in my opinion, is that the average consumer is not a combination of electrical engineer and carpenter. People want devices that they can plug in and have “just work” with a minimum of configuration. So, people hire contractors to wire these sorts of things up for them, rather than simply buying them at the local hardware store.

Our first crack at home automation..

So for anyone still reading, sold, and ready to jump in, I will introduce a first home automation project that you can execute as an absolute beginner. You’re going to buy two items, and it’s going to cost roughly $25 to $30, depending on where you order. One item is a keychain, and the other is an X10 “lamp module” with a wireless transceiver. They are pictured together here:

(You can buy this setup on Amazon for $30 at the time of writing, though a quick google search showed prices as low as $16, though that may be omitting a shipping charge).

When you get the devices in the mail, take out the lamp module and observe that it has a red dial on it. The red dial corresponds to the “house” code, one of 16 letters. All X10 devices have a house code and a unit code, and these together form the “address” of the device. The house code, as mentioned, is one of 16 letters, and the unit code is one of 16 numbers. This means that X10 addresses are A1, D12, J4, etc. Your lamp module has all available house codes, but only has unit codes “1” and “9”. These are the unit codes that it will respond to if you were sending commands over the electricity, but it will respond to any unit code sent wirelessly, which is how your remote will work.

If you now take out your remote and its instruction manual, you will see that you can set it to send signals to any house code and unit code. The unit code is essentially irrelevant here for your purposes. You just want to make sure the house code matches the lamp module’s. At this point in your home automation ventures, these are the only devices you have, so just leave them both at house code A.

Now, plug a lamp into the lamp module and the module into the wall. You should now be able to turn your light on and off using the keychain. The range on this should be comparable to that of your home wifi, so you could turn the lights on in your house from your car in the driveway or garage, which is handy.

So, to recap, you can basically just unwrap the devices and set them up without messing with the unit or house codes at all, since your lack of other home automation stuff means you don’t need to worry about compatibility. You now have home automation going for $25 or $30. If you’re interested in doing more, no worries – I’ll have plenty more segments on this.

More Info

For now, I’ll leave off with a series of links that I’ve found over the course of time that will hopefully be helpful, but not too overwhelming.

And, no worries if I haven’t covered all bases – I’ll have plenty more posts.



Android: Let There Be Internet!

I’ve been a little lax in documenting my experience as a neophyte Android developer, and for that I apologize. Tonight, I have a quick entry that will hopefully save you some time.

I’m working on an open source home automation server. I’ve had a prototype functional for a couple of years now that runs as a web server in apache, Java-based, and controls the lights through a web interface front end and a low level backend that interfaces with the house’s electrical system. I control this through any computer/phone/ipod/wii/etc that’s hooked to my home wifi, using the browser.

Recently, I’ve wet my beak a little with Android development, out of curiosity, and so my mission tonight was to take the layout I’d been working on and get it to, you know, actually do something. So, the simplest thing for me to do was have the app reproduce the POST request sent by the browsers to get the desired result. Here is the code I slapped together for this:

final Button myButton = (Button) findViewById(R.id.breakfastNookButton);
        myButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	HttpClient myClient = new DefaultHttpClient();
                HttpPost myPost = new HttpPost("you-get-the-idea");

                try {

                } catch (ClientProtocolException e) {
                } catch (IOException e) {

Not the prettiest thing I’ve ever written, but this is a throw-away prototype to prove the concept (though I’m going to refactor tomorrow – I can’t help myself, prototype or not).

So, I fired it up and nothing happened. I checked out the stack trace and was getting an UnknownHostExeption, which didn’t make sense to me, since I was using the home automation server’s IP address. I used the browser on my phone, and I could turn the light off. I googled around a bit and found a bunch of information about things that can go wrong with the emulator, but I’m debugging right on my phone since the Emulator is painfully slow.

Finally, I stumbled across a suggestion and got it right through some experimentation. I needed to give the app permission to use the internet! So, I updated my manifest to the following:


Important line is the “uses-permissions” node, and, viola, let there be dark! My light turned off. Hope that helps someone out there struggling to understand the UnknownHostException for a known host.

(Note, the node level in the XML file is important — it must be a child of manifest, NOT application).


Home Automation

Mea Culpa

As is alluded to once or twice on my sight, my main area of interest is in home automation. I’ve been somewhat mum about this interest in the blog, as my time over the last year has been spent refining this site, working on some open source tools, completing my MS degree, and, oh yeah, working 50+ hours per week programming to pay the mortgage. However, now that the site is somewhat established, business is good, and my MS degree complete, I’m planning to give this the focus that I’ve intended. So, I’ll be doing some posts about home automation in the hopes of drumming up some interest in the public at large in what I believe is a (too slowly) emerging trend.

What is Home Automation


Many people, and probably most techies, have heard of and are at least vaguely aware of the concept of home automation. The idea that most would throw out there is that one can control lights and perhaps some other goodies in the home without actually, manually getting up to toggle a rocker switch. A very simple example of this is The Clapper, a device that allows someone seated on a couch or bed to clap and turn lights on and off. A subtler example with which most are probably familiar is lighting in offices (or homes, as it were) that turns itself off after some amount of time or when nobody is detected in the room.

Generally speaking, the aim of home automation is to provide enhanced convenience, comfort, and perhaps security, with a sometimes ancillary goal of efficiency. It is nominally time saving to have lights turn on instead of walking around to turn them on, and it certainly appeals to anyone having a lazy day. From a security perspective, the ability to control lights remotely or have them turn on automatically is handy for creating the illusion that someone is at home when the house is unoccupied. And, having lights turn off in rooms not in use is certainly energy efficient, both in terms of cost and green concerns.

In reality, however, home automation promises to be and can be a whole lot more than this. I believe, personally, that the capabilities of home automation are limited only by our imaginations. But, I’ll get to see some of these later.

A Dream Deferred

In our society, we made some relative peace with the automation of all manner of processes. Computers, software and robots have obsoleted countless jobs while creating countless others. Having a land-line is starting to be considered passe, and sending “snail mail” is positively ancient. People don’t calculate square roots and cosines by hands, and the calculators that children use in school are really small computers that plot graphs and resolve equations. Why then, do we still turn lights on and off roughly the same way we did 100 years ago? And why then, does the notion of home automation evoke Rube-Goldbergian imagery in most people’s minds? Why is it that, like the flying car, the “home of the future” dried up in our collective consciousness like a raisin in the sun?

Home automation has long been one of those sci-fi things that never really materialized. I’ve read many accounts suggesting that it is over-engineering at its finest. Why spend a bunch of money on something that saves you the five seconds it takes to get up off the couch and toggle a switch? I’ve even brought up the subject and had it suggested to me that I was encouraging laziness – that the valuable exercise of toggling that rocker was the last line of defense between a tenuous grasp on health and a society where morbidly obese is the new thin.

Why It Has Yet to Really Catch On

I think there are a number of reasons that home automation has been slow in developing and capturing the world’s imagination. First off, unlike a killer app or the Sham-Wow, it requires multi-faceted expertise. Someone has to know enough EE to build the components, enough about home electricity to wire them up, enough about home improvement to complete any necessary carpentry tasks, and enough about programming to design and deploy the logic. Oh, and they probably have to be good with people as well, since these things aren’t going to install themselves. So, find me a person with all of these skills and an interest in putting them into what has historically been a non-starter, and you’ve got a major head start on the industry.

Another preventative factor is the current state of product offerings. Some years back, X10 emerged as a concept, allowing signals to be sent over home electricity, effectively allowing one appliance to send a message to another. Full of promise, this new technology took off to some degree, and stores eventually picked up (and, in most cases, later dropped) this line of products. As they proved too expensive and cumbersome for prime time, the outfits from which home automation hardware could be purchased took to the world of catalogs and infomercials (e.g. the aforementioned Clapper). This vibe still persists. A classy home automation site looks like a QVC catalog or Skymall, and a less classy one looks like some kind of MySpace nightmare potentially not safe for work (it is, don’t worry). This image is not lost on consumers that happen onto it – the whole industry feels like the “wave of the future” in the same way that the Chia Pet revolutionized gardening.

But, putting aside those respectively logistical and marketing concerns, there are some very bland business concerns such as price points and public interest/demand. In terms of the former, getting “classy”, non-DIY home automation has historically required hiring a contractor to wire everything up for very “classy”, non middle class prices. Basketball players and rock stars can have lights that dim when they say “computer, dim lights”, but you can’t. And, in terms of public interest, most people wonder if it really matters if they can turn off their lights from the couch, and they think of office bathroom auto-lights that turn out if you don’t wave your arms around every 30 seconds.

Getting Off On the Wrong Foot

Let’s forget all that. I don’t mean for the purposes of this article, but in general. The home automation movement is, I believe (and if I have anything to say about it) going to take off in earnest. Belkin and other non-catalog vendors are starting to take an interest. Green concerns are taking notice. The general public is slowly coming around. Pretty soon, things are going to perk up.

And, here’s why. It isn’t about turning your lights on from the couch. It’s about your home being intelligent and anticipating your needs the way your phone and computer do. It’s about pulling up into your driveway and having your home notice that you’ve arrived, unlocking the door, and turning on some lights for you. It’s about windows and doors that are smart enough to sound an alarm when they’re opened or broken. It’s about scheduling non-essential appliances to run at times of day when things are cheaper. It’s about heating and cooling your home not on a manual schedule, but on one that minimizes your monthly bill. It’s about a refridgerator that notices when you’re running low on eggs. It’s about getting an email or an alert on your phone when you’re due to change your furnace filter. It’s about walking from room to room listening to a Led Zeppelin song and having the music follow you wherever you go. It’s about keeping your pets off the counter even when you’re not home. It’s about putting an exciting new face on the thing that provides the most comfort and the most hours spent in life.

This deffered dream is going to exploded. But… in a good way. So, buckle up and get ready for a fun ride.