Sun Ra - Column for 10/23

Sun Ra builds a Digital Video Recorder

For several months - pushing a year, even - I've been thinking about building a Digital Video Recorder. I.e., a TiVo, only not branded and one that doesn't phone home.

We don't watch much television. As a general rule, we'll watch the BBC World News at seven p.m. because it coincides with dinner, and/or the Nightly Business Report or Lehrer News Hour if we are running a bit late. Sometimes we'll watch the previous night's Daily Show when it comes on at eight. My wife likes to watch Gilmore Girls, Tuesdays at 8.

But that's about it. On the weekends I may flip on the History channel and/or the various Music Entertainment channels in the vain hope of something not Hitler-related in the first case or actual music videos in the second place. As I say, it's a vain hope.

There exist shows that we'd like to see. Studio 60 on the Sunset Strip. Lost. Battlestar Galactica. Various History channel specials. We are not, though, at all willing to base our schedules around them. So they come on and we're busy doing other things, and we never watch them.

Additionally, we have a child now, who will start to watch television in a while. And I don't want him being programmed by advertisements. So being able to skip them would also be nice.

Anyhow, as I say, I've been planning to build my own DVR for about a year. Why build my own? Well, for the simple reason that I don't want TiVo in control of, or even knowing about, what I watch.

From a financial perspective, buying a TiVo (or renting a DVR from the cable company) makes slightly more sense. A TiVo set-top box costs about a hundred fifty bucks. The subscription is twelve bucks a month, plus a second phone line, which I'm going to guess wildly and say will cost another thirty dollars a month. So, for a year of service, that's something on the order of six hundred fifty bucks. The cable company's box, without the second phone line, much less than that.

Whereas to build my own cost me over $800. However, I am in complete control of my box. It's phoning home to no one. (Well, yes, unless it gets hacked.)

Now, a good way to save some cash is to repurpose an old computer to use as your new DVR. I did not do this. I do have many old computers, but my old computers are old. So old they print onto stone tablets old. None of them have the chops to act as a media center. So I bought an entirely new computer to act as my PVR, or rather I bought the components and built an entirely new computer. I went with solid, middle-of-the road components, as cheap as possible without using technology that was close to obsolescence.

Here's what my new PVR consists of:

  1. Case: Antec Solution Series NSK2400 Black/Silver Steel MicroATX Desktop Computer Case - $94.99
  2. Motherboard: ECS RS485M-M (V1.0) Socket AM2 ATI Radeon XPRESS 1100 Micro ATX AMD Motherboard - $59.99
  3. CPU: An AMD Athlon 64 3500+ Orleans 2.2GHz Socket AM2 Processor - $89.00
  4. RAM: G.SKILL 1GB 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) - $119.99
  5. Hard drive: Western Digital Caviar 320GB - $99.99
  6. TV Tuner Card: Hauppauge WINTV-PVR-150 PCI Interface - $86.99
  7. DVD-ROM Drive: NEC 16X DVD±R DVD Burner Silver IDE/ATAPI - $32.99
  8. Graphics Card: GeForce 7600GS 512MB 128-bit GDDR2 PCI Express x16 ~ $130
  9. Keyboard: LITE-ON SK-1789/BS 2-Tone 104 Normal Keys 14 Function Keys PS/2 - $6.75
  10. Mouse: Microsoft Optical 1.1 D66-00029 White 3 Buttons 1x Wheel USB + PS/2 - $9.99
  11. Power Line Network Bridge: NetGear Wall-Plugged Ethernet Bridge XE102 ~ $60

I purchased absolutely everything from Newegg.com aside from the video card and the Powerline network bridge. My Newegg invoice was $633.03 with shipping, and the other gear was about $180, so in total I spent $813.03 on my all-new PVR. Ouch.

Let me run through the components:

  1. The Case. This was by far the awesomest, coolest, most swanky thing I bought. It's a marvel of design. It's a touch on the heavy side, being made of metal, and limited me to a DVD-ROM drive with a silver facing. But damn, is it an awesome case. The airflow is spectacular, with two huge fans silently sucking air out of the motherboard/CPU area. The drive bays sit in a removable cradle which lifts out and goes back in like a charm. The hard drives have special silicone-padded mounts to eliminate vibration. There are all the power cords I could want, coming from a nice 380 watt power supply. And it has internal cord routing, so the cords don't just lie splayed out around the case and on top of things but are easily tightened against the frame and kept nice, neat and out of the way.
    It's truly an awesome case. It only fits a micro-ATX motherboard, and is quite large for a micro-ATX case, but it uses that extra space to make things convenient, organized, and swanky.
  2. The Motherboard. I haven't build a computer since the early nineties. If you're like me, what you really need to know is that the motherboard - not the CPU - is really the heart of computer building. It's the motherboard that determines what type of each of the other components you can, and cannot, use.
    I bought this motherboard because it was a micro-ATX and would fit the case, and was very highly rated on Newegg. Additionally, it was using the latest versions of the various technologies to connect to the components. Let me list them for you: All of those specifications are important. If the RAM or the hard drive does not exactly match those specifications, it just won't work. So the motherboard really is the cornerstone of building a computer. In each case - RAM, hard drive, CPU socket - the specified connector is of a new and advanced type, so that if I want to upgrade components in three or five years, I will be able to find some that match.
  3. The CPU. This was to be a dedicated PVR box, so it needed a CPU of at least a certain power (say, about 1.3 Ghz) but really didn't need a high-end workhorse. I went with a nice inexepensive 2.0 Ghz Athlon, of the AM2 socket and 64 bit type so that if I want to replace it in a few years I'll be able to. Note that the exact CPU I used is already - two weeks later - not shipping any more. But there are more-or-less identical duplicates readily available.
  4. RAM. I made a mistake here. I wanted 1 GB, and figured I might want more in the future, so I bought a single stick. This was a mistake - two sticks of RAM are always faster than one, because they interleave. I should have gone with two 512KB sticks. That said, I bought a nice mid-price stick of RAM with a heat spreader. Single most expensive component I bought.
  5. The Hard Drive. It's about a Gigabyte of storage for an hour of television (low definition). So I went for a nice 320 Gig drive that was on sale at the time.
  6. The TV Tuner Card. The one new thing that an old computer must have to become a PVR. I went with Hauppage for the simple reason that I knew the Linux-based KnoppMyth I was planning to use as an operating system supported Hauppage. Then I just bought the cheapest model that came with a remote control.
  7. The Graphics Card. Another mistake here. The motherboard I bought has an on-board ATI graphics chipset. However, it only has a VGA out. In other words, it's great for a monitor, but I was planning to hook my PVR up to the old television and use that for a screen. So I had to buy an additional video card just to get the TV out, or in this case the S-Video out. (There is a dongle, which came with the card, that allows the S-Video out to convert to a standard TV out, which is what our wimpy little television requires).
    I bought a nice mid-to-high end video card, figuring that when we finally went to high definition television it would be nice to have a PVR that already supports it. Sadly, the card I bought, although working fine, has a noisy fan on it. So my otherwise whisper-quiet PVR is whiney, and I will have to replace that video card at some point in the future.
  8. The Network Bridge. I use powerline networking in my house, largely as a result of not wanting to spend the money to completely overhaul to wireless. So yet again, I spent a small amount on a powerline bridge to connect the PVR to my network rather than a large amount to convert all my existing networking to wireless. (Powerline works just fine, by the way.) The PVR must be able to get to the Internet to download the channel listings.
  9. The Rest. Cheap but not too cheap mouse, cheap but not too cheap keyboard, and an industry standard DVD-ROM drive that was available with a silver faceplate.

So that's the hardware. I ordered it on a Friday, had it all (in three boxes from three different warehouses) by Wednesday. I unpacked and inventoried it all, which is when I realized that the video on the motherboard did not have a means of connecting with our television. So I ran out to a local MicroCenter during the week and picked up the video card and the network bridge.

Friday night was assembly night. We had a friend over to help - he's a contract programmer at NASA who works on satellite simulators, and as much of a techno-geek as I am, only better at it - and we slowly put the machine together. Motherboard into the case, case wires connected to the motherboard, CPU installed on motherboard, RAM installed, hard drive connected, DVD-ROM drive connected, TV Tuner card seated and finally video card seated. And that was that.

Matching some of the case wires, for the front audio jacks and LEDs and whatnot, to their respective pins on the motherboard was the trickiest part. The rest was quite straightforward even with the minimalist instructions we had from the motherboard and case pamphlets.

Well, we had it all together and flipped the switch. And... it would turn on but not spin up any of the drives nor even load the BIOS. Tired, we called it a night.

Saturday morning I realized that we had not connected the auxiliary power supply from the case to the motherboard. I did that, and suddenly everything worked.

And I mean everything. It just worked. The DVD-ROM drive, the video card, on-board networking, etc. etc. Just worked. No having to update the BIOS, nothing.

So that was the hardware sorted.

Now it was time to install the operating system. My plan was to use KnoppMyth. Knoppix is a distribution of Linux which runs off of a CD. In other words, Knoppix is designed to be dead simple to use - insert CD, turn on computer. KnoppMyth leverages Knoppix to install the Linux OS onto your system with the MythTV program already installed and configured. In theory, once I put in the CD (which I downloaded as an ISO and burned earlier), in ten minutes I could be watching TV on my new PVR.

Yeah, it didn't work out that way. But, to be honest, it came fairly close.

