Do you pine for the plug-in peripherals on other platforms like the Grove System from seeed studio or the Gadgeteer?

Are you finding it hard to choose between the great interface boards from companies like Ciseco and Quick2Wire?

Grove real time clock

Grove RTC

Sytech 3 Axis Accelerometer

Sytech 3 Axis Accelerometer

Help is at hand!

We’re about to start prototyping the babelboard – an inexpensive board that lets you connect I2C-based boards from all these families to the Raspberry Pi.

This will allow you to use dozens of I2C-based devices with the Pi without having to design or solder them. Just plug them in and write some code!

Over the next few days we will open up the project on GitHub and start posting details here. The board is fairly simple so we hope to have it available in kit form within weeks.

Find out more

If you want to know more, or have ideas, join our support forum, head over to the babelboard topic and get in touch.

QCon London is over for this year. What an awesome event it was!

Many friends were presenting and participating.

John Davies, co-founder and CTO of Incept5 had put together a fascinating track on Finance, Technology and Implementation. Technologists from the Finance sector are not usually allowed to talk about their work but somehow John had lined up an array of speakers from several major financial institutions. Sadly the track clashed with ours (see below) but I’ve heard good things about the talks.

Steve Freeman and I were asked to put together a half-day Maker track. It was a great success.

We talked about our Making efforts here at Quick2Wire, and Rain Ashford told us about her work with wearable technology.

Wearable tech has some very significant applications. She told us abut research that’s helping people on the Autistic spectrum to better understand the mood of others. She also talked about her work in the area of the Quantified Self (QS) movement.

QS also came up in Ward Cunningham‘s outstanding keynote.

Steve Freeman has been telling me for days how excited he was about Ward Cunningham’s new Federated Wiki. Yesterday I found out why.

Most of you will know what an amazing man Ward is. He invented the Wiki, and is responsible for many other widely-used software tools. The hallmark of his design is beautiful, useful simplicity.

I want to do justice to the Federated wiki and Txtzyme, and this post is already a long one. All I’ll say for now is that on Friday evening, dropping with tiredness, I somehow found the energy to fork both of Ward’s projects and start playing. Within minutes I was running a hacked Txtzyme implementation on an Arduino, and using it to control an LED from my laptop.

This stuff is mind-blowing – simple, powerful and free.

Ward has kindly agreed to do an email interview for this website, so expect more detail soon.

QCon was well organised, very well attended, and packed with interesting talks. If you’re a software professional, or interested in what top professionals do, then QCon is a must. And if you can’t wait till next year, you can find this year’s talks (and other excellent material) available on InfoQ.

Interactive Python

One of the great features of Python is the interactive interpreter. If you run the python3 command with no arguments it starts in an interactive mode in which you can enter Python code. The interpreter executes the code immediately and displays any calculated result.

Computer programmers call an interactive interpreter a “REPL”, which stands for Read/Eval/Print Loop. The interpreter reads some code from user input, evaluates the code, prints the result and loops round to repeat the process.

When programming in Python I find it useful to keep three windows open at all times: my text editor; a shell command prompt for running my program, tests or shell commands; and an interpreter prompt so that I can experiment with unfamiliar APIs, double-check my understanding of language features, run little manual or automated tests and use Python’s built-in help browser.


The help browser is another great Python feature. The built-in help function can be used to read documentation about the modules, classes & functions of the Python APIs. We’ve written documentation for the Quick2Wire APIs that you can read with the help command. For example, the following command will show you the help for our GPIO API.



The standard python3 interpreter has a pretty rudimentary REPL. There’s a much better one in the Raspbian software repository called ipython3, which provides a lot of help for entering and working with Python code. It auto-indents multi-line control flow statements, function and class definitions. It can auto-complete names for you: pressing Tab will complete a partially entered name from those that are in scope. It has a searchable command history that persists between sessions, so you can easily repeat or edit previous input. It can reload modules that you have imported, so if you change a code in your editor you can reload it into thee REPL. And much much more.

You can install ipython3 with the command:

sudo apt-get install ipython3

