Thursday, August 21, 2014

Raspberry Pi DVR - Software

In addition to the hardware for this project, I'll need software to make it all work.  For all intents and purposes, the only OS that runs on the Pi is Linux - which is fine by me.  I first learned Linux back in college only a few years after the OS was created.  Yes, my Linux "skills" are no where near my Windows "skills," but I know enough to be effective in the OS.

My ultimate goal is to create a DVR, so to make that happen I need TV recording software.  So far the only software I've found that supports this task is "tvheadend."  If I go with my stretch goal of a full-blown media center, then I'll need a software package to play videos and media content.  Here I have several options, but in truth there is really only one contender - XBMC (soon to be renamed "Kodi").

Linux is different than Windows in that you can get Linux from many different sources, each source being custom tailored for a different use.  Each of these different versions is called a "distro."  For the Raspberry Pi I have 5 different distros that I am considering.  One may work better than another with the hardware I have and the goals I'm trying to accomplish.  So my plan is to try all 5 distros and report back on each.  I'll blog about each distro in a separate page as I test with them.  But here's an overview of the 5 distros I'm going to try.

Raspbian
Raspbian (a.k.a. Wheezy) is pretty much the default OS for the Raspberry Pi.  If you're looking to use the Raspberry Pi as a general computer; web surfing, checking emails, word processing, programming, etc. then you'll most likely use Raspbian.  It has a friendly graphical user interface along with support for a lot of hardware and software packages.  My guess is all new Pi owners should at least start here, to get a feel for how the hardware and software works before moving onto more specialized options.

Raspbmc (soon to be renamed OSMC)
As stated above, XBMC is the preeminent media center application for the Pi.  Whereas you can install and run XBMC on Raspbian, with so many resources used by the OS it sounds like it will run sluggishly and/or have issues.  Enter Raspbmc - one of several distros dedicated to running XBMC on the Pi.  Raspbmc is built on top of Linux, but it is built specifically to run XBMC.  Anything in the OS that is not needed by XBMC has been removed.  What's more, the creators have taken the time to add drivers and support for hardware specifically used by media centers.  Hardware like TV tuners, remote controls, etc.  The trade off is these media center distros are not general purpose computers.  You cannot check email, surf the web, etc.  In fact, when you power up the Pi it boots directly into XBMC.

OpenElec
OpenElec is another dedicated media center distro for the Pi.  It sounds like OpenElec is Raspbmc taken even further.  Even more of the unused parts of the OS have been removed making OpenElec tiny and fast.  It sounds like OpenElec is even faster than Raspbmc, but at the cost of customization.  If OpenElec has support for your hardware then you're golden, but if not it sounds like your only option is to download the sources and recompile OpenElec yourself - not for the faint of heart.

Xbian
Xbian is the last of the dedicated media center distros I'm going to look at.  From what I've read, Xbian sounds like a cross between Raspbmc and OpenElec.  It's got the speed of OpenElec with the customization and flexibility of Raspbmc.

RetroPie
The last distro is completely different from the others in that it is not for media but is designed to play retro video games.  It's basically a collection of computer and video game emulators as well as free and open-source video games from the 70s, 80s, and 90s.  Assuming I connect the Pi to my TV (and not headless in the garage) this would be a fun distro to have on hand for playing "old-school" video games.


That's a summary of the 5 distros I plan to look at.  Not having tried the distros, only going by what I've read on the Internet, it sounds like OpenElec and Xbian are the most promising for my goal.  I think it all boils down to if these two distros have drivers for my hardware, and if not then I'll have to research how to add that support.

As I said, I plan to run all 5 distros and report back on my findings and impressions of each.

Monday, August 18, 2014

Raspberry Pi DVR - Hardware

To continue my chain of posts, after some research in the hardware necessary to turn a Raspberry Pi into a DVR I purchased the hardware.  Below is what I ordered:

Raspberry Pi model B+

Obviously the most important piece is the Raspberry Pi itself.  For this I went with the newly released model B+.  The model B+ has the exact same CPU, graphics core, RAM, and networking as previous models.  Where the model B+ really shines is the extra USB ports and improved power.  The improved power circuitry means I should be able to avoid using an external hub (pretty much required on all previous models) and also consumes less electricity so it costs less to run.