I picked Linux, by the way, because I have a pretty decent layman's understanding of it - the server you are reading this column on for instance is my Debian box - and, of course, because it's free. I could have instead used, say, Windows Media Center, only they want something over $200 for that. Also, if I was going to build my own damn PVR, I was going to go all the way and use Linux. Because I am a techno-stud. Or at least, I want my wife to think so.

So, I popped the CD in and hit the first big software hurdle.

It wouldn't format my hard drive.

I was using a SATA hard drive (rather than the older style IDE), and for some reason the damn KnoppMyth drive just would not write to it. Said it had read-only permissions. Needless to say, the damn drive was blank and unformatted, being new, so WTF?

I let the KnoppMyth pamphlet be my guide. It was semi-helpful. Here's the part that turned out to be relevant:
Currently if you have an SATA drive, you must use Manual Install. You will see two options 1. Partition and 2. Quit, on a new drive or a drive with an invalid partition table. If you see six options, KnoppMyth recognizes the partition table. Either way, you must partition the drive. Select partition and create 3 partitions using cfdisk. The first will be /, the second swap, the third /cache and fourth /myth. I recommend 5 gigs for /, swap should be 1.5 times memory. Use the rest of the drive for /myth. Ensure /dev/xda1 is bootable, write the partition table and quit cfdisk. Once the partitions have been created, press . mkswap /dev/xda2 && swapon /dev/xda2. Format /dev/xda3 with the desired filesystem type. Once complete and return to the installation.

Now, I couldn't use the KnoppMyth disk to partition the drive. What I did was, I obtained GNU Parted, burned it to a CD, and used that to format the drive and create the partitions listed above. Then I told KnoppMyth to skip the partitioning part and just go ahead with the installation.

I ran the 'mkswap' and the 'swapon' commands... the 'mkswap' command worked but the 'swapon' one failed. Dunno why, went ahead anyway. This of course meant that for the entire rest of the software installation I believed that I had probably screwed things up irrevocably back at the beginning with that stupid 'swapon' command.

However, after the hard disk formatting snafu was resolved, the installation proceeded and went perfectly smoothly. I ran through the following:
You should now see six option. Choose 4. Load config. You should now see /KNOPPIX/knoppmyth. Press . If you have an SATA drive, change this to /KNOPPIX/knoppmyth-sata and press . Next, choose 1. Configure Installation. Provided the requested information. Don't create a user called "mythtv", this user has already been created with a password of "mythtv". Once back to the main menu, select 2. Start installation. Verify the information and sit back. Once complete, reboot the system. After the system reboots it will start X and KnoppMyth will open an Xterm and ask for the root password. See configuration.
And by God that all happened just the way they said it would. Even the 'sit back' part.

I got the Powerline bridge set up (which required connecting it to a different computer which had the Powerline software installed, setting the password on the new bridge because of course my powerline network is password protected, and only then moving it back and connecting it to the PVR) and the system got its DHCP address from my router on the first try. I had already gone to Zap2It and created an account, and KnoppMyth downloaded the channel listing and show times and was off and running!

Then it was done, and I was sitting in front of the main menu. Everything seemed to have gone perfectly. Even the remote control worked. I pointed it at the box and selected 'Watch Television'.

Static.

Snafu #2! For some reason, the PVR-150 was not decoding the cable signal, or some such thing. Much googling ensued. I tested various things and finally discovered that I needed the following line in my /etc/modprobe.conf file:
options ivtv tuner=50

Once I had that and rebooted, viola! I could watch teevee! Through my new PVR!

Except there was no sound.

Snafu #3! I plugged in the speakers but there was nothing coming out of them. Apparently the software used by Knoppix to do sound is called ALSA, which has utilities such as 'alsamix'. I tried fooling around with these utilities but to no avail. Finally I went to the KnoppMyth Wiki and found:
If your motherboard or sound card uses AC'97 sound hardware then you may find after booting your installed system that the boot message indicates that aumix could not load, and, executing lsmod as root does not display the sound card support modules. To fix this (at least in my case), as root, execute the command alsa_init with no arguments. This should indicate a successful install. When next you boot you should have audio modules loaded (confirm with lsmod executed as root again.)
Sure enough, after I ran 'alsa_init' and rebooted, I had sound! Hooray!

I ran through the rest of the install guide at the wiki, and since I am using a television set I made sure to edit /etc/X11/XF86Config-4 to include the lines HorizSync 30 - 50 and VertRefresh 60. Sure, it's a cheap teevee, but I don't want to destroy it.

And that's it! I now have a fully functional PVR. It records shows, has a channel guide, skips ads... all the good stuff. I'm still getting used to the MythTV GUI layout, but hey - it works! And it should expand nicely to larger televisions and/or better sound. The total time I spent from opening the component boxes to having a fully functional PVR probably adds up to about 10 hours, spread over a week or so. Some of it spent on dead-end solutions to the snafus I encountered. All things considered, it was a remarkably smooth and successful project.

- Sun Ra

Columns by Sun Ra