Build Your Own Home Automation Server for Cheap
Most of the text for this post is lifted from the script of my Pluralsight course about home automation. If you’d like a free pass to Pluralsight to check it out, please email me at erik at daedtech. But whether you check out the course or not, I’m going to describe exactly what I bought to get going with a home automation setup for, all in, less than $100. In the rest of the course, I describe how I also created a compact, RESTful home automation server that you can send commands to from the language/platform of your choice.
I personally have been doing projects with home automation for some time now, and have experimented with a variety of different home automation technologies. I’ve settled on the following setup as an introduction to home automation. I’m going to be using a Raspberry Pi to make a REST endpoint for home automation commands, and the programming will be done in Python. By way of hardware, I’m going to show you how control a lamp using X10 brand devices.
I chose the Pi because its small form factor and affordable price make it an ideal candidate for your home automation controller that won’t break the bank or take up a lot of space. I chose the X10 brand for the hardware because it’s been around the longest and tends to be the least expensive, making it a good choice for new home automation enthusiasts. And finally, I chose Python because it is the lingua franca of the Pi, the language of the X10 driver I’ll be using, and a perfectly good language for building a REST server. I am historically a C#, Java and C++ programmer, but I’ve picked up enough Python for this course to make a working endpoint and to show you how to do the same. You’re going to need hardware specifics, so I’m going to list the hardware here that you’ll need as well as some potentially helpful peripherals.
The first category of hardware that you’re going to need is the Raspberry Pi and all of its accessories. The Pi itself is easy to order, but you may not realize that you’ll need some other stuff to get going. The most important thing is a mini SD card that will function as the Pi’s hard drive. It doesn’t come with one on board. Also important is a power supply for the Pi, but you can use any Android phone charger interchangeably. I’ve bought an extra one for each Pi I have because it’s rather annoying to have to cannibalize one of my phone chargers. You might also want to get a HDMI or DVI adapter if you plan to plug the Pi into a monitor while you work with it, assuming your monitor doesn’t have an HDMI port. The Pi’s only video output is HDMI. Also, bear in mind that the Pi is going to need to be on your local network. I’m assuming for the purposes here that you’ll be using a network cable and do not plan to cover getting wireless networking up and running on the Pi. The course was not specifically about the Pi, per se. For a deeper dive into its capabilities, you should check out Jon Flanders course, “Raspberry Pi for Developers.”
Now for the X10 equipment. The first thing that you’re going to order is a part that is a wireless transceiver as well as an interface to a computer. To do this, it makes use of a USB cord. The reason I’ve chosen this particular unit is because there is a readily available driver for it and also because the Pi only has a USB connection and not the serial connection that other X10 computer interfaces use. I should note here that we will not, for the purposes of the course, be going the historical X10 route and sending signals over the home electrical. Here, everything will be wireless RF. And this particular part is going to receive signals that you send it from the Pi and transmit them to the other part that I’m about to cover.
The other X10 component that you’re going to need is a regular transceiver module, which, strangely, is around the same price as the computer interface transceiver. You are going to plug a lamp into this transceiver and it is going to receive the signals from the CM19A and turn its lamp on and off accordingly.
If you have none of these parts, the entire setup should cost you around $100. If that seems a bit steep to automate turning a single lamp on and off, take some comfort in the fact that most of this is a one time entry fee, so to speak, for home automation. From here forward, you can simply buy a single module for $20 or even less to automate additional lights or appliances.
Over the coming months, I will have additional posts going through more of the script from the course and talking about home automation. But if you want to get started quickly and have a Pluralsight subscription, the course will be a much faster route to go. And, again, if you don’t have a subscription but want to check out the course, then email me and I’ll send you a 7 day trial so that you can check out my course and any others you want. Happy automating!