Hyperion – Another Ambilight clone

Posted in boblight, Raspberry Pi

Raspbmc September update and boblight

Posted in boblight, Raspberry Pi

How to build the Ultimate* Media Centre



* Ok, maybe not the ultimate, but you’d find it difficult to beat for the price :p

Overview

A while back a friend of mine asked how he could go about recreating my setup from scratch, i.e starting with no hardware at all. I sent him a lengthy email which I have expanded on here as I think it would be useful for others.
So, in this guide I will describe what to buy and how to set up an awesome, boblight enabled, fully automated, low-cost, media centre. This particular setup is comprised of a Raspberry Pi running RaspBMC (XBMC) with a 50 WS2801 LED boblight setup, a 3TB ZyXel NSA-310 NAS drive running CouchPotato, SickBeard, Transmission, MySQL and a web server.

Part 1. Hardware

Raspberry PiZyXel NSA-310

1.1 Raspberry Pi & accessories
1.1.1 Raspberry Pi
The Raspberry Pi comes in 2 flavours, raspberry and raspberry. It also comes in 2 models, A (256mb RAM and 1 USB port – US$25) and B (512mb RAM, 2 USB ports and an Ethernet port – $35). Besides those differences, the boards are pretty much the same so you could theoretically buy either, but you will get a better experience using the B model with the extra ports and RAM.

Luckily, these days it’s a lot easier to get hold of a Pi, you can get them both online and offline. The price of the Pi tends to vary quite a bit from the advertised US$25/35 price due to currency conversion rates and added shipping, so it’s worth shopping around.
Amazon (UK)Amazon (US)Amazon (DE)Amazon (FR)Amazon (CA)Amazon (IT)Amazon (CN)Amazon (ES) is a good bet as they sell nearly all of the parts you’ll need. You can also pick up a Pi from Premier Farnell/Element 14 or RS Components who both distribute worldwide. Plus there’s always eBay (UK)eBay (DE)eBay (US)eBay (NL)
eBay (CA)eBay (FR)eBay (IE)eBay (IT)eBay (AT)eBay (AU)
If you live near a Maplin you can go and pick one up today in a brick and mortar store! But don’t bother trying your local Greggs, I checked and they only sell raspberry pies.

1.1.2 Power Supply
You’ll also need a micro-USB power supply for the Pi. Fortunately, most phones these days use micro-USB chargers, so you may already have one in the house. You’ll need one rated at 5V and ideally at least 1 amp (1A / 1000mA). It’s worth baring in mind that most problems with crashing/resetting Raspberry Pis are due to weak power supplies which struggle when under maximum load.
Therefore I’d recommend a decent branded power supply such as the Nokia AC-10X. e.g. this one on Amazon (UK) Amazon (DE)Amazon (FR)Amazon (IT)Amazon (CN)Amazon (ES) or any of these on eBay (UK)eBay (DE)eBay (US)eBay (NL)eBay (CA)eBay (FR)eBay (IE)eBay (IT)eBay (AT)eBay (AU). It’s the model I’ve been using for the past year and it’s been solid; pretty cheap too.

1.1.3 USB Stick
All operating systems on the Pi are usually installed on an SD card. However, to improve the performance of RaspBMC it is advised to run it from a USB stick connected to the Pi. Any decent USB stick will probably be faster than most SD cards, but to ensure the best performance, a USB 3 stick is recommended. Raspberry Pi doesn’t actually support full USB 3 speeds, but generally, USB 3 sticks will perform better than USB 2 sticks, even on USB 2 devices. Capacity of the stick is not that important as you will be storing your media on the NAS. 1GB will be plenty – if you can even buy such a thing these days. Please note, even if you install to USB, you will still need an SD card – this is where the Pi reads the firmware from during the boot process.

