GPIO Zero for the Raspberry Pi – by George, I think I’ve got it!

When Ben Nuttall announced his GPIO Zero Python library a few weeks ago, I was very sceptical. It seemed to me to be dumbing-down the flexibility of RPi.GPIO. I didn’t like it. The truth is, I’d got so comfortable (and, perhaps, complacent) with RPi.GPIO that I was resistant to the idea that Python could be used in a different way to control the GPIO pins of the Pi.

However, Cat Lamin, who came up with the idea of Coding Evenings, asked on Twitter whether someone could help her to understand GPIO Zero and whether it could be used to teach slightly younger children (year 6, I believe it was) about the basics of Python in an exciting way where they could interact with the real world. So, spurred on by Tim Richardson (who had attended a Peterborough Coding Evening where Ben spoke about the new library), I decided to take the plunge. I took the robot I’d built using CamJam EduKit 3 and installed GPIO Zero on it. I then looked at the documentation for the library and within about half an hour (some of which was me being really stupid) I had a working robot with very few lines of code:

from gpiozero import Robot
import time
robot = Robot(right=(10,9), left(8,7))


The above is a simple ‘demo’ script that moves the robot in all four directions and then stops it. It’s so blindingly easy!

RPi.GPIO still has its place (in fact, it’s what GPIO Zero is built on) if you want to do complicated things or if you want to drill down into the lower level stuff. But for just doing things like interacting with simple electrical components, and doing it in a clear, concise manner, GPIO Zero is tough to beat.

From an education point of view, it’s got great possibilities. If a child is moving from a visual programming language like Scratch to text-based programming in Python, GPIO Zero is a healthy stepping-stone.

So, I guess that teaches me a valuable lesson – don’t jump to conclusions if you haven’t tried something!

If you’d like to install and try out the library yourself, go to this page and follow the instructions. If you want a concise presentation showing you what you can do with it at a basic level, check out the SpeakerDeck slides below (these are what Ben used at the Peterborough Coding Evening):

I really commend Ben and Dave Jones for the development of this new library – it’s easy-to-use and has a commendable clarity. There are some exciting developments coming up in future versions, too, which is sure to make it more widely used. The future is bright for GPIO Zero.

Pimoroni unveils future add-on boards for the Raspberry Pi Zero

Just been listening to Pimoroni’s excellent Bilge Tank video cast. They’ve announced a few things to keep an eye on. First of all, the pHATs currently displayed on their website are not actually in stock yet and are due Monday/Tuesday, so get ready to order! They’re awesome :-) Secondly, they unveiled some future pHATs as well as a full-sized HAT.

The first was a card to power the Pi from a LIPO (at the top of the screen below).


The first version will not have a charging circuit but a later version, already planned, will. But you can get something like a USB charger for LIPOs which will do nicely. I think I’ll get one of these when I re-tool the Picorder to make it extra small!

The next one is the Enviro pHAT which contains various sensors including a barometer, a light/colour sensor and an accelerometer. Here it is in prototype format:


Next up is the IoT pHAT which is a way of connecting to the Internet through a little add-on card via an ESP8266 chip. It’s not designed as an ‘Internet connection’ but you will be able to do things like “get me this URL” and have it respond. Ideal for Internet of Things projects where you are polling an API.

iot phat

The next thing was the “Cheepy” which is a low-resolution GPS pHAT for around £20:

GPS cheepy

Another one in the melting pot is the POV pHAT that can be used to write messages in the air!

pov phat

And remember: all these pHATs can be used with the normal Raspberry Pi. So much excellent Pi goodness coming out of Sheffield!

They also showed (again) their STS Pi which is a very imminent robotics kit with custom parts and a mini chassis that works with the Explorer HAT Pro.

sts pi

And lastly, they showed off a new normal-sized HAT – the DrumHAT! Presumably similar to the PianoHAT with capacitive pads to create a mini electronic drum kit!

drum HAT

All that and I won a Pi Zero! (I know, I know, rotten veg is being thrown at the screen now!)

Really great show as always, pirates!

They will be doing another live show tomorrow (with more chances of winning a Zero!) at 3pm. So, head over to their channel.

The Pi Podcast covers the Raspberry Pi Zero, Foundation gives advice on getting one

The guys over at Pi Podcast have just published their latest edition, and it’s all about the Raspberry Pi Zero. Listen to it here.

Liz over at the Raspberry Pi Foundation has published some advice about how to get hold of a Zero. The magazine has “technically” sold out (meaning over 80% have sold… I know, logical, huh?) and stocks on resellers sites have just… gone. Read the advice here.

Black Friday Raspberry Pi deals


Hi folks. Some good deals out there if you search around. Amazon have got general electronics, of course, but some of our favourite retailers are also doing deals.

If you know of any good Pi-related deals, either leave a comment or Tweet me and I’ll update this page :-)