Electronic Design

Building A COM Express DVR

Building a system from scratch might be economical, but it’s often time-consuming. Building with standard components can speed up the design job significantly. Our latest project is a digital video recorder (DVR). This application is supported via a range of software packages like SageTV (see Building A Multimedia Home Control Center, Part 2) used in our multimedia PC. Bringing the full capabilities of a PC often means using a PC motherboard. There are compact versions like Mini-ITX boards but custom motherboards are often required to mean space and connector requirements. COM (computer-on-module) Express is one platform that can address this level of customization. In this case we used Kontron’s ETXexpress-PM module, a COM express system, to provide PC-level performance. COM Express modules cannot be used alone. They have only a pair of connectors to link on-board peripherals to connectors or devices on a carrier board. In our case, we take advantage of Kontron’s COM Express prototype board. This board is not designed for use in a product. Instead it provides designers access to all the peripheral interfaces using standard connectors such as Express card slots, PCI and PCI Express slots. It exposes USB and SATA interfaces as well. This is more than sufficient for our DVR project that requires an Ethernet connection, a PCI slot for the TV tuner card and a SATA hard drive for storage. The actual carrier board implementation would be significantly different and smaller than the Kontron prototype board. The project incorporates a Kontron ETXexpress-PM COM Express board, Hauppauge Computer Works’ Win-TV PVR-500 and Seagate’s 750Gbyte Barracuda (ST3750640AS) 3.0Gbit/s SATA hard drive. The PVR-500 has a pair of TV tuners. The incoming TV shows will be stored on the hard disk along with the operating system which is Ubuntu, a version of Linux. For this project we employ MythTV, an open source alternative to SageTV, that runs Linux. DVR Hardware The system starts with Kontron’s COM Express base board. The base board is part of a COM Express development kit that includes a COM Express board like Kontron’s ETXexpress-PM also used in this project. Of course the base board has a pair of connectors for the COM Express modules. It also uses a standard ATX power supply. The back panel connector suite matches the typical PC motherboard with serial and PS/2 ports, USB, Ethernet, video and audio outputs. Most of these are redirected from the COM Express connectors but there are a few items on the base board. It is, however, full of variety – there are sockets for LPC, x16 PCI Express, x1 PCI Express (two of these), and PCI. There are also parallel port, Compact Flash, IDE, and a pair of SATA connectors. There are two unpopulated SATA connector sites, an LVDS interface, and sockets for Express Cards. The board can handle an ExpressCard 54 or a pair of ExpressCard 34 units. The base board is designed to mount inside a standard PC case. The PC card sockets line up accordingly. The base board provides sufficient interfaces for most projects. Systems that require more slots are often better served by a standard PC motherboard. Likewise, many embedded applications will use only a few of the interfaces on the base board. For example, our DVR project only needs the Ethernet and PCI slot although it is quite handy to have the video and PS/2 interfaces. The ETXexpress-PM is normally delivered assembled and with memory installed. It is possible take off the heatsink and change the memory but this is not the typical mode of operation. The module has a 2GHz Pentium M with a Mobile Intel 915GM Express chipset. It can handle up to 2Gbytes DDR2-DIMM RAM that is also used by the integrated graphics system based on the Intel Graphics Media Accelerator 900 architecture. As with most COM Express modules, the ETXexpress-PM supports x16 and four x1 PCI Express links. There are 8 USB 2.0 ports, Gbit Ethernet, IDE and a 32-bit PCI interface. There is also AC’97 compatible audio available. The ETXexpress-PM module plugs into the base board and is then bolted down. This makes it ideal for rugged environments where reliability is key. The next step was to plug in the Hauppauge Computer Works’ Win-TV PVR-500 into the PCI slot. The PVR-500 is a dual NTSC tuner with a common cable input. It allows recording from two different channels at the same time. It appears to the operating system to be a pair of PVR-150 boards. Check out the WIN-TV HVR-1600 single channel NTSC/HDTV tuner if you want to record digital TV. I have not checked it with Linux yet but it does support Windows and Hauppauge has been very good with Linux support. I choose the PVR-500 because of its compatibility with a wide range of operating systems. The PVR-500 works with most versions of Windows and Linux. The package comes with the Windows drivers and support applications including DVR support. The Linux drivers and support used later are included with the Linux download. The PVR-500 MCE kit from Hauppauge includes an infrared remote control as well. The ETXexpress-PM comes with a built-in video adapter but we also tried out an ASUS PCI Express video adapter in the x16 PCI Express slot. This was more to check out the ability to switch from the ETXexpress-PM built-in support. The board also has composite video output that could be a required output option. In general, the VGA output would be sufficient for most monitors. The system can also be run as a headless unit if playback is done using another PC. Both the PVR-500 and ASUS video adapter can be installed on the base board at the same time. This type of system tends to consume large amounts of storage so we chose Seagate’s 750Gbyte Barracuda drive with a 3.0Gbit/s SATA interface. The ETXexpress-PM supports PATA and SATA drives but the SATA drives provide better performance. This is required for the DVR application since it must be capable of serving one or more video streams over the network in addition to recording two streams from the PVR-150. Our final system is spread out on the lab table. The base board fits into a standard PC case but this project was quick and dirty so we skipped this nicety. This looser layout was sufficient to test out the system. Ubuntu and MythTV My first try with a DVR utilized Windows and SageTV (see Building A Multimedia Home Control Center). The hardware combination is not much different than the current project. In fact, that software would run nicely on this platform as well. The alternative chosen this time is based on Linux. In particular, Ubuntu Linux. The DVR software is a collection of software called MythTV. I am not going to get into the nitty-gritty details of installing MythTV because this is better covered on Ubuntu’s forums and the MythTV website. There are a host of other websites that provide additional resources and help. That said, here are the basics. I used an external USB DVD drive to boot the Ubuntu 7.04 (nicknamed Fiesty Fawn) desktop CD. The CD is a “live CD” that boots Ubuntu. Linux applications like OpenOffice can be used directly from the CD. It is also possible to run the installation program. The installation program delivers one of the more refined Linux installations. It is fast. It has few configuration operations up front and handles details like disk partitioning well. Ubuntu detected the Hauppauge board and installed the IVTV drivers for this board. I also recommend that you manually configure the disk partition. Minimally you need a swap partition and a main partition. I reserved most of the hard disk for two additional partitions though. The largest (about 450Gbytes) was for recordings. The next largest (about 200Gbytes) was for recordings that I placed on the system. Given the large Seagate hard drive, this split was easy and it prevents the recording system from filling up the main partition. The latter partition can be eliminated if another network drive would be used for pre-recorded movies. The DVD drive was removed once Ubuntu was installed. I used the Ethernet interface to access web-based software repositories that have the latest version of software. I used the Synaptics package manager to install the MythTV components. The entire process was comparable to the Windows/SageTV installation of the prior project. The main difference was that the default configuration of SageTV configures Ubuntu to boot directly into the MythTV front end interface. Installing MythTV using Synaptics is as simple as searching for MythTV and clicking on the main package. Synaptics and the underlying package management system takes care of dependencies. In this case it installs support packages like the MySQL database server. MythTV has a modular architecture that includes a MythTV back end and front end program. The back end utilizes a MySQL database. The architecture allows multiple back and front ends running on different computers on the same network. In our case, all three run on the same PC. Still, splitting up the services has significant advantages. For example, the platform we built is sufficient to handle all these services but things get tight if additional TV cards are added to the system. Keep in mind that integration of all services on a single platform means the processor may be involved in playback at the same time as it is recording. In general, a 4 tuner system tends to max out a 3GHz processor. Multiple cores can help but bus bandwidth tends to be the main issue unless transcoding (conversion between different resolutions or formats) is being done as well. This requires additional performance that multicore systems excel in. As noted, configuration of everything on a single system is relatively trivial with Ubuntu and Synaptics. Likewise, splitting the back end/database and front end up is straightforward since the front end just needs the IP address of the back end.

