Getting started with BeagleBone

I’ve just picked up a BeagleBone

BeagleBone is a small, low(ish) cost, open-source Linux computer on a  board – using an ARM Cortex-A8 processor running at 720 MHz, with 256 MB of RAM.  Unlike an Arduino – this is a fully-fledged computer. This makes it extremely powerful – and makes it a nice device to play with, to learn about embedded Linux.

This added power and sophistication does come at a cost though: this is not (or at least not currently) a tool for complete beginners in the way that an Arduino can be.  This is a Linux computer – so if you want to use it to it’s full potential, then you’d better know your way around the Linux command-line.

It runs Ångström Linux – which is a flavour of Linux specifically produced for embedded devices. It’s used as the embedded OS on a number of commercial products. Whilst this is great because it means that there are a large number of people working on keeping Ångström really up-to-date; it’s also a challenge for the hobbyist – because it is very strongly focussed on the embedded device community.

BeagleBone itself is quite a new product (it only came out a few months ago) – so although there’s quite a community around it’s big-brother (the BeagleBoard) some of the documentation for the BeagleBone is a bit patchy.

The first instruction in the getting started manual is to update the software on the board to the latest version of Ångström Linux.  This posed quite a challenge, even for me – and I’ve quite a few years of Linux experience (and I’m a some-time sysadin): so it’s definitely not something for someone completely new to the command-line.

If you’re struggling with this – I do have a couple of tips, however. The instructions on the various web pages aren’t really all that well written – unless you’re already familiar with the process.  Telling novice users to “Learn to use ‘dd‘ and ‘gzip‘ “ or “know which /dev/sdX or /dev/diskX is your SD card through use of ‘dmesg‘” isn’t very helpful. If you’re already familiar with these tools then this instruction adds nothing – and if you’re not: then the provided links aren’t really going to help…

The first thing that I’d recommend is that you do the update using another Linux computer. Whilst Mac OS X is just a pretty front-end for UNIX, and therefore everything should be just as easy under OS X – it didn’t really turn out to be quite that simple.  I could only find the latest version of Ångström in an img.xz archive, and out-of-the-box OS X doesn’t have any tools to let you work with that format: and although adding a suitable command-line tool is quite trivial it’s one extra step that you (almost certainly) wouldn’t have to make with a Linux box.

More of a problem is the way that OS X mounts the SD card. Despite spending several hours digging about, I couldn’t actually find the device representing the SD card. Because the download is (essentially) a disk image – you need to point the archive tools at the low-level device rather than it’s mount-point in the file-system.

Anyway, the long and the short of it is that if you download the image file on a Linux system, and then run the following incantation (obviously replacing the filename with the name of the image file you just downloaded) – it’ll probably work just fine.  The only caveat on that is if you have more than one physical drive on your computer – in which case you may need to change the /dev/sdb to something else).

sudo xz -dkc Angstrom-Cloud9-IDE-beaglebone-2012.01.27.img.xz > /dev/sdb --verbose

Note the addition of the --verbose flag to the command. This is going to take quite a while (~20 minutes) to run – so it’s nice to be able to see that something is indeed happening!

Once you’re up and running the latest version of Ångström, then what?

One of the things that the BeagleBone flavour of Ångström has running is the Cloud9 web-based IDE. This gives you the opportunity to write Bonescript code.  Bonescript is a Javascript-based scripting language for BeagleBone which lets you write Arduino-style code. I’m not sure I really get the idea of this though: if that’s all you want to be able to do – then why not use an actual Arduino? It’d be vastly easier, simpler, and cheaper.

That said, Bonescript & Cloud9 do let you very easily run some classic blink light code (the hardware / embedded equivalent of “Hello World!”)

This blinks one of the user LEDs on the board itself – and will blink an external LED driven from pin 3 on header 8 (the bottom header, if you have the board facing up, and have the ethernet port on the right).

As I say, not particularly useful – but at least it shows that everything is working!

The real power of BeagleBone is using it to control hardware from Python or C code: and coupling it with the device’s on-board web server.

So look out for a follow-up post, looking at some more interesting things to do with a BeagleBone, in the near future (just as soon as I’ve worked it all out myself!)… 🙂