Tuesday, May 22, 2012

Unconventional case

So I decided to make a really simple case...

It involves 83mm heat shrink, which you can buy here, and a hot air gun.

  • Cut to size, about 10mm or so outside the edges of the board
  • Cut a slot out for the HDMI connectors (or audio / composite if you're so inclined)
  • Apply hot air carefully so as to not distort the tubing around the HDMI cable
The result: A fairly well protected Pi that can work on a metal surface without shorting things...  It's not pretty, I grant you.

Pictures here (I failed to cut the tubing long enough so ended up layering a second one on:



Sunday, May 13, 2012

SD Card reviews

So I can't stress enough the requirement to read the Wiki in terms of supported SD card devices - ignore this advice at your peril!

I have tried two different cards at the moment - going to buy some more working ones soon...

16 Gb Class 10 KomputerBay - dd from /dev/zero = 1.2 MB/s
- hangs regularly with large IO operations (Debian) - DON'T USE THIS ONE!

4 Gb Class 4 Transcend - dd from /dev/zero = 3.8 MB/s
- Initial problem with read only device (sdb) on Ubuntu - fixed by GParted (Fedora & Debian) - otherwise works well.

4 Gb Class 4 SanDisk - dd from /dev/zero = 2.7 MB/s
- This is an older card, but works solidly - no problems.

Tools for managing SD images - kpartx

So for people who need to deal with creating or maintaining SD card images, or indeed full image backups of any storage device, kpartx is a godsend.

You most likely already know that you can mount images (created with dd) using loop:

mount -o loop -t vfat some-sd-image.img /mnt/mountpoint

But, this doesn't work for images that were created from the whole block device, as most of the RasPi images are.  You can mount them in the same way, but you need to work out what the sector offset is of the partition in order to just mount that (replacing sectors with the appropriate number for this image):

mount -o loop,offset=$(({sectors} * 512)) some-sd-image.img /mnt/mountpoint

Tedious, and hard to do - there's a full description here.

Well, there is a piece of magic which I hadn't previously heard of called kpartx, which allows you to do all of this in an easy command (described here).  To list the partitions on an image:

kpartx -l some-sd-image.img

And to add them as loop devices:

kpartx -a some-sd-image.img

Which can then be mounted as:

mount -t vfat /dev/loopXpY /mnt/mountpoint

You can clean up the /dev/loopX* again (after appropriate umount) with:

kpartx -d some-sd-image.img

Simples!

Thursday, May 10, 2012

XBMC with OpenElec

Firstly. Wow!  I was really impressed at how easy this was to build (not quick, mind), and also with the performance of the thing itself once installed...

I followed the instructions at OpenElec (parts 1 and 2) on a fairly vanilla Ubuntu installation running on Parallels on my mac.  It took a few hours to build (I went to bed, so not sure how many hours!) but had no errors whatsoever, and the instructions were perfect (I used GParted to shortcut a few of the command line partitioning steps in part 2, but that's the only thing I did differently).

Boot time the first time around is around 2 minutes, after that, it takes about a minute or so to boot.  It doesn't connect the HDMI port unless it's on during boot, which is a little annoying, but not the end of the world (I wonder if this can be fixed with a cron job checking for connectivity or something else?).

The XBMC interface runs pretty quickly, though between screens it takes a while (likely due to swap use, though I've not looked at what it actually does to the system during running yet).

Network browsing again is slow (i.e. listing large video plugin lists), but acceptable, and adding a UPNP source works just fine.  Doesn't seem to decode from Windows Media Centre; going to look into this later.  I'm pretty much decided that this will be my media centre of choice though - once I've figured out a way of getting BluRay and surround sound in my lounge without the PC. Hrm... :)

Kudos to OpenElec for getting such a useable and solid system up and running so quickly after release; let's hope it goes from strength to strength.

Tuesday, May 8, 2012

Media stuff

So, I think that the Pi is likely to work well as a Satellite decoder, but unlikely to be able to cope with more than sticking that data onto disk / across the network.  So what I'm thinking of is:

  • Use my routers (I have a pair of Buffalo WZR-HP-G300N/NH boxes running dd-wrt) as file servers with one or two large USB drives.
  • Get one of these which according to the Linux TV wiki is supported on Linux - I will endeavour to compile the drivers on arm first of course, before I commit to buying one of the boxes!
  • Build myself a PoE adaptor for the Pi - apparently (see FAQ) the team are going to think about providing support out of the box, but right now a small adaptor is easy enough to build, providing I can build it to also power the satellite adaptor...
  • Mount the Pi, the Satellite adaptor and PoE adaptor in a decent waterproof enclosure with suitable weatherproof ethernet connectors.
  • Find a good way of mounting this enclosure somewhere on a satellite dish mounting.
  • Think about support for two of the satellite adaptors - not sure if that'll work on one Pi, so, I'll get another one!
What does the world think?  I think this is a good solution for media providing you have a NAS somewhere in the house...  Obviously there are currently quite a few unknowns around performance of the ethernet interface (100BaseTX may not be enough for a single HD stream (is 72 Mb/s the right figure?), let alone two, but it's worth a try...

Pi-roblems

So a few observations so far about how it compares to faster desktop boxes.  Don't get me wrong, this isn't criticism about the Pi - I knew these things would be issues and for the price and size, what do you expect!  I wanted to list them here so that potential purchases of the Pi would realise that this is not a desktop machine - it will do some cool stuff, but you need to be careful to optimise it well and ensure that you don't expect too much of it.

Again, I'm going to update this thread regularly so watch this space.

Firstly, speed - it often sits in IOWait - this may be a compatibility issue with my SD card (16 Gb Class 10), but I doubt it! - It turns out the issue is the card on this one - see this post.

Secondly, networking - out of the box with Arch, MAC addresses are not maintained on boot.  This post addresses the issue so I'm going to try and upgrade the distro (though a pacman -SyU didn't fix it, it seems), I'll put a comment here and post in that thread if it does.

[UPDATE 8/5/12] it seems my problem is slightly different to the one in the post linked above - my /proc/cpuinfo shows no Serial / Revision numbers for the CPU - interesting... We'll see what the RasPi people say soon.

Pi-ssentials (Arch)

So I've compiled a list of essential packages for Pi-hacking within Arch linux that I've come across so far.  It will be updated regularly, so watch this space:

  • GNU screen
  • vim (add alias vi='vim' in /etc/profile)
  • sudo (%admin ALL=(ALL) ALL)
  • distcc (useful for compilation with cross compilation on faster machines - check out this article - I've not tried it at the time of writing, I'll produce a separate post when I do)
  • ethtool to debug some issues with networking

NewPi

So, my Pi arrived today.  It is a tiny thing indeed!

I set it up at work.  Was good and didn't get too distracted, but I did load up Debian and have a play.  It's not quick for sure - loading Incentivated's website took about 30 s, and the CPU was at 100 % for most of that time, but that's to be expected I guess.

After a while I tried out the Arch Linux Arm version, which doesn't by default have a GUI, but seems pretty nice. I'm going to stick with that for now.

Now I've got it home, I've got it running on my desk with Arch Linux, bought an HDMI-DVI adaptor and a cheap HDMI cable, which works fine.

I've rebuild the Arch Linux image with larger partitions - I was lazy and did it with a VM running Ubuntu and gparted - 6 Gb root partition, and the rest of the 16 Gb card as data (I'll be symlinking /home and /var).

I've been brainstorming things to do with it.  Ideas so far include:
  • Fishtank automation (Temperature, pH, salinity measurements, light & heater controls)
  • Media centre - somehow - more on this later - I have an awesome idea :)
  • Time machine / backup for my life (in other words, my Macbook Pro)
  • Random web console for when I need such a thing and my laptop is elsewhere - I think I'm going to buy one just for this purpose anyway
Anyway, enough talking, back to some doing!  I'll post more here about the media centre idea soon.