EuroPython, PyCon UK and a John Pinner Award

I’ve been lucky enough to have been able to attend (and speak at) two great Python conferences – EuroPython and PyCon UK – (almost) every year since 2014. I’ve been to EuroPython in Berlin, Bilbao and Rimini, and this year it came to the UK – specifically, the beautiful city of Edinburgh.

I presented a new iteration of my Python and Raspberry Pi poster at both conferences this year (click to download):

The talk I developed for this year’s conference season was entitled Programming paradigms for physical computing and IoT. It introduces four programming concepts I feel are necessary for writing effective and meaningful code for describing how devices behave.

Here’s the video from me giving the talk at EuroPython:

https://www.youtube.com/watch?v=pRtpXzS2Weo

I evolved the talk a bit (and cut some stuff out for a shorter talk slot) for PyCon UK:

https://www.youtube.com/watch?v=T2R1JAnL7-I

I also gave a lightning talk about piwheels:

https://www.youtube.com/watch?v=7w_qgGZM4ao&feature=youtu.be&t=303

And part way through a very busy week of PyCon UK, in between running the education summit, presenting my poster, giving a lightning talk and my scheduled talk, I was announced as one of the recipients of the John Pinner Award, which was a really nice way to be recognised by the community that’s given me so much. Thanks to Daniele, Peter, all the other organisers and congratulations to all other recipients.

GPIO Zero: Developing a new friendly Python API for Physical Computing

For about the last 3 years, the de-facto method of accessing physical components via the Raspberry Pi’s GPIO pins has been a Python library called RPi.GPIO, created by Ben Croston, who originally built it to control his beer brewing process. Despite its humble beginnings in a personal hobby project, it’s ended up being used in projects of all shapes and sizes by users around the world, and it has a big presence in education. In the Foundation, we’ve used it in many of our learning resources, and we use it at Picademy, our teacher training course.

Physical computing is one of the most engaging activities for teaching computing, and has plenty of scope in computational thinking, programming skills and logic as well as projects being more relevant to young people (think build a robot vs. sorting arbitrary lists).

Hello world

RPi.GPIO permits configuring pins as inputs or outputs, and then controlling output pins as high or low, and reading the state of input pins. Observe the following code, which could be considered the “hello world” of physical computing (flashing an LED):

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

led = 17
GPIO.setup(led, GPIO.OUT)

while True:
    GPIO.output(led, GPIO.HIGH)
    sleep(1)
    GPIO.output(led, GPIO.LOW)
    sleep(1)

This “hello world” example is 11 lines long, and contains a number of oddities:

  • Import renaming (from RPi import GPIO also works)
  • Set pin numbering to BCM mode (actual GPIO pin numbers vs. location on the board) – this is necessary, no default mode
  • Set warnings off (the library prints warnings if you run a program twice because you already used that pin)
  • Constants GPIO.OUT, GPIO.HIGH, GPIO.LOW (True and False also work for high and low)
  • Passing reference to pin number integer around

These are the sorts of things a teacher would probably skip over explaining, the way they would if they were teaching the “hello world” of Java. It doesn’t matter what public static void main(String[] args) means, you just have to write it.

While this is not an intuitive or Pythonic interface, it does allow many components to be used. Some, like LEDs, can be as simple as this. Others, like sensors, require clever manipulation of pin state reading to be useful. This makes a whole range of projects to be created, enabling users to create their application in Python, instead of having to use a lower level language.

The current state of affairs

RPi.GPIO is the de-facto standard, and its common use soon led to inclusion in the standard Raspbian image provided by the Foundation. It’s a Python module implemented in C (the project lives on sourceforge) and its features include:

  • Configure pins as input or output
  • Read inputs (high/low)
  • Set outputs (high/low)
  • Wait for edge (wait for input to go high/low)
  • Pin event detection (callback on pin input state change)
  • Software PWM (pulse-width modulation)

There’s a broad use of RPi.GPIO. It’s used in the Raspberry Pi Learning Resources, there are 23k code search results on github.com.

Sudo

In Raspbian Wheezy (Raspberry Pi optimised distro based on Debian Wheezy), root access was needed to access the GPIO pins. Users had to run Python files with sudo because the underlying code runs mmap() on /dev/mem . This meant that opening IDLE from the main menu did not allow GPIO code to be run, and IDLE had to be opened from the Terminal with sudo idle &. Since the release of Raspbian Jessie, the Pi user was given access to the GPIO pins via /dev/gpiomem, which makes a huge difference to the user experience, particularly for use in education or with beginners.

Motivation

I’ve been thinking for a while that there must be a way to make programming for physical computing more accessible. I gave a talk at the Cambridge Raspberry Jam in September, Build a Python API for Raspberry Pi Hardware, which included some basic code examples (wrapper classes around common RPi.GPIO code for LED, etc.) but mostly focused on packaging and distribution. The idea was to show add-on board manufacturers how to provide a Python module to go alongside their products, enabling users to make the most of it. This is something Pimoroni do very well.

After presenting the talk, I wondered if my example LED class, and similar abstraction classes would be useful to others. I thought of showing teachers how they can create such classes to make things easier for their students. Teachers do often say they don’t use Python because it’s too hard – but really it’s not Python that’s hard, it’s the modules they’re using making it more complicated than it needs to be, or the poorly written code they’re sourcing from the web.

The main problem with RPi.GPIO is that there’s too much boilerplate code needed to get started. The “hello world” LED program shouldn’t be 11 lines, and it shouldn’t contain anything too complex to explain to children. When you get to input devices, even simple ones like a push button, you’re forced to explain pull-up and pull-down circuits, a concept coupled with detecting falling and rising edges. I’m not saying it’s not an important concept, and that it should be taught at some point, but it shouldn’t be a barrier to entry. It just causes friction to anyone getting started. I’m talking about young people, perhaps Primary School or early Secondary, who have been programming with Scratch. The jump to Python shouldn’t be out of reach or they’ll never leave the comfort of drag-and-drop block programming.

Inspiration

Pimoroni have some great products to accompany the Raspberry Pi (check out their range of HATs) and they do a great service to their customers by providing Python modules for each of them (created by their software developer, Phil Howard). I’ve used many of their products, and the libraries and examples provided enable you to dive straight in, start prototyping and coding up an idea. There are other great modules available, such as picamera, the Python library for the official camera module, created by Dave Jones, allowing users to easily add photo and video functionality to their Python applications.

There’s also PyGame Zero, a zero boilerplate wrapper for PyGame created by Daniel Pope. If you haven’t seen it already, it’s well worth a try. Create an empty file, run it with pgzrun myfile.py and you have a game window. Add one line to change the background colour, add another couple to set the window height and width, add another and you have a playable character. It’s brilliantly simple to make a simple game and there’s no limit on where you can take it. The motivation for this was that some teachers at PyConUK 2014 said PyGame was too hard to teach with. I felt this needed doing for physical computing. It needed to be intended for teachers, children and beginners, but also be useful for hobbyists who knew their way around Python.

What do you think?

I threw my LED class example into a GitHub repo called gpio-abstraction (soon renamed gpio-components) and added some basic code. I demonstrated it to a few of my Foundation colleagues and it went down well. I showed Eben and he said “I’ll have one of those. Can you get it ready for the next Raspbian release?”. I said I wanted to test it out more and get feedback from some teachers, but probably have it ready for the release after. I then emailed some friends asking for their opinion:

Screenshot from 2016-01-05 00-30-09

I got a positive response from them all, and decided to press on. Dave (author of picamera) said he had a few minor observations:

Screenshot from 2016-01-05 00-58-16 And he continued… Screenshot from 2016-01-05 01-02-46

Then the next day…

Screenshot from 2016-01-10 16-24-16

As well as using GitHub issues for sourcing ideas feedback, I decided to also create a Google Doc to lower the barrier to entry for any teachers who wanted to contribute.

Name?

I posted an issue on GitHub asking for suggestions for a name:

Screenshot from 2016-01-04 23-54-23

I then had the idea to borrow the Zero from PyGame Zero, seeing as I was sharing the philosophy of removing boilerplate to make it easier for use in education:

Screenshot from 2016-01-04 23-54-37

Les replied, suggesting “PiZero?”. Note the timing. This was before Raspberry Pi Zero was released, but obviously I was aware it was coming. In fact, it’s part of the reason I liked the idea of adding another Zero into the mix. I couldn’t really explain why calling the library Pi Zero wasn’t a good idea, but as Dave agreed GPIO Zero was a good name, I proceeded, renamed the repo and published an initial pre-release to PyPI.

The new hello world

Here’s my “hello world” program with GPIO Zero:

from gpiozero import LED
from time import sleep

led = LED(17)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)

or even:

from gpiozero import LED

led = LED(17)

led.blink()

More examples:

led = LED(17)

led.on()  # all on
led.off()  # all off
led.toggle()  # swap state of led
led.blink()  # on for 1 second, off for 1 second, continuously in the background
led.blink(on_time=2, off_time=2)  # change on/off time to 2 seconds
led.blink(n=10)  # stop blinking after 10 iterations
led.blink(n=10, background=False)  # 10 iterations, in the foreground so wait to complete before proceeding

PyConUK

My Foundation colleagues and I attended PyConUK, where we ran some workshops and sessions on the Education track, and I demonstrated it to some teachers who said it was exactly what they needed. I struggled to get any feedback other than “it’s great” – no constructive criticism, just general positivity. I also gave a physical computing talk on the main track, and mentioned by work-in-progress project GPIO Zero at the end. RPi.GPIO’s author Ben Croston happened to be sitting in the talk so I went over to ask what he thought at the end. He said he liked it and that he’d never intended RPi.GPIO to be an end-user library and expected someone else to provide a better API.

CamJam Kit 1

I started adding interfaces to all the components I could lay my hands on. I started with the CamJam EduKits as they contain simple everyday components. Kit 1 comprises a set of LEDs, a button and a buzzer. There are worksheets that come with the kit start with flashing the LEDs and programming a traffic lights sequence. There’s scope to add the button and buzzer for different road crossings, then go on to reaction games and morse code.

Button

Input devices in RPi.GPIO are rather obtuse. As well as configuring a pin as an input with GPIO.IN, you usually also provide a pull state: pull-up or pull-down. Pull-up means the circuit is wired to a GPIO pin and a ground pin, whereas pull-down means the circuit is wired to a 3V3 pin and a GPIO pin. So when a pulled-up button is not pressed, the GPIO pin state is high, and low when it is pressed. This is reversed for a button in a pull-down circuit.

To poll the input state of a pulled-up button using RPi.GPIO:

GPIO.setup(4, GPIO.IN, GPIO.PUD_UP)

while True:
    if not GPIO.input(4):
        print("Pressed")

The same code for a pulled-down button:

GPIO.setup(4, GPIO.IN, GPIO.PUD_UP)

while True:
    if GPIO.input(4):
        print("Pressed")

These two snippets of code do exactly the same thing for differently wired buttons, but require a logic shift. Alternatively, you can use if GPIO.input(4) == GPIO.LOW and if GPIO.input(4) == GPIO.HIGH but you still have the same issue. My instinct is to jump at the chance to avoid the GPIO constants and use Python’s Truth evaluator as it seems more natural.

However, in GPIO Zero, you create a Button object, which assumes the common pull-up circuit by default. Then to check its state, you access the is_active property. The alias is_pressed is provided for the Button class:

button = Button(4)

while True:
    if button.is_pressed:
        print("Pressed")

To use the pull-down alternative, you just provide pull_up=False in the init parameters:

button = Button(4, pull_up=False)

while True:
    if button.is_pressed:
        print("Pressed")

Note that the button.is_pressed code logic remains unchanged and is not coupled with the pull state.

Wait for edge

Another useful function in RPi.GPIO is wait_for_edge, which halts the program until a GPIO event is activated. For example:

GPIO.setup(4, GPIO.IN, GPIO.PUD_UP)

while True:
    GPIO.wait_for_edge(4, GPIO.FALLING)
    print("Pressed")

The edge needs to be the opposite direction of the pull state (normal state is high, and a falling edge indicates the button was pressed). The opposite case:

GPIO.setup(4, GPIO.IN, GPIO.PUD_DOWN)

while True:
    GPIO.wait_for_edge(4, GPIO.RISING)
    print("Pressed")

In GPIO Zero, the pull-up case:

button = Button(4)

while True:
    button.wait_for_press()
    print("Pressed")

And the pull-down case:

button = Button(4, pull_up=False)

while True:
    button.wait_for_press()
    print("Pressed")

Again, there’s no need for the configuration and edge type to be coupled, so it’s abstracted away.

Callbacks

Another very useful feature of RPi.GPIO is event detection with callbacks:

GPIO.setup(4, GPIO.IN, GPIO.PUD_UP)

def pressed(pin):
    print("Pressed")

GPIO.add_event_detection(4, GPIO.FALLING, pressed)

This means whenever the button is pressed, the pressed function will be run.

The equivalent in GPIO Zero is passing in a function to the when_activated property (the Button alias is when_pressed):

button = Button(4)

def pressed():
    print("Pressed")

button.when_pressed = pressed

Note that in the RPi.GPIO example, the function was declared to take a pin argument which was unused. The pin number is always passed in to the callback function. This can be used to determine which pin caused the callback to run:

GPIO.setup(4, GPIO.IN, GPIO.PUD_UP)

def pressed(pin):
    print("Pin %s pressed" % pin)

GPIO.add_event_detection(4, GPIO.FALLING, pressed)

In GPIO Zero, no argument is necessary, but if the function takes one, the device object will be passed in, which can be inspected for its pin number:

button = Button(4)

def pressed(button):
    print("Pin %s pressed" % button.pin)

button.when_pressed = pressed

As well as custom functions, you can also pass another object’s method in as the callback:

from gpiozero import LED, Button

led = LED(17)
button = Button(4)

button.when_pressed = led.on
button.when_released = led.off

This example uses both the when_pressed (when_activated) and when_released (when_deactivated) properties to allow a LED to be lit when the button is pressed, and unlit when released.

PWM

Another obtuse but useful feature of RPi.GPIO is PWM (pulse-width modulation). Oddly, unlike with regular in/out pins, this involves some object-oriented code:

GPIO.setup(17, GPIO.OUT)

p = GPIO.PWM(17, 100)  # pin 17, frequency 100Hz

p.start(0)  # initial duty cycle
for i in range(101):
    p.ChangeDutyCycle(i)
    sleep(0.01)

This code would fade the brightness of an LED from 0 to 100%.

We decided to keep the LED class in its simple on/off form, and provide a separate PWMLED class for configurable brightness. The PWMLED interface provides the standard on() and off() methods but also provides a value property:

led = PWMLED(17)

for i in range(101):
    led.value = i / 100
    sleep(0.01)

Full colour LED

Another common component is the RGB LED: three regular LEDs inside one casing. With a binary interface to each LED, you can only create seven different colours by combining the three primary colours. However, with PWM to control the brightness of each, you can combine them in different ways. It’s not going to be particularly accurate but it does give you much more flexibility:

led = RGBLED(red=2, green=2, blue=4)

led.red.on()  # full red
led.color = (1, 0, 1)  # purple
led.blue = 0.3  # dim the blue value to 0.3, now (1, 0, 0.3)

