Snakes and Ladders, Pi style

Les Pounder is a big player in the Linux & free software community in the North West. I first met him a few years ago when he was running Barcamp Blackpool, Blackpool GeekUp, Oggcamp in Liverpool, UCubed (Ubuntu & Upstream Unconference) in Manchester plus Linux user groups and other events. When I set up the Manchester Raspberry Jam in 2012, it was modelled on the style of a UCubed event – and Les came along to help out.

Les was working as a systems administrator around the time the Pi came out. Within a year or so of the community blossoming and his involvement growing, he decided to embark on a new career with the Pi at its heart. He got some work running CPD for teachers, introducing them to the Pi and to coding, he started writing articles for Linux Format, he started putting Raspberry Pi projects together for Element14, and since Linux Voice began he’s been contributing articles and Pi tutorials for them. He’s also currently working on a book with Wiley on Raspberry Pi & Arduino projects.

Les recently set up the Blackpool Raspberry Jam – and at their inaugural event he demonstrated a new project he made which brings the traditional board game Snakes and Ladders in to the digital world of IO with the Model B+. It’s called Pythons and Resistors. Over to Les:

For this project we will look back to our childhood and bring a much loved game from our past into the future. The humble board game.


Board games have been a traditional family pastime for many generations but with the rise of computer games their novelty has started to dwindle. These card and paper based games have little to offer the children of today who have been brought up on a diet of downloadable content packs and gamer scores.

But what if we could take a game from yesteryear and adapt it using the Raspberry Pi?

Meet the latest interactive board game: Pythons and Resistors.


The board game is based on a simple snakes and ladders setup, with 100 squares in total via a grid of 10 x 10 squares. The object of the game is for 2 or more players to roll a dice and move their game piece to match the number given on the dice. If the player lands on a python’s head, then they will slither down the game board to the tail of the Python. If the player lands on the bottom of a resistor then they will climb up the game board. The winner is the first player to reach square 100, which is at the top left of the board.




See the full tutorial in the Element 14 community and see the final code on Les’s GitHub.

World Maker Faire and PyConUK

It’s been quiet around Pi Towers lately. Quiet and disquieting, rather like standing in your nan’s best front room when you were a kid and really needing a wee but were too afraid to break the silence. But we have good and exciting reasons for our quietude: we’ve all been busy preparing for two of our biggest events of the year. This weekend the education team is spreading it’s feelers of learning goodness around the world, from the Midlands to East Coast America.


Carrie Anne, Dave and Ben are at PyConUK while Rachel and I, along with James (our Director of Hardware), were beaten with a sock full of oranges until we sobbingly agreed to go to World Maker Faire New York.

The Maker Faire contingent will be joining our friends on the Pimoroni stand, demoing all sorts of goodies both new and old; selling shiny swag; giving out freebies; and talking and talking until we cough our larynxes into our fifteenth cup of Joe (as my American-English dictionary tells me I should call coffee if I want to be street).

2014-09-19 10.31.31

New swag bags! Grab ‘em while they’re hot

Our director of hardware engineering James Adams will be there – he’s giving a talk on What’s next at Raspberry Pi? on Saturday at 2.30pm in the NYSCI Auditorium – and Rachel and I will be speaking about digital creativity (details TBA). If you are at Maker Faire do come and visit us. At Maker Faire Bay Area earlier this year it was great to see so many educators and I hope to speak to at least as many in New York. But whatever your interests in Raspberry Pi – from digital creativity to hardware to making stuff (of course!) – we would love to see you.

Update: Clive and Rachel will also be speaking on Sunday at 11.30am in the Maker Shed.

If you can’t make it to New York, here’s a Q&A Make’s Matt Richardson conducted with James:

Meanwhile in Coventry Carrie Anne, Ben, Dave and Alex are running Python workshops, giving talks about Raspberry Pi in education and chatting to teachers, educators and developers in the Python community.



Raspberry Pi team hard at work

Fresh Coffee at Mailchimp

Ben: Here’s a guest post from Steven Sloan, a developer at MailChimp.


Grounds for innovation

Here at MailChimp, we’re always trying to listen hard and change fast. Turns out, this requires a good bit of coffee. Each department has its own take on how to keep the stuff flowing, mostly with the standard Bunn-O-Matic commercial machines. A few folks regularly avail themselves of our espresso setup. The developers fill two airpots—one with regular, the other double strength.

And then there’s the marketing team and our precious Chemex.

We make a pour-over pot once every hour or so, all day long, 5 days a week, 50-something weeks a year. Last December, when we were gathering data for our annual report, we got curious about how many Fresh Pots that might amount to. We tried to count it up, but begrudgingly had to accept the fact we didn’t have a good measure beyond pounds consumed. We even tried to keep track with a bean counter, but that didn’t last long.

For a while, the exact nature of our coffee consumption seemed like it would remain just another mystery of the universe. But then one day, talking to Mark while waiting on yet another Fresh Pot, I said, “Hey, I bet we could track the temperature with a Raspberry Pi and post to the group chat when there’s a fresh one.”

I wasn’t too serious, but Mark’s response was one often heard around MailChimp when ridiculous projects are proposed: “Sounds great, just let me know what you need to get it done.”

A few days later, I had a materials list drawn up from Adafruit’s thermometer tutorial, and we were off to the races.


A fresh Pi

With a Raspberry Pi in hand, the first thing I did was add a script to the boot process that sent an email using Mandrill with its IP so I could find it on our network without trouble.

Then, I had to tackle the problem of detecting pot states with only a single datapoint: current temperature. I hoped that comparing the running averages of different time spans would be enough to determine the pot’s status. (The average Chemex temperature over the course of a few minutes, for instance, would tell us something different than the average temperate over the course of an hour.)

Since this was a greenfield project, I wanted to work with an unfamiliar language. I felt like the more functional nature of Clojure would be a great fit for passing along a single piece of state. This turned out to be a great decision, and I’ll explain why in a minute.

Graph it home

I hacked together a quick program that would spit out the current temperature, minute’s running average, hour’s running average, and the running average’s rate of change to a log file so I could analyze them.

{"current":32.062, "minute":24.8747, "hour":23.5391, "running-rate":0.039508}
{"current":32.437, "minute":25.0008, "hour":23.5635, "running-rate":0.0423943}
{"current":32.875, "minute":25.1322, "hour":23.5897, "running-rate":0.045361}
{"current":33.625, "minute":25.2738, "hour":23.6177, "running-rate":0.048569}
{"current":33.625, "minute":25.413, "hour":23.6476, "running-rate":0.05159}
{"current":33.625, "minute":25.55, "hour":23.6793, "running-rate":0.054437}

Log files in hand, I temporarily turned back to Ruby using the wonderful Gruff charting library to visualize things and make patterns easier to spot.

A few batches of hot water gave me a decent idea what things should look like, so I moved our coffee equipment to my desk to get some live data. This let me check in with the actual running state of the program and compare it with the status of the pot (and led to some coworker laughs and a wonderful smell at my workspace all day).


A brewing or fresh pot is easy to recognize, but figuring out when the pot is empty turned out to be a little tricky. It takes a while for the Chemex to completely cool off, which means it could be empty and still warm, which I’m sure would lead to more than a few disappointing trips to the kitchen. Luckily, the rate a pot cools tells us if it is empty or not—for instance, a half-full pot stays warm longer than an empty one simply because of the coffee still in it. Always nice to have physics on your side.

Watchers for the win

Armed with the collection of datapoints (running averages, rate of change, etc.) for each of the pot’s states, I moved on to figuring out how to notify our department’s group chat room when a pot was brewing, ready, empty, or stale. This is where some of the built-in features of Clojure came in handy.

I already had a program that logged the current state of itself every second. By switching the actual state to an agent, I could apply watchers to it. These watchers get called whenever the agent changes, which is perfect for analyzing changes in state.

Another agent added was the pot itself. The watcher for the temperature would look for the above mentioned boundaries, and update the pot’s state, leaving another watcher to track the pot and notify our chat room. When it came time to pick an alias to deliver the notifications, Dave Grohl was the natural choice.

Here’s a simple example of the pot watcher looking for a brewing pot:

(def pot-status
  (agent {:status "empty"}))

(defn pot-watcher [watcher status old_status new_status]
  (if (= (:status new_status) "brewing")

(add-watch pot-status :pot-watcher pot-watcher)

The great thing is the watcher only gets called when the status changes, not on each tick of the temperature. Using agents felt great to me in this case as they provided a clean way to watch state (without callbacks or a ton of boilerplate) and maintain separation of concern between different parts of the program.


Freshness into the future

I’m still working out a few kinks, tuning in the bounds, and keeping a log of pots. It’s been a fun experience and I learned a ton. Something tells me this won’t be the last time we work with Raspberry Pi on a project. What’s next, Fresh Pots in space? Luckily, we’ve got plenty of coffee to propel us.


Ben: Thanks to Steven and MailChimp for permission to use the post – we’re very pleased to see the Pi used as the tool of choice of coffee-hungry developers around the world! Coffee is important to us here at Pi Towers…

Trojan Room Coffee Pot

Blast from the past – remember this coffee pot? Click to read more

MailChimp is what I use to power Pi Weekly – my weekly Raspberry Pi news & projects email newsletter – check it out at!

New Raspbian and NOOBS releases

If you head over to the downloads page, you’ll find new versions of our Raspbian image and NOOBS installer. Alongside the usual firmware and kernel improvements, major changes to the Raspbian image include:

  • Java updated to JDK 8
  • Mathematica updated to version 10
  • Sonic Pi updated to version 2
  • Minecraft Pi pre-installed

Following its release last week, of our port of Epiphany has replaced Midori as the default browser, bringing with it hardware-accelerated video support and better standards compliance.

Epiphany is now the default browser

Epiphany is now the default browser

Our Raspbian image now includes driver support for the BCM43143 802.11n WiFi chip. Last week Broadcom released a rather neat USB hub and WiFi adapter combo based on this chip, which should now work out of the box. More info is available here.

BCM43143 802.11n wireless dongle

BCM43143 802.11n USB hub and WiFi adapter

Finally, to free up SD card space, the offline NOOBS package now only contains the Raspbian archive. To install Arch, Pidora, OpenELEC, RaspBMC or RISC OS you will require a network connection.

Let’s get Physical! New physical computing animation

With the success of the first two productions from Saladhouse, our animator friends in Manchester (What is a Raspberry Pi? and Setting up your Raspberry Pi), we proceeded to make plans for a third in the series. The topic we chose to cover this time is one which demonstrates the additional power of the Pi in learning – an introduction to the realm of physical computing.

Look through the amazing projects in our blog, the MagPi or Pi Weekly and you’ll see many of them use the portability of the small form factor and low powered nature of the Pi along with the extensibility the GPIO pins give you – not to mention the wealth of community produced add-on boards available making it all much easier.

B+ gpio closeup

Those pins sticking out there. General Purpose Input/Output. Did we mention there are 40 on the B+?

Here at Pi Towers we all love physical projects – from robotics and home automation to flatulence alarms and scaring the elderly – and we believe they’re a great way to introduce young people to coding, computational thinking, product development and understanding systems.

The video refers to some resources for projects you can make yourself. We featured the hamster disco on our blog in July, and you may have heard talk of some of the others on twitter – which are all brand new, constructed and tested by our education team. They are:


And here they are in real life:

Physical computing Foundation style: fart detector, robobutler, hamster cam and grandpa scarer. Yes, they all work :)

Physical computing Foundation style: fart detector, robobutler, hamster cam and grandpa scarer. Yes, they all work :)

See more in our resources section.

Huge thanks to Sam and Scott from Saladhouse for their hard work on this – and also to our voice actors Arthur (son of Pi co-founder Pete Lomas) and Maia! And yes, that’s Eben narrating.

A little gift I brought Dave back from Memphis...

A little gift I brought Dave back from Memphis…

Gert’s VGA Adapter

The Raspberry Pi has an HDMI port to connect a display. If your monitor only has VGA, you have to use an adapter. Because this requires a digital-to-analogue conversion, those adapters can be quite pricey, and they can draw lots of power. So our friend Gert van Loo (who developed the Alpha board that became the Raspberry Pi, and the man behind the Gertboard and Gertduino) has created a VGA adapter that uses the Pi’s GPIO.


This wasn’t possible on the Model A or B, but now the B+ exposes 40 GPIO pins, there’s more to play with. As well as just allowing you to connect a VGA monitor natively, it also means you can use it as a secondary monitor alongside HDMI. And unlike composite video, the DPI interface can be run independent of the HDMI. The software for dual screens is still under development, but we expect that to arrive in the next couple of weeks. Running two screens at maximum resolution will consume SDRAM bandwidth, and is yet to be tested. (And there’s a catch: as the board uses most of your GPIO pins, you lose access to them.)

The VGA output supports the same resolution as your HDMI one: from 640 x 480 up to 1920 x 1024 at 60fps. At the highest resolution the pixel quality is almost as good as HDMI. The adapter uses a simple resistor ladder network as a digital-to-analogue converter, so the colour quality depends on how well-balanced your resistors are. There is slight colour banding, and with 6 bits per channel you have a maximum of 262144 colours.

Dom has been working on the software side and the new DPI (read: VGA) driver software has been added to the latest release.


