JARVIS Home Automation Control Center




Maybe it's due to spending an inordinate amount of time watching shows like Star Trek or Minority Report, but I've always wanted to be able to control my surroundings via computer.  Recently I've had a lot more spare time than spare cash, so I've decided to implement my dream home on the cheap.  This is my entry in the Hack It!, Make It Glow, and Mad Scientist competitions (after all, what's a mad scientist without a lair?)

Step 1: Components

The list of components used in this project is fairly short, and almost all of them are optional -- my system is modular, so things can be added and removed without causing mass hysteria and confusion.  The only component that is absolutely required for the control center to work is a computer to run it on.

The components I used (in no particular order) are:
- Mini ITX computer running Ubuntu Server 11.10 (Any low-power computer with serial and audio ports will work -- the processing power requirements are very very low.  In fact, it SHOULD be entirely possible to run the entire setup off of a router with OpenWRT installed  -- I just happened to have a spare system kicking around
- Eken M001 Android Tablet (This is my control panel.  If you want a tablet to use as ANYTHING other than a dedicated control panel, Don't Get This Model! The touchscreen and battery life are horrible, it's slower than molasses, and it runs a hacked version of Android 1.6 with most of the phone code still intact.)
-X10 Firecracker Module (This is what lets the computer talk to all the widgets you have spread around your house.  X10 modules are extremely cheap on Ebay, and are the least-invasive home automation technology I could find -- important for those of us who rent.)
-X10 Mini Transciever Module (Converts the RF signals from the Firecracker module to something usable)
-X10 Lamp Module ( Lamp modules have built in dimmers, so you can set your lamp to whatever brightness you desire -- however, they only work for lamps with incandescent bulbs.  If your lamps use something else, like florescent or halogen bulbs, use appliance modules instead)
-X10 Appliance Module (Appliance modules are for devices like coffee pots that are strictly on or off).
-Home Stereo System (Any stereo system with aux inputs will work)

Step 2: Setting Up the Server

The first (and most complicated) step is to set up a computer to act as the "brains" of the operation.  Luckily, "most complicated" is relative -- Ubuntu has made a linux distribution that just involves a lot of clicking "next" to get a fully functional system.  You can get the operating system, along with step by step instructions on how to install it, at http://www.ubuntu.com/download/ubuntu/download.  Since this machine is going to be a server, when Ubuntu asks you what packages you would like to install, make sure "SSH" and "Web Server" are selected.  SSH stands for "Secure SHell", and lets you communicate across a network to your system, without having to leave a monitor hooked up to it all the time.  The Web Server package contains most of the programs you will need to display your control panel -- it's just a web page, which means you can control your system from any device in your home which has a web browser.

Once you have Ubuntu set up, you'll need to install a few extra libraries on it so that the system has everything it needs to run.  Libraries are programmer-speak for "I've written this once, and it was really complicated to do the first time, so I don't want to have to re-write it every time I want to do something similar".  This is good for other people, as well -- many programmers release their libraries for free, which means that other programmers can concentrate on getting their programs to do what they want, rather than spending a lot of time writing libraries for network communications or displaying things on a screen.

In order to install libraries on a computer running Ubuntu, you need to use something called a package manager.  A package manager is a special type of program that looks on the internet for a package, downloads it, installs it, and manages updates.  The default package manager for Ubuntu is called apt, and is used by typing "sudo apt-get install packagename".
Note:  My setup has the webserver component and the control server running on two separate machines.  If you are running everything on one machine, just install all the packages on the same box -- it shouldn't make a difference.

The packages we will need to install are:

On the control server:
- bottlerocket (a program to let you talk to the firecracker module easily)
- mpd (Music Player Daemon -- a program that sits in the background and plays music back)
- python-mpd -- A library for Python that lets you run commands on MPD easily
- python-twisted -- a library for Python network communications 
- python-pysqlite2 -- a library to enable Python to talk to sqlite databases
- sqlite3 -- a very, VERY simple file-based database
- screen -- A program that lets you run programs in the background, and makes sure they won't close when you disconnect from the server.

On the web server, we'll be using another package manager called CPAN, in addition to apt.  CPAN is used specifically for libraries for the Perl programming language, and is ran by typing "sudo cpan packagename".
Using apt:
- libapache2-mod-perl2 -- This package lets the Apache web server run programs written in Perl.

Using CPAN:
- IO::Socket::SSL -- Secure Socket Layer, a secure network communication library
- CGI -- A library for letting Perl programs understand the information Apache sends to them
- XML::RSS::Parser::Lite -- This lets your programs understand XML documents, such as RSS news feeds
- LWP::Simple -- This library is used to retrieve things over the internet (also used in the News portion of the control panel).

Step 3: Configure the Control Server

To configure the server, you will need a self signed certificate and key pair.  Instructions on how to generate a self-signed certificate are available at https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html
In server.py:
edit the following lines:
listenport is the port you want the server to listen on for incoming connections
server_key is the location of the key you generated
server_crt is the location of the self-signed certificate you generated.

In components.py:
Most of this file should work as-is, although you will need to change the line that reads "serial='/dev/ttyS0'" to point to the actual serial port you have connected the Firecracker module to.  If you only have one serial port, the default should work fine, although if you are using a usb-to-serial adapter cable, the port will be /dev/ttyUSB0.

Once you have the control server configured, to run it just type "screen python server.py" at the command prompt.

Step 4: Configuring the X10 Modules

There are four different basic types of X10 modules used for this project:
- Firecracker serial port interface module -- this is a RF transmitter that connects to your computer
- Mini Transceiver module -- This module is an appliance module that converts the RF signal from the Firecracker into commands sent out over your houses wiring.  It will always be device 1 on whatever house code you select
- Lamp Module -- This type of module uses a built in dimmer switch to set the brightness of an incandescent lamp connected to it.  DON'T USE IT WITH ANY OTHER KIND OF LAMP -- you could end up frying the module, the lamp, or both.
-Appliance module -- This module is for appliances that only need to be turned off and on, or for non-incandescent lamps.

X10 modules all have an address, to allow you to control a specific device.  the address consists of a house code and a device number.  You can have up to 16 devices on a single house code, and up to 16 house codes.  To set the house code and device number, just stick a dime in the dial on the front of each module, and rotate it to the right setting.  It's worth noting, however, that you will need an additional transceiver for each house code, as the transceiver will only talk to modules that it shares a house code with.

Connecting devices to your X10 module is dead simple -- plug the module into the wall, and plug the device into the bottom of it.  The modules that I have only work for ungrounded devices (two prong plugs instead of three prong) -- I'm not sure if they are all this way, or just the ones that I have.

Step 5: Configuring the Web App

Do NOT, under any circumstances, set up port forwarding so that you can access the web app from the internet -- it has no security or authentication of any kind, and if someone (for example) turned your coffee pot on while you were on vacation for a week, or started blasting your stereo at three in the morning, you likely wouldn't be very happen about it.  You have been warned!

You will need to make sure you have mod_perl enabled on your web server installation.  You can find more information on how to do this at http://perl.apache.org/docs/2.0/user/index.html.

Once mod_perl is enabled, copy the attached files to your document root directory -- on Ubuntu, this is /var/www/.  You will need to make sure that index.cgi is executable, by running "chmod 755 index.cgi"

Very little configuration is needed here -- simply change the $serverport variable (currently pintsize.local:8635) to point to the server and port the control center is listening on.  If you are running everything on the same machine, you can set the server name to localhost.  If you wish to change the RSS feed the news tab pulls from, change the $xml variable in the listRSS function to point at your preferred feed.  You should now be able to connect to your web app with a browser, and see it in all it's empty glory (you'll need to actually ADD things to it using the config screen before it's very useful).

Step 6: Set Up a Control Panel

This is most likely the easiest step of all -- I had a cheap (both in quality and price) Android tablet kicking around, without any clear purpose in life.  I glued 4 rare earth magnets to the pack of it and attached it to my fridge.  All that is needed here is to open a browser and point it to your installed web app.

Step 7: Other Ideas

- If you have a Roomba vacuum cleaner, it would be fairly simple from a software perspective to add it.  I have stubbed in functions for this, but unfortunately I wasn't able to get the wireless link working in time to include it.
- Add scripts/scheduling -- eventually I'd like to be able to set up (for example) a script to make sure I've turned all my lights off after I leave for work, or a script to start a pot of coffee when I'm on my way home; however, I ran out of time.



    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    14 Discussions


    4 years ago

    I found an offline app that is called Utter. it runs in the background, I think you can use this for your control panel...

    or you can use it conjunction with the Web app

    1 reply

    Reply 4 years ago

    I think you could also use FTP/SFTP program tool on phone or tablet.
    there you could place all your commands and such and use Utter to access the server


    4 years ago

    is there a way to make this voice controlled too?


    Reply 5 years ago on Introduction

    It's basically just a remote control for your house -- it ties together a bunch of separate command-line programs (bottle rocket, mpc/mpd) and adds some functionality (persistent station list for mpd, device aliases for bottlerocket) along with news reader and "todo list" functionality. I did develop a speech-recognition client in C#, since SAPI is far easier to use than any equivalent linux-based recognition technology I've seen, but not until long after I'd posted this instructable (and I've modified that solution to the point that it's no longer compatible with this first version of the software).


    Reply 5 years ago on Introduction

    Right, it isn't an AI, and this part of the system isn't even voice controlled -- it's just a web app.


    Reply 5 years ago on Introduction

    I'm not sure how I would take a video of it -- essentially, you just push a button on the touch screen and music starts or stops, or a light turns on or off.

    As far as price -- I purchased an X10 Firecracker kit from Ebay, which came with an appliance module, a lamp module, a transceiver module, a remote, and the Firecracker computer interface for about $50; I also picked up a few more appliance/lamp modules plus some Socket Rockets (things that screw in between a light bulb and the socket to let you control overhead lights) for about another $40 total. The tablet can be any cheap android tablet from aliexpess.com or dx.com; if you shop around you can likely get one for under $30 (assuming all you want to use it for is a basic control panel, anything that runs a web browser would work).

    The computer that controls everything was also under $100, but I bought most of the parts at a "going out of business" sale. It's just a 1.6ghz atom processor on a Mini ITX motherboard with 2gb ram and 80gb hard drive space.


    5 years ago on Introduction

    How much did all of this cost you overall? I don't mean when you decided to make the JARVIS System, but all of these components, what would be the average price?


    7 years ago on Introduction

    I have to admit you beat me to it. I've been hoping to build this for a couple months now with the exact name (JARVIS from Iron Man) I always loved that movie. I'm planning to set one up on an old junk machine running Arch Linux and maybe add in some Kinect-like capability. Hopefully it'll be working soon but its in very early planning stages. I hope you enjoy your new system and I'm sure I'll enjoy mine.

    P.S. if you ever decide to add kinect to yours I'd love to see some tutorials on here!