We’re still experimenting with our API design, trying to find an abstraction for GPIO that works for both on-board GPIO pins and pins of GPIO expansion devices like our MCP23017 board. We realise that this creates a bit of churn in the API and that changes have been landing in the GitHub repository without warning.

To improve the situation we’re changing our development process so that big API changes are done in public and accepted into the API project after a review period. We’re using GitHub’s pull requests to manage the process.

In future, when writing a new API feature or changing an existing API we will make a personal fork of the quick2wire-python-api repository. When the change is ready to be integrated into the API we will issue a pull request, and the change will appear in the issue tracker. Other team members will then review the code, suggest improvements or raise objections. And it’s not limited to the team members either. If you use the API and are interested in upcoming changes you can see what we’re changing and make comments too. Or, fork the library yourself and send us pull requests.

Here’s an example:

We hope this will help avoid unpleasant surprises and make the evolution of the software more transparent to folks using it.

When you put together one of our interface boards you’ll see that it breaks out the GPIO pins into their own header and labels them 0 to 7. Our GPIO library numbered Pins 0..23, after the header pins on the Raspberry Pi. That’s pretty awkward in practice so we’re experimenting with ways to make it easier to write programs that work with broken out GPIO headers.

Our current approach is to replace the Pin type with two pin classes: GPIOPIn and HeaderPin. A GPIOPin is created with a pin number from 0 to 7 that identifies the pin on the interface board. A HeaderPin is created with a pin number from 0 to 23 that identifies the pin on the Pi’s header.

For example:


import sys
from time import sleep
from quick2wire.gpio import GPIOPin, In, Out

led = GPIOPin(1, direction=Out)
button = GPIOPin(0, direction=In)

while True:
      led.value = button.value

To ensure that existing code keeps working, we define Pin as a synonym of HeaderPin. But when we’ve found an approach that works well we’ll deprecate Pin and eventually remove it from the API.

I’ve just come home after a great session in Norwich. One of the most enjoyable things about this sort of meeting is that you get a wonderful range of perspectives on the Pi. Here’s one.

Nev Young explained that he’d already recovered the price of his Pi in reduced electricity costs. His web server (please don’t all visit at once!) now runs on a Raspberry Pi, consuming about two watts instead of three hundred. That’s the way to save the planet one server at a time. Brilliant!

There were lots of other interesting people there. Too many to mention them all, but they included a solicitor who runs archlinux on his laptop, and is teaching himself Python on his Pi, a retro-game-meister, a developer who is working on what could be a uniquely extensible social game, and of course @stevedp – a fellow Python developer and Pi enthusiast who manages the website.

I did our blinken-bar led demo, but with a new twist. We’ve just published the first version of a library for the PCF8591, which is the chip at the heart of our I2C analogue board. We’ve hooked one up to a photocell and written a little Python program to display the light level on a Bar LED. I have to admit to a childish pleasure in seeing the LED respond as I wave my hand above the board.

Here’s our post about the demo with video and code, and a report from @norwichrpi (with photos) here.

I was made to feel very welcome, and will be heading back when we have the next lot of boards to show.

Most of our users started out with revision 1 of the Raspberry Pi, but a growing number have revision 2 boards, and some have both.

A few things changed in revision 2, including GPIO pin numbering and the I2C interface.

Until yesterday our GPIO library did not handle header pin 13 correctly on revision 2 RasPis, and the I2C library required you to specify that you wanted to use I2C bus  1.

We’ve updated the library and those problems should now be a thing of the past.

If you are using the quick2wire-python-api libraries, you will need to pull the new versions from github. If you got to the directory in which you cloned the library, just run git pull from the command line and you should get the new version of the code.

It can be a bit of a pain doing Python development over ssh with the Raspberry Pi. You’re limited to text-mode editors unless you start an X environment. The alternative is to edit files on your PC and sync them to the Pi for testing, but that’s fiddly end error-prone.

If you’re running Linux on your PC you can mount files from your PC’s filesystem on the Pi or vice versa. You can then edit programs on your PC with your favourite editor and run programs on the Pi without having to sync at all.

If you mount a directory on the Pi into your PC’s filesystem, the files remain on the Pi when you unmount the directory from your PC, so you can edit programs on the Pi with your PC and leave them running on the Pi when you finish working.

