Good day!
I recently set up a MythTV box in a room where several X10 modules are installed to help set the proper lighting in the room.

First off, if you don't know what MythTV is, think of it as an open-source, free TiVO. If you have the right components for a computer, and you have the right OS and software, you can have a MythTV box giving you DVR capability, even hi-def DVR, for much cheaper than TiVO or your cable/fibre provider's DVR (YMMV, naturally).
I am using the KnoppMyth linux release, which is the Knoppix liveCD remastered into a MythTV standalone/backend installer and a front-end liveCD (meaning you don't need to install it for just frontend use).
There's plenty of documentation about installing and running KnoppMyth, or MythTV in general, so I'm not going to bore you with those details here.

I have an old X10 Firecracker kit, which comes with a lamp module, a transceiver module, a remote, and an serial device known as a CM17A, aka the FireCracker. It's a small black adapter that plugs into a serial port on your computer. I have also installed several X10 wall switches for the room, so that the room lighting as well as a lamp are all controlled by the X10 remote. Lights can be dimmed, brightened, turned on or off. I don't have any appliances but in theory, you could get additional modules, and the sky is the limit (radios, microwaves, gas/electric fireplaces...).

There are three things I want to do to make this work:
1. Get control of the X10 serial adapter
2. Give MythTV the ability to control the device
3. Give my MythTV remote control that control as well

1. A working MythTV system, for TRUE ease of instruction-following use KnoppMyth
2. For step 3, you need a remote control
3. Some linux knowledge.
4. MythTV box needs a network connection to download files. If you can't provide this, download the appropriate files separately and copy to the MythTV computer somehow.

Onward, friends!

Step 1: Get Control of the CM17A X10 Serial Module

With the MythTV box booted up hit escape enough times to exit the MythTV frontend.
Once you're at the KnoppMyth desktop, right-click to access the root menu, select XShells, and then Xterm. I won't have a lot of screenshots, because a lot of the work you'll be doing for these steps is in the terminal... but I'll show some screenshots of key events so you know what to expect.
(Note, in order to make the tutorial readable, in various places I split commands across multiple lines with a \ -- the \ indicates to the shell that you are continuing the same command on a new line. This way, if you're copying/pasting commands out of the tutorial, you won't have any troubles pasting the commands that span across multiple rows.)

Once you're in the terminal, change to your super-user in order to install the modules you'll need to control the X10 devices. Typically the command is su, followed by the password.
sh-3.1$ suPassword:root@holodeck:/home/mythtv#

Change to a working directory of your choice for downloading a package and installing. Out of habit, I use /opt. You'll need to download this file:
root@holodeck:/home/mythtv# cd /optroot@holodeck:/opt# wget \http://search.cpan.org/CPAN/authors/id/B/BB/BBIRTH/ControlX10-CM17-0.07.tar.gz

When wget is finished, if there are no errors, unpackage the tarball:
root@holodeck:/opt# tar -xzvf ControlX10-CM17-0.07.tar.gz

It should display a list of files that were unpackaged. Change into the ControlX10-CM17-0.07 directory and read the README for more information on how to proceed. When you're done reading, here are the steps to follow to install the module:
root@holodeck:/opt# cd ControlX10-CM17-0.07root@holodeck:/opt/ControlX10-CM17-0.07# perl Makefile.PLChecking if your kit is complete...Looks goodWriting Makefile for ControlX10::CM17root@holodeck:/opt/ControlX10-CM17-0.07# makecp CM17.pm blib/lib/ControlX10/CM17.pmManifying blib/man3/ControlX10::CM17.3pmroot@holodeck:/opt/ControlX10-CM17-0.07# make testPERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.tt/test1....ok                                                                All tests successful.Files=1, Tests=29,  8 wallclock secs ( 0.02 cusr +  0.00 csys =  0.02 CPU)root@holodeck:/opt/ControlX10-CM17-0.07# make installWriting /usr/local/lib/perl/5.8.8/auto/ControlX10/CM17/.packlistAppending installation info to /usr/local/lib/perl/5.8.8/perllocal.podroot@holodeck:/opt/ControlX10-CM17-0.07# 

While you're the root user, run the next two commands to ensure you have all the serial port support in place. Trust me on this one.

root@holodeck:/home/mythtv/x10# apt-get update...root@holodeck:/home/mythtv/x10# apt-get install libdevice-serialport-perl...Setting up libdevice-serialport-perl (1.002-0.3) ...root@holodeck:/home/mythtv/x10# 

Next, you need to fetch a script to control the modules. For this we'll go to the MythTV-User mailing list and snag a script written by a person calling himself John, and posted to the list by Kenneth.
Use ctrl-D to switch back to the default user in your knoppmyth terminal, and use the cd command to ensure you're in the home directory. You can download the attachment to that email with the following command. Note, the flag to wget is a capital o, not a zero or lowercase o. The purpose is to rename the file to something useful, since otherwise it's just "attachment.bin" which doesn't do us any good. Link to the file below.
root@holodeck:/opt/ControlX10-CM17-0.07# exitsh-3.1$ cdsh-3.1$ wget -O x10-myth.tar.gz \http://mythtv.org/pipermail/mythtv-users/attachments/20060607/e3181c75/attachment.bin

Naturally, unpack the tarball, then change into the directory it makes:
sh-3.1$ tar -xzvf x10-myth.tar.gz x10/x10/mainmenu.xmlx10/x10.plx10/x10.xmlsh-3.1$ cd x10

Check that the x10.pl script is using the proper device for your serial port by opening the file with your favorite text editor and changing /dev/ttyS1 to the proper device (it might be /dev/ttyS0 or /dev/ttyS2). I had to change mine to /dev/ttyS0 to work. The only way to know for sure is to test them, so here's how.
You'll need to know your X10 devices' house codes and device codes. For example, my ceiling lights are A2, and my lamp is A3.

sh-3.1$ ./x10.pl A3Jsh-3.1$ ./x10.pl A3K

This turned my lamp on, and then off. Success! I now have control over my X10 devices! Just to be sure, I also issued a few commands to the ceiling lights, to be sure I could dim them. Here's a video:

So, we're good to go! Next step: Give MythTV control.
Hmm sounds like I might need to finish my Myth box and dust off those x10 modules :D If only someone could do an HD Myth box Instructable, I've been looking for some simple instructions on how to get one of those up and running.
If I ever figure it out myself, I will do one. I just recently got an HDTV and it's connected to the mythbox... I also want to get an IR blaster and get digital cable to the mythbox as well. I don't know if it'll be done by the time you need it, tho. Sorry. :)
This is great. Love it. Makes me want to go out and buy a buch of X10 hardware. With this type of setup, one could turn lights on and off all over the house from any myth frontend.
Sweet! I personally reccomend Mythbuntu -- it has an awesome control panel where you can do *everything* Install codecs/players, manage settings, file shares, etc.
I have heard MythBuntu is excellent, and I believe these instructions would be just as easy to follow or adapt under that distro as well. Knoppmyth happened to be what a friend of mine uses and recommended to me.
What's MythTV??
As I mentioned, &quot;think of it as an open-source, free TiVO.&quot;<br/><br/>So if the explanation in the Intro isn't clear enough, MythTV turns a computer into a digital video recorder for Cable, Satellite, or Fiber Optic TV -- as long as the computer has the right hardware and enough processing power. It's a very glorified VCR. :-)<br/><br/>You can go to <a rel="nofollow" href="http://www.mythtv.org">http://www.mythtv.org</a> to learn more.<br/>

About This Instructable


38 favorites


Bio: I am a graphic art hobbyist, web cartoonist, and wannabe electronics hobbyist. Other hobbies: cooking, baking, exercise, computers, video games, trivia, and some more I ... More »
More by technosapien: 3D Clips For Prescription Glasses Home-made Kale Chips Create a PDF (from ANYTHING!)
Add instructable to: