Skip to content

The Ultimate Cheap DIY Media Center Device

2011 August 10
by Tedb0t

You might be in the same situation I was in: a big collection of music and other media on one computer, but the big speakers/TV are in another room—how best to get that media out there?  Here’s a DIY solution that will cost you less than $200 (and a little elbow grease) and still get you more features than any other prepackaged device can possibly offer.

I’ve experimented with a variety of streaming solutions, including a homebrewed Wii (which works exceptionally well with WiiMC), a Chumby (great in lots of ways, but not as powerful as a full-blown computer), and an AppleTV (which has still never even been plugged in since I don’t have any HDMI displays).

But since I use a projector as a screen, I can’t have it on all the time, so I needed something that can be remotely controlled.  Back when my Ubuntu server computer was in the living room and connected directly to the speakers and projector, I used mpd, the Music Player Daemon, to remotely control music playlists and playback.  Furthermore, there are a few extremely useful tools that so far can only be run on a regular Linux machine, which I’ll describe below.

So I decided I needed a new Linux computer out in the main room to do what I really wanted to do.  Here’s what I ended up with, which I’m currently extremely happy with:

  • Features
    • MPD music playback from SMB share.  This allows you to remotely control music playback from any other computer—even your phone!
    • Pitchfork web client for MPD
    • Pianobar, a Pandora server that can be controlled remotely
    • Shairport, which allows iTunes and some other software to send audio to your media machine.  More details below.
  • Hardware
This combination is startlingly cheap.  At the time of writing I paid somewhere around $175 for the whole thing.  Bear in mind this does not include a monitor of any kind; I am running it headless, though the Foxconn has both VGA and HDMI outputs, so it can be used with a TV or monitor of your choice!
Now for the fun part—setting it up.  This is going to seem long, and it is, but nothing is particularly difficult, and I have found the end result so far to be completely worth the hacking.
  1. Setting up the Foxconn box:
    1. Opening up the device requires removing the four screws (obvious), and using a credit card, guitar pick or spudger to get the side the rest of the way off (not obvious).  At first it will seem like it is more difficult than it should be, but persevere, and it comes off without too big of a hassle.
    2. Insert the ram.  Make sure it’s in all the way, or the machine won’t boot.
    3. Attach antenna.
    4. Attach a monitor; you’ll need it at least until you set up SSH if you’re going to run the box headless.
  2. Install Ubuntu (or your preferred flavor of Linux):
    1. Since we want to install directly to the SD card as though it were a hard disk, the easiest way to do this is with an external CD-ROM drive.  (I tried and tried to figure out how to just install the OS on the card from my existing Ubuntu box, but still have no idea how to make that happen.  If anyone has advice, please leave a comment!)
    2. Get the Ubuntu Alternate Installer, which I find to be MUCH faster and more effective on this machine (just less pretty).  Burn to CD.
    3. Boot the CD with the SD card out, and put the SD card in when the installer is ready to scan for installation drives. The rest of the install should be unremarkable.
  3. Install software (all from the terminal):
    1. sudo apt-get update
    2. You’ll want to give your computer a name on the network, since I don’t think the Alternate installer prompts you for it.  But it’s easy:
      1. sudo echo “myComputerName” > /etc/hostname
      2. sudo echo “127.0.0.1 myComputerName” >> /etc/hosts
      3. It may take some time for other computers on your LAN to recognize this hostname.
    3. Install SSH if you want to be able to remotely administer the machine:
      1. sudo apt-get install openssh-server openssh-client
      2. Henceforth, you can ssh into your box from another computer like so:
        1. ssh myComputerName
    4. You’ll need Samba if you want to mount an SMB share from another computer as I do: sudo apt-get install smbfs
      1. Make a directory to mount your share in, i.e. /media/myMusic
      2. Add this line to your fstab: //myserver/share/music /media/myMusic smbfs username=guest,password=guest 0 0
      3. sudo mount -a
    5. For mpd:
      1. sudo apt-get install mpd mpc
      2. sudo nano /etc/mpd.conf
      3. Change “music_directory” to /media/myMusic
      4. Comment out “bind_to_address” (so that clients from other IPs can connect)
      5. in “audio_output,” change “mixer_control” to “Master,” and uncomment mixer_type “hardware”.  This will allow mpd to control the system volume, so that changing the volume in any mpd client will affect anything else that’s making sound.
      6. sudo service mpd restart
      7. We’ll be installing Pitchfork as a client, but there are TONS of other clients for just about every operating system.  I use Theremin on my OSX machines, and MPoD on my iPhone.  Let me tell you, it is incredibly fun and useful to be able to control music playback from my phone!
    6. For Pitchfork, we’ll need git to clone the current repository and a LAMP stack:
      1. sudo apt-get install git apache2 php5 libapache2-mod-php5 php5-common php5-cli mysql-server mysql-client
      2. cd /var/www
      3. sudo git clone git@github.com:virgildisgr4ce/pitchfork.git
        1. (This is my repo of Pitchfork which was originally forked from cdecker.  I plan on adding some features to integrate Pianobar whenever I can!)
      4. cp /var/www/pitchfork/doc/pitchfork.conf /etc/apache2/conf.d/pitchfork.conf
      5. cd /var/www/pitchfork
      6. sudo chown www-data config
      7. sudo service apache2 restart
      8. Open http://yourComputer/pitchfork
      9. You should see the configuration for Pitchfork; I don’t think anything needs to be changed.
    7. Pianobar:
      1. sudo apt-get install pianobar
      2. This software is the newest to me, so I’m still beginning to figure out.  I’ll be adding more info when I have it going!
    8. Shairport:
      1. cd ~
      2. git clone https://github.com/albertz/shairport.git
      3. sudo apt-get install libssl-dev libcrypt-openssl-rsa-perl libao-dev libio-socket-inet6-perl libwww-perl avahi-utils pkg-config
      4. cd shairport
      5. make
      6. perl shairport.pl
      7. Now, if you look at iTunes on another computer on your LAN, you should see a speaker icon showing your new media box.  Try it!  It’s amazing!
      8. I’ve been looking for ways of sending system audio instead of just iTunes output; I may try some of the hacks, but so far I’ve been trying AirFoil, which works decently but is the only thing on this list that’s not free, and doesn’t have complete OSX Lion support (yet).
    9. That’s it!
This is all recounted from having just done it, so if I forgot anything or something isn’t working, please let me know!  Have fun!

Related Posts:


5 Responses leave one →
  1. Stelucca permalink
    March 17, 2012

    This is great! I was looking for exactly this kind of setup and am so happy to have found your detailed solution. Just a quick question about the setup: if I’m streaming all my music to the media center, would I expect it to negatively affect network performance if simultaneously connected to the Internet? I’m wondering if there is much advantage to getting a hard disk and physically storing media on there. Thanks again!

    • Ted Hayes permalink
      March 19, 2012

      Not sure exactly what you mean.  Do you mean streaming media solely from the internet?  That would depend on your internet connection.

      • Stelucca permalink
        March 25, 2012

        Maybe I’m misunderstanding the setup. I’m thinking about music streamed from a local device, stored locally. I understood that music in this scenario is being streamed over the LAN from one device to the Foxconn, e.g. Laptop –> Wireless Router –> Foxconn media center. If the wireless router is also serving several other computer connections (WAN), I was concerned there might be lags in music playback or internet connectivity. Or were you streaming the music directly to the media center directly, not routed through your home wireless router? Just wondering if with several other users on the network it might make more sense to get a hard disk for the media center.

        • Ted Hayes permalink
          March 26, 2012

          Say an MP3 is about 1mb per minute.  That’s ~17kb/sec or ~133kbits per second. A 100BaseT ethernet LAN has a bandwidth of 100megabits per second.  Nothing to worry about.

        • Ted Hayes permalink
          March 26, 2012

          Or, for WiFi, 802.11n has a maximum bandwidth of 600Mbit/s.

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS