Raspberry Pi interface board PiFace will be shipping to the public in the next few weeks.
The board adds eight output and eight inputs to Raspberry Pi, as well as various LEDs, switches, and a couple of relays.
Most importantly, adding one to a Raspberry Pi turns it into an autonomous embedded computer that children can use for real-world control – The Raspberry Pi Foundation’s mission is to help children discover computer programming for themselves.
To make this easy, its software package supports the hardware for both the Raspberry Pi Foundation’s favoured programming languages: Python and Scratch. Then there are C libraries, and Java support on the way.
Uniquely for an I/O board, as far as creator Dr Andrew Robinson can tell, it is shaped to fit between the taller components of Raspberry Pi, so PiFace adds only a few millimetres to the computers overall height.
Inspiration came while pondering the Raspberry Pi concept when the little computer was still in development.”
“I started thinking about it in December 2011,” Robinson told Electronics Weekly. “I realised Raspberry Pi was not going to have the performance of a desktop PC, so it needed something to differentiate it.”
At the same time, what ever this differentiator was, it was had to appeal to the young people.
Two thoughts emerged: Raspberry Pi should be able to connect to things that children are interested in, and “the great thing about Raspberry Pi is that it can be put into small places where you can’t put a normal computer”, said Robinson.
It had to be really easy to use, so from the first prototype in May last year “sensors and actuators were connected via screw terminals” said Robison. “And there are some indicators on board. They get feed-back right away, in first 10 seconds of using it.”
In fact, potential users can get feedback even before they clip on to their Raspberry Pi because its software package includes a simulator/emulator.
The simulator shows a graphical representation of PiFace on the computer’s screen, with a dot on the graphic indicating when a virtual output pin has been activated, while clicking on a virtual input pin affects the programme flow.
Attach PiFace, and the hardware transparently takes the simulated output to the real world, and imports real-world inputs.
Visualisation and simulation have consistent interfaces for the Foundation’s chosen languages, so younger users interfacing with the world using Scratch – the children’s programming language developed at MIT – can move up to the sophistication of Python without relearning the hardware interface. “We present a constant interface as the users make the jump”, said Robinson.
Developers have had boards for a while and there are several how-to videos on the web already, and a set of tutorials is being developed as resources can be spared at the University.
Even primary school pupils get the idea quickly, says Robinson, who, as part of an educational out-reach programme, runs a Raspberry Pi road show.
“I was at Mozilla last week, and I was amazed that seven year-olds were using Scratch to control things better than I can,” he said.
The on-line videos have already attracted some unexpected interest.
One shows how Raspberry Pi and PiFace can be wired and programmed to photograph birds as they leave a net box. Its external wiring is simple and the code is small and easy to modify to tweak the system’s response.
“Ornithologists from Oxford University have got in touch,” said Robinson, “and London Zoo is interested for use in Africa.”
And much as the hardware was designed to introduce novices to computer interfacing, “we are finding people starting to use it for industrial control,” said Robinson.
Another video shows how to create a talking robot chicken that guards a food cupboard from marauding snackers, and tweets violations to a Twitter account.
In detail, PiFace provides eight 20V 200mA open-collector outputs, which are connected in parallel with eight on-board LEDs.
Two of these are also connected to 10A change-over relays. “Beginners are not confident with open-collectors,” explained Robinson.
Jumpers allow the relays to be disabled if they are not needed.
There are also eight inputs, of which four are paralleled with on-board switches.
All the I/O is protected against some amount of misuse.
PiFace communicates with the Broadcom chip at the heart of Raspberry Pi over an SPI serial interface, plus one connection to an interrupt-on-change input on the Broadcom chip.
Programmable hardware on PiFace routes any, or none, of its eight inputs to this pin to provide basic interrupt-on-change capability to any of the inputs, with the software allowing any polarity of change to be programmed as the interrupt trigger.
The driver stack is in Python.
“There are various wrapper functions in Python which expose the interface,” said Robinson. “To change a pin, a user can write the statement: digtal_write and pin number and state. To read an input they call for: digital_read and then pin number.”
Like Raspberry Pi, an initial batch of PiFace went out to developers. For the production version, Element 14 is handling manufacture and distribution. Pre-registration for these is available on the firm’s website.
The board will be both CE and FCC marked, and available globally.
Raspberry Pi i s a little power-hungry for battery operation.
Robinson’s tip is to splice 5V power into spare wires of an Ethernet cable to feed power to a remote Raspberry Pi + PiFace combination through screw terminals on PiFace, using the cable’s data wires for communication if the Raspberry Pi needs to talk back to a host computer.
When the Model A appears, it will consume less power because it does not have the thirsty Ethernet chip, but it is still too much for battery power under most circumstances. Robinson still recommends 5V delivered over a pair of wires, with a Wi-Fi stick in the USB port if data communication is needed to a host computer.
Robinson’s interest in public out-reach came from BBC Micro and ARM pioneer Professor Steve Furber, who is based at the University of Manchester.
“I work for School of Computer Science at the University and did my PhD on low-power processor architectures under Steve Furber,” said Robinson. “He is keen on education because of his involvement with the BBC Micro, and he got me interested. I heard of the Raspberry Pi, and this lead to PiFace.”
The interface board was developed in Robinson’s spare time.
Seeing the scale of public interest in Raspberry Pi, the University of Manchester has begun to support PiFace – funding development of the software package, for example.
Workshops for teachers using Raspberry Pi and PiFace have attracted more than 50 teachers per session, and more recently the University has started running workshops with children.
Now PiFace is gaining its own momentum, what next for Robinson’s Raspberry Pi-related activity.
“There will be other PiFaces”, is all he would reveal publicly.
Image: PiFace Digital