SD card

For the micro SD card I went with a 16GB Samsung EVO micro SD card.  I chose those card because it's rated as one of the fastest micro SD cards available, so that should help to speed up the Pi.

Power supply

In order to take advantage of the model B+'s improved power circuitry to power USB devices without a hub, you need a sufficiently powerful micro USB power adapter - specifically you want one that can deliver at least 2 amps of power.  I went with this adapter, it got great reviews and was relatively cheap.

TV tuner

Probably the hardest part about this project is the TV tuner.  You need a "stick" USB tuner to be able to receive TV signals.  But TV tuners and Linux don't seem to play well together.  There aren't many TV tuners on the market to begin with, and even fewer that work with Linux.  What's more, where you are in the world will dictate what type of tuner you need.  Most of the world uses DVB-T, but North America uses ATSC.  So shop for a tuner accordingly.  In the end, I went with the Haupauge 950Q.  New this item costs $70, but I purchased a used one on eBay for less than half that.  Before selecting your tuner you might want to read this list of TV tuners known to work in Linux, and this list of hardware known to work with the Raspberry Pi.

WiFi adapter

Although the Pi has built-in ethernet, I want to locate the Pi far from my router.  So I'll need a USB wireless adapter.  As with TV tuners, it's important to find one that works with Linux and/or the Pi.  Here's a list of hardware known to work with the Rapberry Pi.  I went with the Rosewill RNX-N180UBE.  I chose this model for several reasons.  First, the large antenna should provide a good signal from the garage.  Second, it was listed as working out of the box with the Raspberry Pi (less setup headache).  And finally, it's listed as an N300 adapter for greater speed.  However, I'm disappointed on this last one.  After receiving the adapter the manual clearly states the download stream is N300 but the upload speed is N150.  I thought I was mislead by Newegg/Rosewill, but after reading the product specs online closer it does say this.  So the fault is my own.  This is still the adapter I want. I just wish it were N300 both directions.

Heatsinks

From what I can tell, the Pi does not need heatsinks.  And it sounds like heatsinks will only lower the temperature by a couple of degrees.  That said, I did purchase a set of copper heatsinks.  In all my years of working on computers I've never experimented with overclocking nor heatsinking options.  So I'm going to experiment on the Pi with those.  And it's that the whole idea behind the Pi - to experiment, learn, and have fun?

Case
Technically the Pi doesn't need a case.  But it's a good idea, if for no other reason than to prevent shorts against metal.  I haven't purchased my case yet, but I like the look of this case.

HDMI cable
I do have several 6' HDMI cables, but I wanted something shorter.  So I purchase this 3 pack of 3' HDMI cables from amazon.

Keyboard, mouse, and monitor
Fortunately I have plenty of spare keyboards, mice, and monitors to choose from.  You will at least need a keyboard, mouse, and monitor for initial boot.  After that you can remotely connect to the Pi eliminating the need for these.  So you probably don't want to buy this hardware for a project, just borrow them from another use for a short while.

Raspberry Pi DVR

Many people have heard of the Raspberry Pi - it's a small low-power computer with a low price tag of $35 (or $25 for the lower model).  The whole idea behind this concept is it's a platform to learn, tweak, and experiment from.  Since they first went on sale 2 years ago I've wanted one, but I've needed a project or idea, something to do with it.  Recently I figure out what that idea is - I want to build a cheap low-power DVR for over the air (OTA) broadcast TV.  With this broad goal in mind I started my research.  Whereas projects with the Raspberry Pi are well documented on the Internet, my experience is any time you're dealing with Linux, unless your setup exactly matches a known working setup then you might run into issues which you need to work through.  Anyway, I wanted to do a series of posts on my blog about my progress towards this goal.  Hopefully if someone else is considering this project with a Raspberry Pi they will find these posts helpful.

First I wanted to elaborate more on my ultimate goal.  Since cutting the cord and dropping cable TV about 7 years ago, my only source of TV is OTA broadcast.  With an antenna I receive 9 channels, and whereas I don't watch much TV, there are a few programs that I enjoy.  The problem is timing, the shows are on at a time when I can't watch.  So I need a simple DVR to record the shows so I can watch them at my convenience.  This is typically called "time-shifting."