Boards and collections

Traffic Lights

lights = TrafficLights(9, 10, 11)

lights.on()  # all on
lights.off()  # all off
lights.red.on()  # red on
lights.toggle()  # swap state of all lights
lights.blink()  # blink all lights together

Traffic HAT

The Traffic HAT is a neat add-on board using the official Raspberry Pi HAT specification, and handily provides three LEDs (in traffic light colours), a button and a buzzer. I created an interface to this board, partly as a proof-of-concept, partly as a demo to other add-on board manufacturers to show how it can be done (and why it’s useful):

th = TrafficHat()

th.on()  # all lights and buzzer on
th.off()  # all lights and buzzer off
th.lights.on()  # all lights on
th.lights.off()  # all lights off
th.lights.red.on()  # red light on
th.lights.toggle()  # swap state of all lights
th.lights.blink()  # blink all lights together
th.button.when_pressed = th.on
th.button.when_released = th.off

Note that this class does not need initialising with pin numbers as they’re already known.

An optional feature of this class is enabling PWM on the LEDs:

th = TrafficHat(pwm=True)

th.lights.red.value = 0.2
th.lights.amber.value = 0.4
th.lights.green.value = 0.8

CamJam Kit 2 – Sensors

The second CamJam EduKit contains a Motion Sensor, Light Sensor and Temperature Sensor, broadening the scope for hobby projects into things like security alarms, darkness triggered lights, temperature indicator lights and such.

PIR Motion Sensor

The PIR (passive infra-red) motion sensor is a commonly used component and many people find them rather difficult to deal with in software. Because they’re digital and only yield high or low, you’d think you’d have to detect the value changing with one of the edge detection methods, but they’re very jittery so you end up writing functions to check the value ten times in a second and assuming motion if more than half are high. For example, in RPi.GPIO:

def check_motion():
    sleep(0.1)
    return GPIO.input(14)

while True:
    if sum(check_motion() for i in range(10)) > 5:
        print("Motion detected")

We implemented something similar to this, but the queue fills automatically in the background, so you can check the motion state at any point, without having to wait. It’s also configurable so you can specify the queue length, the threshold and more (if you want to). We picked some sensible defaults that seem to work reasonably well, and of course the API exposed makes it really straightforward to use:

pir = MotionSensor(4)
led = LED(17)

pir.wait_for_motion()  # alias for wait_for_active
pir.wait_for_no_motion()  # alias for wait_for_inactive
pir.when_motion = led.on  # alias for when_activated
pir.when_no_motion = led.off  # alias for when_deactivated
pir.motion_detected  # alias for is_active

Light Sensor

Similarly, the LightSensor interface:

sensor = LightSensor(5)
led = LED(17)

sensor.wait_for_light()  # alias for wait_for_active
sensor.wait_for_dark()  # alias for wait_for_inactive
sensor.when_dark = led.on  # alias for when_deactivated
sensor.when_light = led.off  # alias for when_activated
sensor.light_detected  # alias for is_active

Temperature Sensor

There’s already a Python library for the one-wire temperature sensor, and initially I imported it and added a couple of aliases to make it more like the other interfaces. However, as the library developed, it became less like the others, and we decided to leave it out for the major release. We intend to bring it back in at some point in a way that will be purely compatible with other GPIO Zero component interfaces.

CamJam Kit 3 – Robot

By this time, CamJam kit 3 had been announced. I’d heard it was going to be a build-your-own-robot kit.

Motor

Around this time I had already been playing with some simple motors using a motor controller board on the Pi. The way a motor works is you control two output pins: if one is high and the other low, it drives in one direction; if swapped, it goes the other way. I wrapped these steps in the obvious method names and we had a Motor class that worked pretty much as simply as the LED class:

motor = Motor(forward=17, backward=18)

motor.forward()  # drive the motor forward
motor.backward()  # drive the motor backward
motor.reverse()  # reverse direction of the motor
motor.stop()  # stop the motor

Robot

Stick two motors on a chassis and you have yourself a robot:

robot = Robot(left=(17, 18), right=(22, 23))

robot.forward()  # drive the robot forward
robot.backward()  # drive the robot backward
robot.left()  # drive the robot left
robot.right()  # drive the robot right
robot.reverse()  # reverse direction of the robot
robot.stop()  # stop the robot

I also provided pre-configured robot interfaces for some common motor controller boards to save users having to configure the pin combinations:

rtk = RyanteckRobot()
cmkr = CamJamKitRobot()

Analogue

The Raspberry Pi has no native analogue pins. However, by wiring up an ADC (analogue-to-digital converter), you can connect up a number of analogue signal channels.

MCP3008

A while ago I was introduced to the MCP3008 ADC for a project involving a bunch of linear and rotary potentiometers. I found some useful code written by Martin O’Hanlon, who created a wrapper class around some SpiDev code, providing easy access to data values. He kindly contributed it to GPIO Zero and we normalised its values from 0-1023 to 0-1. I started playing with it. The simplest example is a loop polling the value property while spinning a potentiometer around:

pot = MCP3008()

while True:
    print(pot.value)

I then added an LED and used the potentiometer to dial up and down the brightness, since both are on a scale from 0-1:

