Birds Like Wires

Feed the Birds

Raspberry Pi Status Board

It was only a matter of time. I’ve had two Pi boards sat around for a while now; so long, in fact, that they’re both the 256MB Model B types and weren’t made in Wales. This summer, as part of the annual revamp in our studios, the much-neglected information screen finally bobbed high enough up on the to-do list to be in danger of actually getting done. Combine that with a collection of retired portrait-capable plasma screens in the basement and we’ve got ourselves a project!

What started this all off was the buzz there had been around Panic’s latest offering: Status Board. What I found a little uncomfortable was the fact that you needed to dedicate an iPad to the job, which just seemed downright weird. I’m up to my ears in old Macs, but iPads are rather more difficult to find without being attached to a protective owner. Nevertheless, there was an option for having one that shouldn’t have needed to be unplugged and used elsewhere too often, so I hurried off and bought Status Board.

Weighing The Options

I quickly realised that while Status Board may be a great app in the right environment, to do the kind of thing I had in mind would mean writing most of the code myself anyway. There is, of course, no magic button that creates displays for monitoring studios. When you add to that the extra fee for HDMI output (which is galling enough without having to be reminded about it every time you use AirPlay for the output), plus the cost of an iPad HDMI converter and the fact that the display was standard-def and only had VGA and composite inputs; it was a non-starter.

What I needed was something that could connect to the display cheaply, rotate its video output to suit a portrait orientation and run a browser, which I could then use to display a web page. All easy things to do on a Raspberry Pi. I just had to remember some JavaScript!

The Setup

The Pi needed to fire up and boot straight into a browser, no messing around with desktops, and then load the correct page. After that there should be nothing to worry about on the Pi; it should sit and render the page, run the JavaScript and fetch some data, which is great as nothing would be lost should the SD card give out. I decided to use Chromium as the browser of choice; it’s heavier than Midori, but the rendering is very similar to Safari, and as I’d be using Coda I thought it would make knocking the page into shape a little quicker.

Update! I was completely unaware that Midori uses WebKit as its rendering engine, which makes it perfect for my requirements! I have since ditched Chromium, as it really was way too resource hungry. Full instructions are on the StatusBoard GitHub page.

After messing around with some coloured boxes I worked out that there was about 395×635px to play with and still keep the display looking nice. A quick Google turned up Simon Baird’s great JavaScript CoolClock, which took care of the timepiece. Then four full-width boxes, one for each studio, were created to display basic user and status information.

First boot. The first box with some automated content. The clock works. Four studio status boxes and a test block next to the clock. Almost there but no colour feedback. Presentable!

Here came the trick. How to get that basic user and status information from each studio? The easiest way I could think of was to run a simple Bash script every 10 seconds, checking on the logged in username, idle status and load averages, then writing that out as HTML to a file in /Library/WebServer/Documents. This gets served out by Apache on each system. Every minute the load average from each system gets sent to StatHat so a graph over 24 hours can be pulled down and used as a background for each studio block.

As a last minute thought, I added a free space reading for each of the workspace drives. Even with terabytes of storage, multiple users with lots of really high quality audio files chews through drive space on the console systems in no time, so it’s nice to be able to show people how much is left. The Bash script also checks against the local Active Directory database for the current user’s real name.

Commissioning

So, the clock was easy and a touch of JavaScript in each studio block fetches details from the console machines every 10 seconds, and graphs from StatHat every 10 minutes. I chose a colour scheme using Color Scheme Designer and that was about it!

The Pi itself hides out of sight and luckily there was a network port on the wall to feed it data. The files it actually fetches and displays are hosted on one of the studios’ servers, though they could just as easily be stored locally on the Pi and (optionally) made available with lighthttpd or other web server. A little RCA cable connects Pi and screen, though one of the longest parts of the project was searching for an elusive RCA to BNC adapter!

There’s an added bonus. After setting everything up in the lobby, I rather missed having that instant feedback on the facilities in my office. But because it’s just a web page, I can use the often-forgotten ‘Open in Dashboard’ feature of Safari to have my own mini status screen on my Mac. Magic!

All of the code is up on the StatusBoard GitHub page, so you could be displaying stats for your own systems in no time. If you do, definitely tweet a picture my way; I’d love to see what you’re monitoring!

← Recent Articles