adrift on a cosmic ocean

Writings on various topics (mostly technical) from Oliver Hookins and Angela Collins. We have lived in Berlin since 2009, have two kids, and have far too little time to really justify having a blog.

Changing of the HTPC guard

Posted by Oliver on the 30th of November, 2014 in category Tech
Tagged with: hardwareraspberry piusbwifi

Way back in 2010 I wrote about my acquisition of a Zotac HD-ID11 ZBox "home theatre PC". Since then it has served me fairly well, although I suspect I ran it too hot for the last year or two. After several Ubuntu and XBMC upgrades I noticed that it tended to idle pretty hot despite not really doing much most of the time, and was able to ignore this until it started restarting itself frequently, presumably due to thermal cutoffs. I ordered some replacement heatsink thermal pads and replaced the dried out old ones on the CPU and GPU, and was able to coax it back to life.

Until this week, unfortunately, when it stopped responding altogether and eventually would just sit there with the fan running at full speed and the power light staying red (which usually means it is powered off). So, good night my sweet prince. It's an annoyance for several reasons:

  • There was a time in my life (let's say teenage years and early twenties) when I was obsessed with hardware, and would gladly give up weeks of free time for such mundane and ultimately pointless exercises such as getting my ancient Sun Sparcstation 5 to run fully diskless by booting Debian Woody with a 2.2 kernel over BOOTP and using NFS for its root filesystem. I have practically no "free" time these days and getting hardware to work is usually an exercise in cargo-culting and futility. I prefer writing software to fix problems.
  • Even in 2014, it seems as though picking the right hardware to run under Linux is still difficult. To be clear - I should be able to look at the Amazon page for a given piece of equipment and just see printed there "Linux supported", then click the "buy it now button". This is made harder due to also sometimes needing ARM support.
  • The ZBox was doing way more than just serving as an HTPC. It was also our IPv6 tunnel gateway, fileserver, TimeMachine backup server, wiki server, Transmission torrent client + webserver and also copied backups to Amazon Glacier for remote offline storage.
  • I just dislike buying more stuff and having to fix broken things. There are so many little inconveniences in my daily life like fruitlessly trying to cancel our old internet connection, or finally getting around to booking a doctor's appointment to get a referral for physiotherapy that it ends up feeling like death by a thousand paper cuts. The total amount of all these little things adds up in the active mind and paralyses me from actually doing any of them. Adding one more thing just adds more to the burden.

But I digress... I've already had a Raspberry Pi for some time now and planned to use it to experiment with OpenCV with a small webcam but put that activity on the backburner and never got back to it. While I'm slightly concerned about its relatively low clock speed and on-board RAM (I've got the 512MB "B" version), it is still the easiest and cheapest replacement on hard for the ZBox. What was missing was a plastic case, wireless adaptor since my cable modem and wireless router are now on the other side of the living room, and a USB hub since I've read that the Pi doesn't deliver enough power on the USB ports, leading to problems with wifi adaptors. I purchased these items:

At about €24 total, that was much cheaper than replacing the ZBox with another current-generation HTPC, which typically would set me back €200-300. I of course checked beforehand on the Raspberry Pi forums that the wifi adaptor would work, so I was reasonably confident that I had a winning combination. I received the boxes yesterday and got to setting up all the new toys, expecting it (as many websites had mentioned) to all work flawlessly from the start.

Not so! Despite recognising the wifi adaptor and loading the correct kernel module, it just wouldn't work. I fiddled with wpa_supplicant as we all do when first trying to figure out what is going wrong, but to no avail. I found this blog post from some other enterprising person who had managed to get it working - and all without much additional effort, and still wasn't able to replicate the conditions for success. Eventually I downloaded images for OpenElec, Raspbian and the latest Raspbmc (I had been running an older image of Raspbmc from much earlier in the year) and tried them all without them working.

It was actually only when I read through the above blog post again that I realised something - the wifi adaptor actually lights up when it is working! I have the Pi, drive array, USB Hub and a bunch of cables almost entirely hidden away under the TV on a shelf, so I couldn't easily see any lights down there. Arbitrarily, I decided to plug the adaptor directly into the Pi as it is in the picture on that blog post. It worked! That was the lightbulb moment - and brought back all the memories of trying to fix hardware problems earlier in my life.

After that it was pretty easy to identify the problem - the wifi adaptor apparently doesn't like to work when plugged in the D-Link hub next to another device. The hub has 4 downstream ports (one of which is a "fast charge" port - presumably it outputs more than 500mA if necessary) - two on one side of the square and two on the neighbouring side. One other side is blank and the rear has the upstream port and power socket. If the wifi adaptor is on one side with another device - either my external drive array or the wireless keyboard transceiver - it won't work. If it is on one side by itself, it works fine. The main irritation is that when it doesn't work it still appears to the system and does everything but light up and send/receive wifi signals. It turns out that this makes it very hard to figure out what is going wrong!

Moral of the story is: when you have hardware problems, even in 2014 it helps to go back to first principles of hardware diagnosis. Isolate the new hardware, try to replicate known working conditions with no additional unknowns, then gradually add your own peculiarities back into the equation until you have identified the problem.

The next issue to tackle will be how to run all of those additional services in only ~300MB of the remaining RAM on this little computer.

© 2010-2018 Oliver Hookins and Angela Collins