1.2 NAS Drives and Hard Drives
1.2.1 NAS Drives
For those wondering, NAS = Network Attached Storage, i.e an external hard drive that connects to your network, rather than to a single PC/laptop via USB. You hook this thing up to your modem/router, transfer all your media to it, hide it in a cupboard/under the stairs and forget about it. You can then access all your media from pretty much any network connected device, be it a PC, laptop, tablet, mobile phone or of course a Raspberry Pi. With some additional set up, you can also connect to the NAS via the internet from a remote connection, e.g a friends house. Where the NAS drive really shines is the fact it’s basically an always on, mini PC which you can set up to run various services and act as the central hub of your media centre; more on that later.

As with most electronics these days, there’s a wide range of NAS drives available. The first choice you’ll need to make is 1 bay or 2. If you opt for 1 bay/hard drive then you’ll have no redundancy, if the drive fails you’ll lose all your media if you don’t have a backup, but on the plus side the option is a lot cheaper, easier to set up and cheaper to run. The advantage of having a 2 bay NAS drive is that you can run a RAID configuration:

RAID

There are actually several types of RAID, but the important ones, as per the image above, are:

  • RAID 1 – Mirroring. i.e 2 x 3TB drives will become one 3TB drive. All data is written to both disks, meaning if one dies, you still have a copy on the other.
  • RAID 0 – This will merge the drives into one big drive. i.e 2 x 3TB drives will become one 6TB drive. All data will be split across both drives and only stored once.

That’s RAID in very simple terms, if you’re considering this route, it’s best to do some research and read about the differences between redundancy and backup. For example, in the situations above, running RAID 0 is essentially doubling your chance of losing 6TB of data and doesn’t provide any backup! So ideally you’d want all 6TB of that data backed up somewhere else… expensive! Running RAID 1 in the example above means you have 2 drives constantly running, using power and sat inside one device. While you have some data redundancy there, what happens if the device goes pop taking both your drives with it? Or you accidentally delete an important file on your mirrored setup? You have no true backup with this set up, you’ll still need another device to provide the backup.
Ok, that’s painting RAID in a bad light, there are of course advantages to RAID, improved speeds for example (which you could argue isn’t that important in a media centre), plus the other RAID setups address the issues mentioned above.

Anyway, this led me to go the 1-bay route, which is more in line with the low-cost, low-power media centre theme. My backup comes in the form of my old unused PC with a 1.5TB of JBOD disk space. Currently I manually backup all new files from the NAS to the PC. But in time I’ll create a script to automatically wake the PC via WOL and run an incremental backup every month or so. Once I start to approach 1.5TB of data, I plan to replace the JBOD with a single 3TB drive.

The next choice is what brand/model of NAS to buy. I went with the ZyXel NSA-310ZyXel NSA-310ZyXel NSA-310ZyXel NSA-310ZyXel NSA-310ZyXel NSA-310 which, at the time, seemed to be the best value in terms of cost (£37) vs performance and features, by quite a margin actually.
The main draw of the ZyXel-310 and the 2-bay Zyxel NSA-320/25 models, is that it already has a pretty decent feature set. As standard it can run a webserver, a Transmission torrent client, a MySQL database (very useful for XBMC), Samba/NFS/FTP servers, WordPress, several different media servers as well as the ability to install many other packages.
One such package is FFP, Fonz Fun Plug. Once installed it “unlocks” the NAS drive even further, it’s the equivalent of jailbreaking your iPhone or rooting your Android device. The FFP package sets up an SSH server which allows you to log into the underlying Linux operating system. From here you are free to install all sorts of additional packages further increasing the functionality and value of the device. The main packages you’d want to run for your media centre are CouchPotato and SickBeard. These packages take care of all your movie and TV needs. You give each bit of software a list of what you want to watch and at what quality. They will then keep track of this list, monitor release and air dates and then download your requested movies and TV series as soon as they become available. They do all the hard work and even automatically add them to your XBMC library and send you an alert. Both softwares are managed by nifty looking web interfaces. Ok, that’s beginning to sound like an advert, but these 2 bits of software are really awesome.
I should add that there are many other NAS drives around that can also do all this stuff and also run FFP. You always hear good stuff about the Synology range of NAS drives, but IMO, for the price, the ZyXel is the hands down winner.

