Draft instructions for getting started with PiFace Digital (full instructions to follow)

Full documentation will be published in the next couple of days, but in the mean time, for those who have been lucky enough to receive the first interfaces, here’s a brief summary

Getting started with PiFace Digital

PiFace Digital is one of the quickest and easiest way to connect your Raspberry Pi to the real world. Follow this guide and you’re Raspberry Pi will be reacting to switches and controlling motors and lights in less than ten minutes! 

  • PiFace Digital features at a glance:
  • 2 changeover relays
  • 4 switches
  • 8 digital inputs
  • 8 open-collector outputs
  • 8 LED indicators
  • Easy to program in Python, Scratch and C
  • Graphical emulator and simulator 

Always disconnect the power before connecting anything to your Raspberry Pi or PiFace Digital.

Fitting the board

PiFace Digital sits neatly above the Raspberry Pi and connects using the expansion connector. Take care to ensure all expansion pins are lined up with the holes on the PiFace socket. Check the alignment for left and right and front and back and never force the boards together if they don’t slide smoothly.

Installing Software

The fastest way to get started is to download a prepared operating system image and copy it to an SD card. Images are available from http://pi.cs.man.ac.uk/download.

Alternatively, you can install the necessary libraries to your own Raspbian image with the instructions below.

Installing the software yourself in Raspbian

PiFace Digital communicates to the Raspberry Pi using the SPI interface. The SPI interface driver is included in the later Raspbian distributions but is not enabled by default. You can always enable the SPI driver, or you can load it by hand when required.

Always enabling SPI

To always enable the SPI driver:

  •  After logging in, edit /etc/modprobe.d/raspi-blacklist.conf

sudo nano etc/modprobe.d/raspi-blacklist.conf

  •  Insert a # at the start of the line containing blacklist spi-bcm2708 

#blacklist spi-bcm2708


    Alternatively, to load the SPI driver by hand (will not be loaded on reboot):

    ·      Type in a terminal:

    sudo modprobe spi-bcm2708

    Next, you we need to install the PiFace Digital libraries and change the permissions of the SPI interface. The following script automates this into one command.

    To install and setup the software, ensure your Pi can access the Internet and type:

    sudo apt-get update

    wget -O – http://pi.cs.man.ac.uk/download/install.txt | bash

    The software will complete installing in a few minutes.

    Reboot your Pi by typing:

    sudo reboot


    After installing the software and restarting, login and startx.

    Start the PiFace emulator by typing in a terminal:



    1.     To manually control the outputs, in the PiFace Emulator window, click Override Enable.

    2.     Toggle Output Pin 1 on by clicking on it. The PiFace interface will click as the relay turns on and the corresponding LED will illuminate. Notice the graphic onscreen updates to show the LED being on, the contacts have changed over on the relay and the first output pin is on.

    The LEDs are in parallel with the outputs terminal connectors and indicate when the output is enabled.


    1.     We want to observe the inputs so click Keep inputs updated checkbox so the emulator reads the buttons and updates the screen. The interval sets how often the inputs are read, for most cases, it is fine to leave it on 500ms.

    2.     Press one of the buttons on the bottom left of PiFace. Notice how the onscreen representation changes to indicate the switch has been pressed.

    First steps with Python

    To use Piface with Python import the piface.pfio module:

    import piface.pfio

    Before use, the board must be initialised with a call to init() .

    There are three main functions to control the interface

    ·      digital_read(pin_number)

    o   returns 1 or 0 depending on the state of the input numbered pin_number

    ·      digital_write(pin_number, state)

    o   sets the output numbered pin_number to state 0 or 1. State 1 turns the LED on and enables to open collector to sink current

    ·      digital_write_pullup(pin_number, state)

    o   sets a 10k pullup on input numbered pin_number to be state 0 or 1. State 1 is pullup enabled



    Mention on Granada News (TV news for North West England)

    PiFace appeared on TV news. It’s behind the latest workshop to allow children to connect a Raspberry Pi up to monitor a cupboard. It’s a fun example that shows what’s possible.


    A reed switch is connected to the PiFace and a magnet is stuck on a cupboard door. When the door is opened the circuit is broken and PiFace causes the Raspberry Pi to tweet and issue a verbal warning. The whole project only took about 20 minutes to make and reusing a previous workshop that used an animatronic chicken to follow and read out on twitter.

    The first in a series of tutorials ‘Easy as Pi’ describes how you can make your own.

    London Raspberry Jam



    Sometimes an event really energises me and makes the hard work worthwile. London’s Raspberry Jam at Mozilla’s offices was one such event. The jam was slightly different to others in that it was aimed at children. Everyone seemed to have a good time and it was good to see children clearly engaged with the Pi and getting creative. I presented a session on using Scratch with PiFace. There were some great questions, loads of ideas, and I’m proud to say my Scratch is better after picking up tips from some real Scratch experts, some of which were less than ten!



    Mozilla’s space is fab and truth be known I was slightly awestruck being in a company that supplies a browser that’s used by millions of people every day. It shows how rewarding computing to be and how it makes a real difference to the world. It’s these sort of reasons that make us realise why we’re trying to get more people interested in coding and sharing our passion.

    It was great to meet GeekGurlDiaries creator, aka teaching ICT with Miss P, aka C. A. Philbin demonstrated her box of geek which is really neat. Rob Bishop from the Foundation was suitably inspiring, (buy a t-shirt from him!). Meeting such enthusiastic and passionate people is really energising. Alan O’Dononhoe, aka teknoteacher was there, father of Raspberry Jams.