“Where can I buy one?”, I hear you ask. Currently, nowhere. But Gert has made the VGA adapter open hardware, so you can make it yourself, or find yourself an enthusiastic partner and have it made. All the data is in the public domain on GitHub. Besides the manual and schematics, you will also find the database for the PCB and the Gerber files. The PCB design supports both through-hole and SMD parts. The design consists of:

  • 1 PCB
  • 2 connectors
  • 20 resistors

The cost is not prohibitive, but having a single PCB made is rather expensive, so you might want to collect a group of interested people and order a batch; if you’re interested in doing that, head over to the forums and see if you can organise a group buy.

See vga666 at (it’s 6 bits per colour channel, hence 666…)

Gert’s looking to get the PCBs produced, and hopefully the manufacturer will be able to put them on sale (we’ll update with a link) – but they’re so easy to make we anticipate they’ll be generally available before long anyway. Gert says he expects in due time that a far-east manufacturer will see fit to sell them for two dollars.

Want to see a prototype? Of course you do.


Click to embiggen, and marvel at Gert’s work soldering together some of those teeny resistors.

HATs in the wild. And a unicorn.

If you’re a regular reader, you’ll recall that a month or so ago, we announced a new way of making add-on hardware for the Raspberry Pi: namely, the Raspberry Pi HAT (Hardware Attached on Top). You can read James, our Director of Hardware, explaining what they’re all about in the original blog post: in short, the HAT is a solder-less way of attaching hardware which can be auto-detected by the Pi, so GPIOs and headers are automagically configured by the Pi, without you having to do anything.

Gordon Pighat Hollingworth

The pink confection on top of Gordon is a hat, not a HAT.

(A tangentially related question: how do you pronounce EEPROM? Fights are breaking out at Pi Towers: a small majority of us rhyme the first syllable with “meep”, while the rest of us rhyme with “meh”. This is like the scone/scone thing all over again. Angry opinions in the comments, please.)

HATs are starting to appear in the wild. Adafruit are sending PCBs out for prototyping. HiFiBerry have HATs you can buy now: the Digi+, which enables you to connect an external digital-to-analogue converter; and the DAC+, a high-res all-in-one DAC. And the whimsical bearded pixies at Pimoroni have come up with my favourite so far (it’s my favourite because SPARKLES): the Unicorn HAT. I saw it in the flesh on Saturday at the Cambridge Raspberry Jam. It’s a thing of beauty. Here’s Paul, introducing the Unicorn HAT.

Are you making a HAT? Let us know in the comments: I’ll add links to this post if I’ve missed yours out here.

Sonic Pi v2.0 competition for schools is launched!

This week, Dr Sam Aaron released the much anticipated final version of Sonic Pi v2.0. It will be replacing Sonic Pi v1 on Raspbian very soon, and you will be able to get it via our Downloads page (we will let you know when). In the meantime, you can follow the instructions at the bottom of this post to download and install it. The latest version of Sonic Pi brings music creation and performance to the forefront with live coding capabilities, parameter modification, samples and much more!

To celebrate, we have launched the first ever Sonic Pi Competition to find some of the best space-themed music, coded with Sonic Pi v2.0 by school children in the UK. The Sonic Pi Competition is designed to encourage school students aged between 6 and 16 years old to use their creativity and coding knowledge to create a unique and original two-minute piece of music on a Raspberry Pi device.

Entries need to include an audio file of what the music sounds like, the code used to create it, a short written description, and a cover art file.

All entries will be put into a hat to win a Raspberry Pi and SD card at random. Semi-finalists will win a Sonic Pi half-day workshop with Sam Aaron and Juneau Projects for their school, and a custom Sonic Pi Pibow case. Overall winners in each category will win a Sonic Pi classroom kit containing 25 x Raspberry Pis and peripherals for their school and a Minirig speaker, as well as a Sonic Pi Competition trophy designed by artists Juneau Projects.

The final will take place at the Cambridge Junction on 4th November 2014 as part of the Sonic Pi Live & Coding Summit, with the 12 semi-finalists (four in each category) introducing and playing their music on a Raspberry Pi to the audience in front of an expert panel of judges.

You can find everything you need know, including some lesson plans to get your students started, in this new Sonic Pi Competition Resource. You’ll find the entry form here.

The deadline for entries is 13th October 2014, so get creative with your code, and become the next big thing in music!

Sonic Pi v2.0 can be downloaded right now by typing the following from the command line or LXTerminal window:

sudo apt-get update
sudo apt-get install sonic-pi