led = PWMLED(2)
pot = MCP3008()

while True:
    led.value = pot.value

Note there are 8 channels on the MCP3008, and the default channel is 0. Use MCP3008(channel=n) to specify another channel. The Pi also allows multiple ADCs to be connected, so you can also provide a non-zero device number with MCP3008(device=d, channel=c).

Then I wired up three potentiometers to an RGB LED to the same effect:

led = RGBLED(2, 3, 4)
red_pot = MCP3008(channel=0)
green_pot = MCP3008(channel=1)
blue_pot = MCP3008(channel=2)

while True:
    led.red = red_pot.value
    led.green = green_pot.value
    led.blue = blue_pot.value

#76 while True: led.red = pot.value

Then I thought that this must be a common use case – that you’d often want to connect the value of one input device directly to an output device, and wondered if there could be a way to do this automatically. As I thought this, it seemed stupid in my head. But it would be handy to not have to loop it over constantly updating, hogging up the program so nothing else can happen, or making it hard to update because you’re trying to do something else. I wrote an issue on GitHub explaining the idea, and asking if anything could be possible. I almost didn’t submit the issue as I thought it was bound to be impossible:

Screenshot from 2016-01-05 00-12-37

I was thrilled to see Dave’s reply:

Screenshot from 2016-01-11 22-38-05

A few comments of discussion later and he had an implementation plan, which soon became a pull request. My previous examples became:

led = PWMLED(2)
pot = MCP3008()

led.source = pot.values

and:

led = RGBLED(2, 3, 4)
red_pot = MCP3008(channel=0)
green_pot = MCP3008(channel=1)
blue_pot = MCP3008(channel=2)

led.red.source = red_pot.values
led.green.source = green_pot.values
led.blue.source = blue_pot.values

Dave implemented the values iterator property on every device, and the source property on every output device. Another way of writing:

button.when_pressed = led.on
button.when_released = led.off

could be:

led.source = button.values

Probably not as intuitive in this case, but it demonstrates how input devices can feed their state into other devices. The same applies to ensuring multiple output devices are synchronised is to set the source of one as the values of another:

red.source = button.values
blue.source = red.values

Or even, the value of one sensor being inverted by use of a custom generator:

def invert(pot):
    while True:
        yield 1 - pot.value

led.source = invert(pot)

GPIO Zero Timeline

  • 12 Sept – CamJam talk sparked idea
  • 14 Sept – Initial commit on GitHub
  • 15 Sept Named GPIO Zero, first PR, first alpha released on PyPI
  • 23 Sept – Mentioned in talk at PyConUK
  • 28 Sept – v0.6 public beta 1
  • 9 Oct – v0.7 public beta 2
  • 16 Oct – v0.8 public beta 3
  • 25 Oct – v0.9 public beta 4
  • 29 Oct – Featured in The MagPi
  • 16 Nov – v1.0 released
  • 21 Nov – Released in Raspbian Jessie

v1.0

  • ~200 commits
  • 2 contributors (+4 minor contributions)
  • 103 GitHub issues (53 issues, 50 PRs)
  • 4 alpha releases
  • 4 beta releases
  • 68 days between initial commit and major release

Future development

  • Add more components
  • Integrate more add-ons
  • Add test suite
  • Replace RPi.GPIO dependency
  • Promote use of “gpiozero standard” to allow other modules to provide objects which plug-in to gpiozero objects easily (e.g. source/values)

What have I learned?

  • Issue-driven development works really well
  • Dave Jones is awesome
  • User-focused APi design is important
  • Getting feedback from teachers is hard
  • Getting code contributions is hard
  • Getting documentation contributions is easier
  • Documentation by example is more empowering than API documentation (though both are useful)

Install GPIO Zero

GPIO Zero now comes pre-installed with Raspbian Jessie available from raspberrypi.org

On an older Jessie or Wheezy image, install with:

sudo apt-get update
sudo apt-get install python-gpiozero python3-gpiozero

Links

Thanks

A huge thanks to Dave for his voluntary contributions to GPIO Zero, making it something really special. To Ben Croston for his excellent work on RPi.GPIO, and giving a foundation to GPIO Zero. And thanks to everyone who tested out the beta releases and made projects with it so far.

Review of the Year 2014

Last December I started my job at the Raspberry Pi Foundation and this time last year, having just completed my first month, I wrote my review of 2013 and all the events which led up to that move.

Here is a round-up of all that’s happened since then.

Talks & Conferences

This year I gave my first full conference talk, my first overseas conference talk, my first keynote, and many more talks throughout the year! I gave over 40 talks and workshops in 2014, up from 32 in 2013.

ep2014-badge
My favourite conference badge of the year

The highlights:

  • I attended the BETT education conference representing Raspberry Pi
  • I took my first overseas work trip to Brussels for FOSDEM (Free and Open source Software Developers’ European Meeting)
  • I gave a keynote with Carrie Anne Philbin at Raspberry Jamboree 2014
  • I ran a Raspberry Pi camera workshop at Cheltenham Science Festival
  • I spoke at 5 Python conferences:
  • I spoke for the IMA (Institute of Mathematics and its Applications) at MMU in Manchester
  • I gave 17 talks in schools, universities and community spaces on my USA tour (more below)