The cheapest I can currently find it in the UK is £44.99 on eBay (UK) without a drive. But keep an eye on this ZyXel NSA-310 product page at AmazonZyXel NSA-310 product page at AmazonZyXel NSA-310 product page at AmazonZyXel NSA-310 product page at AmazonZyXel NSA-310 product page at AmazonZyXel NSA-310 product page at Amazon as the prices can fluctuate quite quickly. Check out this example for the UK, the price changes fairly often:
I’d suggest setting up a CamelCamelCamel.com alert which will monitor the price daily and alert you via twitter or email when it drops below the target price you have set. It’s a really handy service and completely free! If you’re not in a rush, you could set up alerts for all your parts and get them all at the lowest prices.

1.2.2 Hard Drives
If you have bought an empty NAS drive, then you’ll need 1 or more hard drives. Now, I wouldn’t say any brand is better than another, at the end of the day, all brands suffer from failiures and you’ll always have the fanboys declaring their undying loyalty to their favourite brand while spreading horror stories of rival brands. You’ll then see another person reporting the exact opposite. Save yourself the hassle and just buy whatever offers the best value and performance in your price range. One other tip, make sure you buy the highest capacity drive you can afford as you’ll soon begin filling the drive and wish you had spent a little bit more and bought the next model up!

Personally, I went with the Western Digital Red 3TB model, mainly for 2 reasons:

  • They are designed to be on and running 24/7.
  • They come with a longer warranty (3 yrs) than your standard drive, which IMO is worth the additional cost.

There are also other added benefits of the WD RED, e.g when in a RAID configuration, which you can read about here.

Where to buy? Well, I tend to use Ebuyer for most of my computer parts as they’ve always been reliable and offer free shipping on a lot of products. I have bought hard drives from Scan in the past and they were good too, especially when it failed and they replaced it without fuss. Plus, their Today Only deals are worth keeping an eye on for some great deals. In the US you could try NewEgg.In the Canada you could try NewEgg.

Some bargains can be had on your local eBay (UK)eBay (DE)eBay (US)eBay (NL)eBay (CA)eBay (FR)eBay (IE)eBay (IT)eBay (AT)eBay (AU), but be aware of grey imports which may affect your warranty in your region. Same goes with Amazon (UK)Amazon (DE)Amazon (US)Amazon (CA)Amazon (FR)Amazon (IT)Amazon (CN)Amazon (ES). Having said that, I got my WD 3TB Red on Amazon UK and it’s a genuine UK model with full 3yr warranty. Best to check the serial number with the manufacturer before opening and using the drive.

1.2.3 A Raspberry Pi powered NAS?
It is actually completely possible to do all of the above on a Raspberry Pi, either the same one running XBMC or a second dedicated Pi. The first option would definitely not be advised. The Pi is a great device, but in terms of raw power, it’s lacking, so running an entire media centre from one Pi would be very slow! The other option is a second Pi which would act as a media server to the XBMC Pi, as well as handle all your downloads. But again, running all these services at once could be an issue for the little Pi.
Then there’s network throughput. The Ethernet port on the Pi actually runs via the USB bus, so any data read from your hard drive must go through the USB bus twice which obviously quickly becomes congested which effects throughput. Then there’s the cost, the dedicated ZyXel NAS doesn’t cost much more than a second Pi so there’s probably not much point of taking this route. Unless of course you want another fun project to work on.

1.3 Boblight / LEDs
If you’ve never heard of boblight (or Ambilight) then checkout some videos and some pictures of boblight enabled media centres. Right, now you’ve seen that, you’re probably wondering how you do this and what you need to buy, well read on.

1.3.1 LEDs
There are various types of LEDs available to buy but for this guide you’ll want some WS2801 which are individually controlled RGB LEDs. They usually come in 2 types, in strings, or strips.

  • Strings look much like the regular Christmas lights you put on your tree. They are generally cheaper and you can position them at a variable intervals around your TV.
  • Strips are basically long PCBs with the LEDs fixed in position. You can cut these to length but you can’t change the distance between the LEDs. They are easier to mount on your TV but are also more expensive.