If you mount a directory on your PC into the Pi’s filesystem, you can continue working on the program on your PC even when you’ve unmounted it from the Pi – handy if you want to work on the move – and then remount it to run your program on the Pi.

My favourite tool for doing this is sshfs. It uses ssh and sftp as the transport and so there’s no need to edit system-global configuration files, as you do to export NFS directories, and you don’t need to be root to export or mount a filesystem.

You’ll need to install sshfs on your PC and your Raspebrry Pi. On each machine, install it with apt-get:

% sudo apt-get install sshfs

You need to add yourself to the fuse group to mount FUSE filesystems like sshfs. On each machine, run

% sudo adduser $USER fuse

Now log out and back in again and you’ll be able to mount remote directories into the filesystem on the Pi:

% mkdir quick2wire
% sshfs -o idmap=user -o gid=`id --group` nat@ quick2wire

(Replace “″ with the IP address or hostname of your PC and “nat” with your user id on your PC.)

Now you can edit the files on your PC, and run them on the Pi immediately.

Automating logon to the Pi

You’ll get asked to enter your password each time you want to connect. If you use an SSH key-pair, life is even simpler; ssh will use the keys to log you in without you having to enter your password.

If you need to generate a key pair on your PC. run

% ssh-keygen -t rsa

Accept the default location.

You will be prompted for a passphrase, and asked to confirm it. If you enter an empty string, you can use your key to log on to the Pi without further interaction.

So can anyone else who gains access to your PC account, so use this option with care!

OpenSSH will create a pair of files in your .ssh directory – a private key which you must keep secret, and a public key which you can transfer to other computers.

To transfer your public key to the the RPi, on your PC run:

# On Linux
% ssh-copy-id nat@<raspi-ip>

# On OSX
% cat ~/.ssh/ | ssh nat@<raspi-ip> 
  "umask 077; mkdir -p .ssh ; cat >> .ssh/authorized_keys"
and after one final prompt you won’t be prompted for your Pi password when using ssh or sshfs.

When you’re finished

When you’ve finished, unmount the directory using fusermount -u:

% fusermount -u quick2wire

While we’re waiting for the first interface boards to arrive we’ve been checking out our libraries against the new Raspbian distro.

The latest Raspbian kernel supports I2C and SPI, and today we got all our loopback tests passing. This means we have working Python libraries on Raspbian for GPIO, I2C and SPI.

Raspbian is now the official recommended kernel, so we’re fast approaching the point where a new Pi user can plug in our hardware, install our libraries, run an example and expect everything to work.

At the moment the Python GPIO library needs our gpio-admin library as well as the Python code. Soon we’ll package the two together as a .deb file, which will make things even easier. The gpio-admin and Quick2Wire Python libraries are on github so if you feel like experimenting, clone away and let us know how you get on! The libraries have examples and test code included.

If you want to try out the SPI code, you’ll need to upgrade to the latest Raspbian firmware. The kernel in the current Raspbian image (2012-07-15-wheezy-raspbian) supports I2C but not SPI; you can use Hexxeh’s firmware updater to get a later kernel, which supports both.

There are a couple of other things you’ll need to do: uncomment the two lines in /etc/modprobe.d/raspi-blacklist.conf which stop needed modules from loading, and add a line i2c-dev to /etc/modules to ensure that the relevant i2c module is loaded on boot-up.

Your raspi-blacklist.conf should then look like this:

# don't blacklist spi and i2c by default
# blacklist spi-bcm2708
# blacklist i2c-bcm2708

and  /etc/modules should look like this:

# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

PS Things are moving fast. If you want to keep up-to-date with what’s happening here at Quick2Wire, sign up for our free newsletter. Just fill in your email at the top of the page and click sign up. We won’t spam you, and you can unsubscribe at any time.


We’ve got an experimental version of our SPI library working. Like our I2C library, it’s written in Python and uses Python ctypes to drive the low-level interface provided by the kernel.

You can see our usual exciting binary counter demo

We’re driving an MCP23S17 16-bit SPI port extender, and sending the PORTA outputs to a Bar LED display.

There’s still lots of work to do but we’ll be releasing the current code on GitHub shortly.