See my full list of talks with links to videos and slides on my talks page.

lvl1-colour
Speaking at a hackspace in America

I also got to meet creator of the world wide web Tim Berners-Lee at the Open Data Institute Summit where I was supporting Amy Mather who was speaking at the event.

Meeting Tim Berners-Lee with Amy and Dan Mather
Meeting Tim Berners-Lee with Amy and Dan Mather

Interviews

I gave a few interviews for magazines and websites:

1486653_10151926059031863_974877116_n
Linux Voice
Me on the front of Linux Format magazine
Me on the front of Linux Format magazine

USA Tour

I was asked to go on a tour of America to do some outreach work for Raspberry Pi – and I said I’d be travelling from New York to Salt Lake City. I planned a route based around requests for visits and ended up covering 4200 miles in a hire car, giving 17 talks in schools, universities and hackspaces. I had a brilliant experience, met some great people and spread the word about what the Foundation is doing.

usa-final

The places I visited:

  • New York City, New York
  • Washington, DC
  • Raleigh, North Carolina
  • Greensboro, North Carolina
  • Charlotte, North Carolina
  • Pigeon River, Tennessee
  • Lawrenceville, Georgia
  • Atlanta, Georgia
  • Chattanooga, Tennessee
  • Talladega, Alabama
  • Somerville, Tennessee
  • Louisville, Kentucky
  • St. Louis, Missouri
  • Colombia, Missouri
  • Denver, Colorado
  • Boulder, Colorado
  • Provo, Utah
  • Logan, Utah
  • Salt Lake City, Utah

You can read a full account of my trip on the Raspberry Pi blog: Ben’s Mega USA Tour

Raspberry Pi Website

In the first few months of the year I worked hard on building a new website for the Raspberry Pi Foundation, extending the existing blog in to a full website with various sections and numerous components. This was launched in April and received praise from the community. It has evolved somewhat since its initial release and took on some new design tweaks recently with complementary illustrative graphics from Sam Alder.

The website now features:

raspberrypi.org in early January 2015
raspberrypi.org in early January 2015

Pi Weekly

I’ve continued to run Pi Weekly, putting out a newsletter each week with help from Ryan Walmsley, who recently stepped down to concentrate on his university studies.

Now at its 81st issue, not having missed a single week since launching in June 2013, it’s going strong with a subscription base of over 11,000, up almost double in a year.

Raspberry Pi Learning Resources

I wrote a number of learning resources as part of my role at Raspberry Pi. Some notable ones being:

I’ve been working on other projects such as the upcoming Chef HAT (sous vide cooking with Raspberry Pi and Energenie) with Rachel Rayns, which will lead to a set of new resources and maybe even a bank of open source cooking recipes!

I’ve also been running workshops and giving presentations at Picademy – the free teacher training course we started running this year, introducing teachers to using the Raspberry Pi in the classroom and giving them the confidence to successfully deliver the new computing curriculum.

Open Source Projects

As well as numerous contributions to existing open source projects, I’ve released my first two Python modules which can be found on PyPi and installed with pip:

  • energenie – for controlling power sockets remotely with a Raspberry Pi (this included modularising and packaging the work of Amy Mather from her work experience at Pi Towers)
  • pyjokes – one line jokes for programmers

I’m currently working on packaging energenie for Debian, and have some other packaging work to do once I’ve got the hang of it.

I’ve also made a name for myself in my advocacy of GitHub – teaching people how to use it or get more from it, and introducing teachers to using it in it education.

And here’s what my year of public GitHub contributions looks like:

github-20142015

I’ll be doing more of the same in my role at Raspberry Pi, hopefully producing some more projects and writing more resources.

I’ve just bought myself a nice new camera so I’ll be learning how to use it and posting photos to Flickr at flickr.com/photos/ben_nuttall

Linux Voice Interview with Raspberry Pi Education Team

Back in February at the Raspberry Jamboree, my colleagues Carrie AnneClive and I were interviewed by the Linux Voice team about Raspberry Pi‘s views on computing education.

Linux Voice is a fantastic new free software magazine which was funded by a crowdfunding campaign on Indiegogo at the end of last year. I backed it as soon as I heard about it, and I eagerly anticipated the arrival of its first issue. We’re now five issues in and I’ve loved every one – the guys are doing a great job. I highly recommend a subscription!

From the beginning they committed to making all their articles available for free after up to nine months from publishing, released with a Creative Commons licence. Some material has been published early, such as the brilliant piece on Grace Hopper from Issue 3. Luckily for us, the interview they conducted with us, which featured in Issue 2, was released in full earlier this month, so I’m pleased to be able to share it now!

Go read it – Linux Voice: Education, Education, Education

The interview was also posted on opensource.com

2013 in Review

This year I’ve learned lots, run events, helped mentor young people, contributed to open source, engaged in much community activity, made and developed some strong friendships and built myself a new career.

OH Digital