Which is the best type will depend on your TV, your budget and your willingness to do a bit of DIY. The strings will require you to build some sort of frame to mount to the back of the TV, while the strips can be stuck on fairly easily using double sided tape. However, if your TV produces a lot of heat you may find the glue in the tape will melt and the LEDs will come loose.

It’s also worth baring in mind the size of your TV. As a (very) rough guide, a string of 50 LEDs will be fine for 32″-37″ TVs, while 75 LEDs will be enough for 37″-42″ TVs. Bigger than that, you’ll probably want 100 LEDs. Since the strips have a fixed amount of LEDs per meter (usually 32 or 60) you don’t have much choice, you have to buy the right length to fit around the perimeter of your TV. I’d recommend 30 LED/m strips as when you consider a 40 inch TV would need about 2.75m / 165 LEDs at 60 LED/m, it gets pretty expensive and would probably be too bright. Actually, I’m not sure how well the Raspberry Pi would cope having to control all those LEDs whilst simultaneously running XBMC.

It seems the best place to buy WS2801 LEDs is eBay. Alibaba.com actually have a huge range of sellers with ws2801s in stock, but I think they tend to focus more on bulk orders, so I played it safe and went with eBay. Most of the eBay sellers are from China or Hong Kong and some in the US. I’m pretty certain they are all come from China anyway so I placed an order with a Chinese seller who was a bit cheaper. These are the string of LEDs I bought and I’d highly recommend this seller. Delivery took about 10 days and no customs duty to pay, the seller even let me know that my item had a failed delivery attempt as he had been checking the tracking number! (I hadn’t even checked it yet as I was expecting them to to take a lot longer to arrive!) He also followed up a few weeks later to check I had got them working as he had a few buyers complain they didn’t work when in fact they were wiring them up wrong.

Check your local eBay to see what is currently available:


1.3.2 Power Supply
Depending on where you look, each WS2801 LED draws a maximum current of between 30-60mA. Each LED will only draw this amount when it is set to white light at full brightness. So, assuming the maximum current is actually somewhere in the middle of that range, say 45mA, then 50 LEDs will draw around 2.25 Amps. In a real world scenario, my 50 LEDs are powered by a 2A 5V power supply and I’ve never noticed any problems, but then again, I never set my LEDs to full white light for long periods of time.

Number of LEDs
mA per LED


1.3.3 Mounting / Frame
The method you use to mount your LEDs will depend on the type of LEDs you have purchased and the type of TV you have. For example, the easiest method would be to tape some LED strips to a new model LED TV with a perfectly flat back. It gets a bit trickier with an older TV with curved back, or TVs with air vents and various ports to avoid.
Another option is to make use of the VESA mount which most TVs have. You can build a frame using lightweight aluminium or plastic, attach your LEDs to this, and then mount to the back of your TV. This obviously involves quite a bit of effort, but the advantage of this is you can easily remove it and attach to another similar sized TV in the future.

Before going the frame route, my advice would be to get a large sheet of rigid cardboard the approximate size of your TV and then roughly mount the LEDs to this and then attach to the back of your TV. The reason for this is the positioning of the LEDs can take a while to get right. Obviously they need to be as close to the edge of the TV as possible and sit approximately behind the area of the TV which they are configured to represent. But if they are too close to the edge you can see them and if you have a clear bezel the light refracts through this and looks bad. This actually took me several attempts to get the positioning just right – each time cutting the cardboard down to size and remounting the LEDs. But now I have a template from which I can build a frame. It also has all the mounting holes marked up, plus air vents and ports which I need to avoid when I build my frame.