The most well-known time-shifting device is the TiVo.  The problem with a device like this is two-fold.  1) they are expensive, especially when you add in monthly fees; and 2) these devices usually require cable and/or satellite TV.  That said, there are a few commercial exceptions.  Channel Master makes a product called the DVR+ which is a DVR designed for OTA broadcast TV.  This device costs even more than a TiVo, but doesn't have monthly fees.  Another interesting product is the HDHomeRun.  This tiny box (with a street price of $100) can record TV shows and stream them to a network drive.  I already have a NAS (network attached storage) device in my house, so this is an enticing product.

In the end, I decided to go with the Raspberry Pi.  In effect I want to create my own version of these devices.  Even through the Raspberry Pi is only $35, this route is by no means cheaper.  When all is said and done, I estimate the hardware to cost about $150 including shipping and tax.  So it's definitely more cost-effective to go with the HDHomeRun.  But that is a single use device, whereas the Pi is a fully functional computer which means you can do more, and it will have more configuration options.  Plus using the Pi is just cool and more fun!  I'm more looking forward to the process of getting this to work than I am in using the end product.  I know that sounds weird, but as an engineer I've always enjoyed the work more than the end result.

Anyway, back to the goal of creating a time-shifting DVR.  My original plan was to mount the Pi with an antenna into an out of the way place like the garage.  The Pi would be headless (no keyboard, mouse, or monitor) so I would control it from another computer.  All the Pi would do is record TV shows of my choosing and save the output to my NAS box.  This was my original goal, but now I'm kicking around some additional ideas.  We have 3 TVs in our house, 2 of which are "smart TVs" but the main TV in the living room isn't.  So I thought if I put the Pi by that TV and connect it to the TV via HDMI, then that Pi could be multipurpose.  In addition to recording TV programs for all the TVs, it would also be a media server for that TV - allowing me to watch both my recorded TV shows as well as the wealth of free streaming content available on the Internet.  As an added bonus, I could use the Pi as an emulator and game station for playing retro video games on the big TV.

So my initial goal is as a headless DVR.  But once that is up and running I'll look at turning the Pi into a full-blown media center.

Tuesday, August 5, 2014

Intel graphics - still not up to par

There are basically 3 companies that control the computer graphics market; Intel, ATI (a.k.a AMD), and nvidia.  Total these 3 companies have something like 99% of the market, so you have to try very hard to find a computer with another chipset.

Intel owns the commanding share, greater than 50%.  But they don't own this much because their product is better, but because embedded graphics are cheap and most computer manufacturers go with that option.  It's long been know that Intel graphics are basically unplayable in 3D games.  You'll get such low frame rates that if you want to do any gaming you need ATI or nvidia.  Because of this, for more than a decade I've always spent the extra money for a dedicated graphics card.  That said, Intel has put forth some major effort into improving the graphical capabilities of their cards, probably due in large part to Windows Vista/7 and the aero glass effects.  This improvement combined with the fact that I don't have time to "game" at home on my computer has lead me to build several computers lately using the default Intel graphics.

Well I can say, Intel still has work to do here.  The problem isn't so much the graphics performance.  I was able to play some older games just fine.  No, the problem is graphical stability and glitches.  On one system, if the computer went into standby power mode, when coming out of power standby Windows had graphical glitches.  The text on many Windows was gone never to return, and the mouse would sometimes track slow or jump around.  On the second machine, it would experience random HARD reboots - typically during graphical applications such as watching a video.

In both of these cases, installation of an nvidia card cleared up the problems.  On the first machine I suspect the problem is driver related, but I have installed the latest and greatest version of the driver.  The second machine (hard reboot) is a hardware problem.  Either way, Intel still has work to catch up here.  I'm hopeful Intel will fix these problems and continue to close the gap in performance just because they hardware is so common.  I guess you could say they are the slowest person on the team, but the team can't finish until the slowest person crosses the line.  So we all benefit from a better performing Intel graphics.