I began this year working as a web developer at OH Digital, having started there just two months before the previous Christmas. OH Digital are primarily a WordPress development agency; initially I was sceptical of the use of WordPress as a full CMS, but grew to realise its potential the more I used it in a range of commercial websites. We specialised in delivering a full build to a client, from specification, through design and development iterations to the launch, and also hosting, administration, third-party integration and maintenance. Our design work always was done externally, as we had no in-house designers, but had connections with quality local design companies. It meant we got to concentrate on development according to the specification (which we’d created ourselves by working directly with clients) and outsource the visuals and interfaces to professionals who could meet our clients’ needs and provide us with excellent designs to work from.

Working on all levels – specification, user experience, front-end markup and styles, back-end programming and Linux systems administration – gave me excellent experience in working professionally, being involved in the whole build, and meant I got to see a project through from concept to launch and see it in action once live. And being lucky enough to work alongside very talented designers meant I was always very proud of the piece of work we’d produce after each project – not only because of the delivery of the technical solutions involved but because the websites we made looked brilliant. I would be proud to say I worked on a site and would often show people the finished product. Here is a selection of the projects I worked on at OH Digital:

Manchester Raspberry Jam

Throughout the year I continued to run the Manchester Raspberry Jam. This started in July 2012 and I ran one every month since then, skipping just two (March, for the Jamboree, and September when I was in Berlin) which we usually had around 30 – 60 people attending. The Manchester Jam was the first in the UK and they soon spread all over the country and the rest of the world. The events I ran were very practical focused, and we regularly had a range of people attending – including young people and families, and everyone was encouraged to collaborate on projects and learning. At the event in November – Manchester Raspberry Jam XVI – we had 80 people signed up and a further 20 on the wait list. This event was attended by several members of the Raspberry Pi Foundation and we ran a full track of talks upstairs as well as the usual hacking downstairs. The talks were all video recorded by a volunteer AV Team (thanks Les, Dan, Olly & Tony).

A particular success of the Raspberry Jam has been one of the young people I have mentored for the last couple of years – 14 year old Amy Mather (known as Mini Girl Geek). Amy is a really keen and very bright young coder and maker. At last December’s Jam, we started a small coding exercise – a test-driven implementation of Conway’s Game of Life in Python, for her to learn coding techniques and the language of Python. She came back to the next Jam in January with a fork of the original code, ported to work with PyGame, a gaming library for Python, rather than just drawing ASCII characters in the terminal. She improved upon the PyGame version some more at that Jam, adding features and learning more about Python, and then came back the next month with a version of the code powering a small LED matrix from a Raspberry Pi and an Arduino. She was then asked to present this at the Raspberry Jamboree in March (just 13 years old at the time). The video of her presentation was a big hit online (currently over 50,000 views) and was praised by many people including Kent Beck and Jimmy Wales. The video was also featured on the Raspberry Pi blog.

Amy went on to speak at bigger events such as CampusPartyEU at the O2 in London (on stage with George Osborne and Jimmy Wales), Wired Next Generation, Wuthering Bytes, and won the European Digital Girl of the Year Award presented in Lithuania. I’m very proud of everything she’s achieved and I’m pleased to have been lucky enough to be one of the many people who helped her along the way – and given her the chance to shine.

STEM

I also attended an event at Manchester University for STEM Ambassadors to be introduced to the Raspberry Pi. After meeting the coordinators of STEMNET, we discussed the idea of running a Raspberry Jam for schools – and so over several emails and phone calls, we put an event together, invited schools to attend and ran the first STEM Raspberry Jam. This kickstarted Raspberry Pi activity in the STEM network of the North West and there have since been a number of Raspberry Pi sessions run by the STEM team with a team of trained Ambassadors – in schools and colleges around the North West, introducing young people to programming and making projects with the Raspberry Pi.

Pi Weekly

About six months ago I had an idea to set up a weekly Raspberry Pi email newsletter featuring news and projects from the community – and invited Ryan Walmsley to join me in running it. We called it Pi Weekly. We grew steadily and a few weeks after launch it was featured on the Raspberry Pi blog – which sent out subscriber count through the roof. We then sought sponsorship to continue running at the new capacity, and developed new features as time passed. I worked on the website, the newsletter and the generator over time, and wrote up a full account of its evolution on my blog. At the end of 2013, we’d sent out 28 issues and had over 5,600 subscribers. This week, Pi Weekly was translated in to French by a Pi enthusiast with a Raspberry Pi news website.

Manchester CoderDojo

Another project I’ve been involved with in the last year has been the Manchester CoderDojo. This is a youth club for kids learning to code and make things. This was started in December 2012 by Steven Flower, and we started out at Madlab but after a few months outgrew the space and moved to a new venue at the Sharp Project. I volunteered as a mentor and coach at each of the events in 2013 up to November, where I ran sessions in Python, HTML/CSS, WordPress and using the Raspberry Pi. I recently revamped the website and set up a Pi Weekly style newsletter we now send out to parents and supporters.

User groups and Conferences

I have been attending user groups in Sheffield and Manchester since late 2009 / early 2010, and this year has been my peak in attendance. This year I’ve been regularly attending Python North West, PHPNW, XP Manchester, manc.js, Manchester Maths Jam, IMA North West TalksManchester Werewolf and Preston GeekUp, as well as helping out with Manchester Girl Geeks, volunteering for Manchester CoderDojo and running Manchester Raspberry Jam. I visited a few events further from home, as one-offs, such as the York Raspberry Jam and Blackpool GeekUp I gave many talks at these user groups throughout the year, the majority related to Raspberry Pi. I gave a total of 32 talks in 2013, including a discussion panel at the Raspberry Jamboree and a couple of talks at user groups in Berlin.

I also attended the first Raspberry Jamboree (Manchester), my first MozFest (London), my second Oggcamp (Liverpool), my third Barcamp Blackpool, my third Code Retreat, my third U3, my third Maths Jam Conference (Stone) and my fifth PHP North West conference (Manchester).

Open Source

This year I submitted my first patch to Ubuntu – a fix for the Guake package (Quake-style dropdown terminal) which was merged in to Ubuntu 13.10 (Raring Ringtail) and then-upcoming 13.10 (Saucy Salamander). See the changelog on launchpad.

guake-fix

I also fixed minor bugs in a number of smaller projects such as the Python Koans, as well as working on a number of small personal and community projects which are open source, such as Python Intro, Acacia Acuminata, Acacia Vanilla and Pi Weekly.

My (public) GitHub contributions of 2013:

bn-github-2013

from github.com/bennuttall on 4th January 2014.

Bravery Award

I was also presented with an award for the river rescue I conducted the previous September with friends from the canoe club. We each received the Chief Fire Officer’s Commendation for bravery at a presentation in the Ramsbottom Fire Station. See the articles from the Manchester Evening News: Award for Brave Kayakers who Saved Man’s Life and the Greater Manchester Fire & Rescue Service: River Rescuers Presented with Bravery Award

Raspberry Pi Foundation & 2014

In mid-October, around the time I celebrated 1 year at OH Digital, I was invited to visit the Raspberry Pi Foundation and was offered a job there. Obviously I accepted, and made plans to move to Cambridge. Prior to this opportunity I had no intention to leave Manchester, and certainly wasn’t looking for a reason to move on from my job or from the city – but the chance to work full time promoting the thing I have dedicated much of my time and effort to advocate purely because I believed in it and the Foundation’s mission – meant that there was no hesitation in taking the opportunity to move. I moved at the end of November, two weeks after my final Jam – which was a huge success, and a great chance for me to show the Foundation what I’ve been building up over the last 18 months.

Around the time this happened I had just started taking driving lessons again, and I managed to pass my test a week before I moved to Cambridge – although I didn’t get a car until around Christmas. Finally at the age of 25 I am no longer a pedestrian!

ben-pass-test

My role at the Foundation will be in development and outreach. Initially I’ll be working on a revamp for the website, which will be launching early 2014, diversifying the content to include educational resources, projects and such in a way that helps young people learn and aids teachers delivering material, so as to progress with the Foundation’s educational objectives. Also I will be working with young people, speaking about Raspberry Pi at events, helping to make the learning experience with Raspberry Pi more engaging, doing general outreach and fulfilling the Foundation’s mission as well as writing educational material, building tools, working on Pi projects and doing further development and maintenance on the website. I was there for three weeks before heading back to Sheffield for Christmas, and loved it so far. I’m getting on really well with the team, and getting the chance to see the amazing things we have in development. Big things coming in 2014! We hit the 2.3 million sales mark at the end of 2013, which is incredible. We also have the wonderful award winning teacher and new author Carrie Anne Philbin joining the team (starting tomorrow!) which I’m particularly excited about, and very pleased for her to (like me) be getting the chance to work on what she loves. See my introduction: Welcome Ben! and my first contribution to the Raspberry Pi blog: Pi Powered Ping Pong Pursuit.

I plan to start a CodeClub in Cambridge in 2014. It’s something I’ve wanted to do for a while, but never had the chance. Now I’m working for the Foundation it’s important for me to get involved in this and see how young people learn, how they interact with technology and other people, and what they find interesting and engaging. As well as providing the means for a group of young people to learn to code and build things, I will be learning lots about the process for myself. Starting a CodeClub is something of a resolution of mine for the new year – and I’ll also try to personally do more hands-on projects, particularly with the Pi. I’ll also aim to make my way through some books I’ve had but not worked through yet – particularly Seven Languages In Seven Weeks. It’s about time.

Thanks to all the friends I made in Manchester – particularly those involved in the machinery of the tech community, who really do make things happen for people, and often (without realising it) get the ball rolling for many people’s personal and professional lives, and put them on a path to where they ought to be. Special thanks to Madlab founders Dave Mee & Hwa Young, who gave me the chance to learn, and then the chance to shine; to Andrew Disley, who ran Manchester GeekUp – which was my gateway to all of this; to Jag & Hannah Goraya who ran the Sheffield tech scene (Jag hosted my first ever tech event); to Steven Flower for doing what he does so well, and bringing out the best in people; to Sam Tuke who helps me understand and appreciate freedom; to Jeremy Coates for always keeping an eye on me; to Jon Spriggs for helping me and others do anything we want to do, and for sharing all he has with the world (with such passion); to Robie Basak and Sam Headleand for being alongside me all this year; to Lisa Mather for being like a second Mum; to Les Pounder for making great things happen and living the dream; and to all the geeks of the North West scene who’ve been like a family to me the last few years.