1.4 Other things to consider
1.4.1 TV and remotes
One of the things that makes the Raspberry Pi and RaspBMC so great is it’s ability to work out of the box with most TV remotes. If you have a newish TV (i.e anything after 2010) from one of the major brands then your TV probably supports CEC or whatever your particular manufacturer has branded it as:

  • Samsung – Anynet+
  • Sony – BRAVIA Link
  • LG – SimpLink
  • Panasonic – VIERA Link

Some TVs/remotes are better supported than others, for example my Samsung works pretty well, I have all the buttons you need to navigate and play/pause/FF/RW within XBMC plus a few spares which you can map to other or custom functions. If you’re about to buy a TV, it’s worth double checking the model online to see if it works well with the Pi/XBMC, although most new TVs are a safe bet and the CEC plugin for XBMC/Pi is always improving compatibility so you’ll probably be fine.
If you have a TV that doesn’t support CEC then there are various compatible remotes and receivers available. You can even build your own IR receiver connected to the Raspberry Pis GPIO pins and integrate it into your case. A good remote to use is the original XBOX DVD remote and dongle. With a simple modification, you can get this to work out the of box with RaspBMC. You can still pick these up cheaply on, you guessed it, eBay!

There are of course a plethora of iOS and Android remotes available. I’d recommend the Official XBMC for iOS and I’ve heard good things about the Yatse remote for Android devices.

1.4.2 HDMI Cable
I wouldn’t recommend buying an expensive HDMI cable, they are digital after all so they either work, or they don’t. Gone are they days when you needed a high end cable to maximise picture quality. As long as you’ve got a standard setup then your basic HDMI cable will do the job nicely. Don’t buy the really cheap HDMI cables though if you want CEC support. A lot of the cheap cables save money by only connecting the basic pins for audio/video and don’t actually wire up the CEC pins. So if you have a CEC TV but you can’t get it working, try another cable.

1.4.3 WiFi dongle
Although RaspBMC supports various WiFi dongles out of the box, I would recommend avoiding WiFi, purely for bandwidth reasons. You will get a much better experience using a wired ethernet connection than WiFi, hence the suggestion for the Raspberry Pi Model B. Plus, it’s infinitely easier to set up; plug in ethernet cable – done!


Posted in boblight, Raspberry Pi

Raspbmc July update and boblight

Posted in boblight, Raspberry Pi

How To: run boblight on a Raspberry Pi using OpenElec

Posted in boblight, Raspberry Pi

Boblight just got better!

Posted in boblight, Raspberry Pi

PiBob

Posted in boblight, Raspberry Pi

LED notifications for Gmail, Twitter and Facebook

Posted in boblight, Raspberry Pi

2 problems, 2 solutions

Living in Bath can be a pain at times. For example, when owning a bike and living in a small flat (which is pretty much everywhere in Bath), where do you store your bike?

Outside? I didn’t want to leave my bike outside. Not only would it be at greater risk of being stolen but also at the mercy of the elements and would soon rust up no matter how well it was covered.

Communal hallway? This would obviously be the preferred option as there’s plenty of room here, especially tucked out of the way under the stairs. Unfortunately, someone had already tried that with their bike and got a polite “Leave your bike outside!” note from a neighbour!

So somewhere in the flat it is then. Bikes are bigger than I thought, with the wheels attached, but what if I take the wheels off? Boom!

20130529-224708.jpg

The shelving unit is actually a modified IKEA wardrobe which now fits pretty perfectly into an otherwise awkward size cupboard.

However, removing the wheels from a bike with hydraulic brakes introduces another problem:
If someone pulls the brake levers while the rotor is not between the brake pads then the pads clamp shut meaning you can’t get the wheel back on! I’ve learnt this the hard way, twice.

My brother had just visited from Australia and left a 20 cent coin behind. This happened to be the exact same thickness of the disc brake rotor! So I stuck the coin between the brake pads and secured it in place with a bit of tape. Perfect! (A 2p coin is almost as good and was used on the rear brake).

20130529-224942.jpg

Now my bike can sit happily in the cupboard without getting rusty, offending the neighbours or the pads clamping shut, all while making decent use of otherwise wasted space. Win win!

Posted in Other