For those setting up multiple back end servers, keep in mind that there is a single, common MySQL server that can run on the same system as one of the back end servers. Likewise, there is one master back end server. Front ends connect to the main back end server and can reference files on other back ends. The front end interface can be changed by selecting different “skins.” The same general interface is presented with different icons. The interface can be easily navigated using a TV-style remote control, keyboard or mouse. Selecting a recording for playback is as easy as moving the cursor over a list entry and pressing the select button. The overall interface is very good and improving but there are always improvements that can be made. The configuration menus. are easy to navigate but they tend to have a large number of options. This is great for the expert but confusing for the novice. Luckily the defaults are usually sufficient but an expert/novice control would be useful in future versions. Tuner Configuration Probably the most tedious and error prone part of the configuration was setting up the tuners. You need to select the board, scan for channels and setup the TV guide mapping. This process is only done once and it is possible to make modifications later but this is likely to be the place where novices will run into problems. This one area where products like SageTV have an advantage. Their setup simply asks for a zip code and whether you are using an antenna, cable or satellite connection. The configuration program can then fill in the blanks so you can then view the TV schedule. MythTV does the same thing but the process involves setting up an account and programs to get the schedule information. Remote Control Configuration If you can get by without a TV remote control then do so otherwise you need to delve into LIRC (Linux Infra-red Remote Control). You will also need a remote control device. A number of USB-based infrared or radio-based controller interfaces are available. Some are bundled with TV tuner cards like the Hauppauge board. LIRC is not part of MythTV but it is often used with MythTV or similar applications. LIRC setup is complicated by the need to edit almost half a dozen text files. The system includes a low end device driver and a translation application that converts remote control keystrokes to commands or keyboard keystrokes. It took me longer to get the configuration correct since you can map any key on the remote control to a key sequence that is sent to MythTV. The reason for the complexity is that LIRC is designed to handle any number of applications. Of course, once you get LIRC working it is relatively easy to use the remote to drive other applications. MythWeb and Remote Access MythTV’s front end interface provides access to all the MythTV features but it is not the only way to make use or control MythTV. MythWeb is a web-based interface to MythTV. I had to install the Apache web server before installing MythWeb. MythWeb plus Apache adds minimal load to the system. MythWeb can provide access to TV listings as well as a list of recorded programs, current recording status and other aspects of MythTV status and control. It is possible to setup new recordings and the search mechanism is easier to use than MythTV’s front end. Of course, MythWeb is typically used on a PC that has a higher resolution screen plus a keyboard and mouse making navigation easier. MythWeb does not have a playback facility but it is possible to view a list of recorded programs that have links to the media files. Setup VLC (VideoLan Client) properly and you can simply click on a MythWeb recorded program link to starting playing it. The VLC playback configuration is a little more work since you need to setup either an NFS or Samba file server so the workstation can access the media file. VLC is available for a number of platforms including Windows and Linux. One thing you lose when using VLC is support for commercial flagging. This feature is available on the MythTV front end. After a program is recorded its name is added to a queue that the MythTV commercial flagging program processes. It generates a file that marks the commercials so the front end can skip them during playback. If you use VLC then commercial skipping must be done manually or you could enjoy the commercials. One other service I normally include with a MythTV setup is the VNC (Virtual Network Computing) remote control program or its variants like RealVNC or TightVNC. These systems run a server on the host and a client on the remote control PC. It provides access to the graphical desktop. It tends to be an easier way to manage a headless machine. VNC can be setup to expose the main desktop where MythTV is running. It is also possible to serve up one or more desktops that are independent of the main desktop. There are a number of advantages to independent desktops especially since the resolution does not have to match the main desktop. The main desktop is typically 640 by 480 for SD televisions and higher for HDTV displays. Other Multimedia Content MythTV is known for its DVR support but it is not restricted to video. The system also supports streaming audio, still images, and even games. This is comparable to some other networked DVR systems on the market. The support for features like streaming audio is provided by optional plug-in modules. The icons show up on the menus if the modules are installed. Other modules include features like DVD playback and recording, generation of CDs or DVDs from recorded content, web browsing including access to NetFlix (if you have an account). Coverage of all the possible add-ons is an article all by itself. A More Complex MythTV Setup I have enjoyed using MythTV and actually have a distributed system that runs four tuners on multiple servers. All the PCs on the network running Windows or Linux are setup to use VLC and MythWeb. Some of the Linux PCs run the MythTV front end as well. I also run my Hauppauge MediaMVP (see Building A Multimedia Home Control Center, Part 2) on the network as well running the open source MediaMVP Media Center (MVPMC). MVPMC is comparable to the MythTV front end although significantly limited without the plethora of plug-ins that the MythTV front end has. Still, it can deliver video, streaming audio and still images. Setting up MVPMC requires an additional level of sophistication because it boots off a server. This requires a local DNS, TFTP and NFS server. It is a bit more complicated than setting up MythTV but relatively simple for anyone familiar with these services. It is easiest to setup the configuration on Linux but it is possible to do so under Windows as well. Of course, once you have the MVPMC up and running it is also relatively easy to set up a PC with Ethernet PXE boot support to run Linux and the MythTV front end. As you might expect, I’ve found this configuration to be easy to maintain quite robust. In fact, getting an additional PXE-based system up and running after the first one is relatively trivial. Of course, how many people have four or five TVs in their house? These days, more than you think especially as people migrate to HDTVs. I found my viewing habits changing as the system was built from a single tuner and a single playback platform to the distributed system. For me, four tuners seem to be the magic number as does the 500Gbyte boundary for recorded material. Recording conflicts rarely occur and 500Gbytes provides a couple weeks of recording history. We essentially have more material at our fingertips than we can possibly watch but it is easy to sit down and watch what you want when you want to. As any DVR user knows, fast forward and commercial skipping can compress shows to a fraction of their original length allowing more viewing variety. Turning It Into A Product While I do not have any intention of turning this system into a real product, the actual process is rather straightforward since all the design work is essentially done. The only necessary steps are to copy the portions of the base board design that we used (COM Express, power, Ethernet and PCI interface) to a PC board layout program to lay out a custom carrier board. This can easily be built using a third party system house. Turn around time could be a matter of days or weeks at the most. Of course, packaging may take some time as well. Upon delivery of the final system it is just a matter of utilizing the already tested software to verify that the implementation is consistent. Compared to a custom solution, this approach wins by a wide margin if time to market is the critical factor. Likewise, reduced costs may be available if a less expensive COM Express module would be sufficient. Ubuntu has desktop and server versions that are suitable for a wide range of embedded applications. It should be of interest to additional developers as well with versions in the making targeted specifically at embedded applications such as mobile devices. This project is one way to get started with Ubuntu. Related Links
Hauppauge Computer Works
Kontron
Linux Infrared Remote Control
MediaMVP Media Center
MythTV
RealVNC
SageTV
Seagate
TightVNC
Ubuntu
VideoLAN

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish