2014-01-02

Buy a Smart TV. Or Make your own that does more for less?

(I'm not the first to write on this subject, I won't be the most informative either, but I need to get back into the habit of semi-technical writing so excuse this indulgence...)

New Year, New Minor Project

My father, bless him, decided a bigger TV was in order. He decided to get one that fits into the category "Smart TV" and, I won't deny, it's a clever box which can stream from internet and local network sources a variety of content provided the usual boxes are ticked about compatibility, codecs etc etc...

His estimate was this added a premium of £50-100 on top of the "dumb" TV cost for the same size. But insists the choice was down to picture, size of screen, thinness of frame. And I believe him...

Anyway, this freed up their old TV for which no in-house use could be found. So we brought it home with us. Now, what to do with a 32" 2007-vintage LCD...

Motivation, or Prime Cause

Back in the day, this section would have read "Because I can". But I'm getting older and (even) lazier these days, and even though something's ostensibly cool I still need to see some personal value before attempting - the range of stuff available today exceeds my goldfish-like attention span and, mayflower-like, expires before I can get around to it. That's enough cliched metaphors.

We've got a MythTV box next to the lounge TV, and have had it for 6 years. The biggest vote of confidence I can give it - and a mark of it's utility to the household - is that I haven't dared upgrade or replace it since a one-off upgrade in 2009, such is it's value. Nearly everything we watch is through the Myth box - one of my proudest parenting achievements is that the kids pretty much only get to see Adverts when they stay over with grandparents. Doesn't say much for my parenting skills, but at least I picked a winner with the Myth box.

However, the kids are older and we're down to about an hour a day when we can watch stuff WE want to watch without their comments or interference. Bit of a problem when it's a 2-hr Swedish Jumper Documentary masquerading as a crime thriller. 

As it's Myth'd, we can watch - separately - on our computers. But it would be nice to have a second spot in which we can BOTH watch something together, away from the kids...

Open Source Solutions

As an admitted casual dabbler in these matters (as I said, I've had no need to pay attention to the field since 2009...), I've been aware that XBMC has been around, and a sort-of competitor to my beloved Myth for quite a while. You won't travel far on t'internets looking for open-source media centre solutions before XBMC is mentioned, and you'll come across it far more frequently than Myth. 

Actually, the two solutions complement each other and take opposing approaches. Myth concentrates on bottom-up - being an excellent recorder, archiver, file manipulator box with (subjectively) a weaker front-end user interface. XBMC concentrates on being the best possible playback solution possible, with (subjectively) weaker capture and management capabilities. 

So rather than being competitors, per se, it makes sense for the well-equipped home network to have one of each (or, more likely, a MythTV server capturing and collating video, and a network of XBMC front-ends playing it back). 

This fits from a cost & power perspective too: a Myth box needs some horsepower (mainly for transcoding though - capturing video streams is fairly lightweight these days), plenty of storage and some expansion capability to host capture cards etc. XBMC, on the other hand, is a close approximation to the classic Thin Client model, needing modest hardware for playback & the user interface, and only enough storage to hold the OS and some metadata about the content available on the network. 

Enter Raspberry

Most intriguing of all are the results of the experiments of the hoards of bedroom coders with their Raspberry PI boxes. This is a remarkable little box - the power of a 8-9 yr old desktop machine combined with the hackability of a 80's era ZX Spectrum all at a (let's face it) disposable cost of £25 a pop (i.e. cheap enough that when you do make one go "pop" and release it's magic smoke because of a mis-wired GPIO experiment, you won't be sobbing for too long before managing to afford a replacement). 

Even better than this, the wonderful geeks have turned the whole thing into a pretty-much plug-and-play solution. I shall document it pretty fully here:

Build Your Own Smart TV

The ingredients:

  • A TV. Preferably with a HDMI socket, so something newer than about 2005 or so in a LCD format would be preferred. Bonus points if the manual mentions CEC or the manufacturer-proprietary renaming of such (VIERA Link etc etc).
  • A RaspberryPI. Model A or B will do, B probably works a bit better (more memory) and would be mandatory if you're intending to use a wired ethernet connection.
  • SD Card. 4GB minimum, 8GB or up preferred
  • USB WiFi Dongle. If you're not going to use wired Ethernet, that is.
  • HDMI Cable. 1M or less preferred. Substitute with RCA if TV has no HDMI, but then you'll need to do something about Audio too.
  • (Recommended) A 2-a 5V power supply for the Pi. You may be lucky and be able to use a USB output on the TV to power the Pi, but (certainly for a Model-B) a dedicated power supply is much more reliable especially when using a USB Wifi dongle.
  • (Optional) A TV Wall Mount Kit. Best for space saving installations.
  • (Optional) A case for the Pi. Not required, but recommended - some of the components on the Pi are vulnerable to being knocked off or damaged by mis-handling.

Minus the TV and wall-mount kit, the parts required should be around £50 (Total manifest for a Model-A kit with all optional components, from RS linked above, comes to £52) - less if you've got spare bits already like SD cards and various cables. This is around the "Smart TV Premium" level, not bad for DIY component solutions in this day of mass-manufactured discounts.

I also note that if you're intending to play back "native" recordings from MythTV obtained via FreeView / FreeSat recordings (i.e. in MPEG2 video format), you'll want to obtain a hardware decoder licence (MPEG2 Licence Key) for your Pi from the RaspberryPI shop. This will add £2.74 to the parts cost.

The Recipe:


  1. Take the SD card from the Pi and insert it into the nearest available computer. 
  2. Go to the New Out Of Box Software (NOOBS) Download link of the Pi site, and get a copy of the latest offline installer (~1.38GB, so get a grown-up internet connection to help you with this step. Alternatively try the net installer - "NOOBS Lite" - for smaller size, especially as we're going to only use a fraction of the software for our solution )
  3. Follow the instructions to format the SD card and put NOOBS onto it.
  4. Plug the Raspberry PI into the TV, attach the USB dongle and a spare USB keyboard (only needed during build & configuration). 
  5. Insert the SD Card into the PI, attach power, and wait
  6. At the prompt, select to install OpenELEC
  7. Reboot into OpenELEC & configure for your local environment. I'd recommend doing an update (System -> OpenELEC -> Update) to get the latest updates first, then doing configuration
  8. Don't forget to do a library scan to pickup metadata about what's on your network. Not absolutely required (you can select by file) but makes the interface so much nicer and quicker to navigate.
  9. Follow the instructions on the XBMC Wiki to configure MythTV as a Backend to XBMC

That's about it, really. I've elided a few details you can find for yourself, especially using the XBMC Wiki, as they'll be installation dependent but as a reference I got through steps 1-9 in about 90 minutes elapsed attention-span (omitting some longer delays for download time), and ended up with the following installation working well (see below for limitations and caveats) with about 8 hours total effort (3 of which were fitting the wall-mount kit for the TV):

For the Avoidance of Holy Wars...

NOOBS includes 2 Media Centre solutions. Firstly there's a full-fat XBMC install at pretty much current specs, about 2GB space required. I tried this, it seemed to work OK but the Pi add-ons (in particular the Web Browser) didn't sit right with me. After trying one - the Web Browser - I was unable to reboot the Pi back into XBMC because it'd cocked-up one of the boot loader files. This, along with the rather long boot times for XBMC, persuaded me to instead try the RaspberryPI-optimised OpenELEC build of XBMC which is also included in NOOBS.

For my money, it's lighter weight (therefore better fitted to the Pi), boots faster, and has all the features I can see myself wanting from a front-end, so whatever I've lost from the full-fat XBMC I won't miss. It's also survived several test "pull the plug" reboots of the Pi so far (a scenario tailor-made for SD card corruption). Your mileage may vary, choose as you will.

Controlling the Pi

One point I've missed so far is how to control XBMC once you're all installed. Several answers are available.

  • The worst option is to keep the keyboard fitted. Even if you've got a wireless keyboard (or a bluetooth one with dongle), I wouldn't recommend it - XBMC does work and everything can be selected from a keyboard, but it's just not made for it. 
  • Probably the cheapest if not most effective solution is to use the TV's own remote control. If your TV supports CEC, you should be able to use it to control XBMC as there's a CEC module built in. Despite my TV, Pi and Remote all claiming to support this (via Panasonic's "VIERA Link" rebranding), I've been unable to do so. I suspect either a non-compliant HDMI cable or (more likely) the TV's too old to properly support the full protocol.
  • For those of a hacker bent, there are GPIO-based IR Blaster solutions for the Pi to use existing or dedicated remote controllers
  • But by far the coolest option is to use either an iOS or Android Smartphone to obtain full control.  Both the official iOS XBMC App and the official Android XBMC App act as (very) smart controllers over your WiFi network, allowing search and direct selection of media from the app to playback on XBMC. 
If you don't like the official apps, others are available particularly on Android. The Yatse app works particularly well on my Nexus 7 tablet, for instance.

Caveat Implementor

One point I've omitted to mention so far is that as it stands it's all great and everything works with one exception: Because my Myth box is so old (v0.21), although XBMC can connect to it, find what channels it's got, what's recorded and what's scheduled (and also, presumably, schedule new recordings although I've not tried it) there's one limitation:

It won't play anything back from the Myth box. I can find it, select it, but when I look at the log I see the XBMC box is asking for recordings that the Myth box is refusing to admit exists. Ditto for watching LiveTV. I suspect a mis-match in protocol versions solved by upgrading the Myth box, but it'll be a while before we attempt that.

(I can't just upgrade Myth as the box is so back-level even apt-get update fails with unknown / retired repositories. So it'll need a re-build. Which will mean losing the database and all the recordings. Of all the Xmas stuff. So I'll need to transcode them first, or convince the family to watch them and delete them. Either of which will take at least a month....)

Ah well. In the meantime, there's always the ability to run BBC iPlayer on it...