PIFace Control and Display 2 User manual

For Raspberry Pi® - Getting started
Unleash your Raspberry Pi® projects from your desk and
control them without a monitor, keyboard or mouse!
PiFace™ Control and Display 2
Get started with PiFace™ Control and Display in less than ten minutes!
For step by step help and ideas for projects visit: http://www.piface.org.uk/guides/
This guide applies to both the original PiFace™ Control and Display and
PiFace™ Control and Display 2.
PiFace™ Control and Display is a great way to use your Raspberry Pi® without the hassle
of cables and bulky peripherals. It’s quick and simple to get started, with easy-to-use menu
builders and custom character creation.
The original PiFace™ Control and Display board fits the original Raspberry Pi® models A
and B. PiFace™ Control and Display 2 has been redesigned to fit the original models and
the Raspberry Pi® models A+, B+.
Product highlights
Typical applications:
● User interface for applications and projects
● Embed headless Raspberry Pi®
● Games
● Configuration menus
Features:
● 16 character by 2 line alphanumeric LCD display

● LED display backlight
● 5 tactile switches
● 3-position navigation switch
● IR receiver for infrared remote control
● Contrast adjustment screw
● Easy to program in Python, Scratch and C
● Quick and easy menu building Python libraries provided
● Support for LCD custom characters
PiFace™ Control and Display allows you to use and control your Raspberry Pi® without a
keyboard, mouse and monitor. It saves space and power by removing the need for a
monitor whilst still providing a simple, yet capable interactive user interface. It facilitates
interaction with its onboard buttons, intuitive navigation switch and IR remote receiver.
PiFace™ Control and Display is ideal for applications such as internet radio, streaming
media, XBMC and many more.
To use PiFace™ Control and Display, you will need to follow the simple steps contained in
this guide.
Fitting the board
PiFace™ Control and Display sits neatly above the Raspberry Pi® and connects using the
expansion connector. When fitting the board, take care to ensure expansion pins are
correctly lined up with the holes on the PiFace™ Control and Display socket. Check the
alignment for left and right and front and back and never force the boards together if they
don’t slide smoothly.
Always disconnect the power before connecting anything to your Raspberry Pi® or
PiFace™ Control and Display.

Tour of hardware
Top view
Bottom view

Hardware features
LCD screen
PiFace™ Control and Display has an onboard 16 by 2 character LCD screen for outputting
messages, menus and custom characters. Each character is 5 pixels wide and 8 pixels
high. The screen has an LED backlight that can be turned on and off from your code and
will not affect the messages on the screen.
Infrared receiver
You can use infrared remote controls (for example for your TV) to control your Raspberry
Pi® using the IR receiver on PiFace™ Control and Display.
Infrared receiver on PiFace™ Control and Display
Input buttons
PiFace™ Control and Display has 5 onboard buttons for use as inputs such as menu
control. The software will read the value 1
when the button is pressed and 0
when not
pressed. The inputs are labeled S1-S5 on the original PiFace™ Control and Display and
S0-S4 on PiFace™ Control and Display 2.

Input buttons on original PiFace™ Control and Display
Input buttons on PiFace™ Control and Display 2
Navigation rocker switch
PiFace™ Control and Display has an onboard rocker switch and is ideal for menu control.
The software treats the navigation switch as 3 separate inputs, 5, 6 and 7; one for each
direction as show below.
Navigation switch on PiFace™ Control and Display
LCD contrast screw
The contrast between the LCD’s character and background can be adjusted. If nothing is
appearing on the LCD or solid black rectangles appear, try adjusting the contrast screw
with a small cross-headed screwdriver. Try gently turning this left or right until you find the
contrast you like.

Contrast screw on PiFace™ Control and Display
Address jumpers
SJ1 and SJ2 are solder jumpers that set the address of the board to enable multiple boards
to be used together (using an appropriate connector e.g. PiFace™ Rack or PiFace™
Shim). The default is board address 0, as both jumpers are connected to GND via a small
track. To change the setting of a jumper, carefully cut its track and solder the middle pad to
the other pad.
Example of setting SJ1 to 1
Address
Binary Address
SJ2
SJ1
0
00
1-2
1-2
1
01
1-2
2-3
2
10
2-3
1-2
3
11
2-3
2-3
SJ1 controls the least significant bit of the address, and SJ2 the most significant bit.

Installing software under Linux
This guide assumes you are installing on Raspbian on a Raspberry Pi® connected to the
Internet to allow you to download packages with apt-get
.
Updating your Raspberry Pi®
First get your Raspberry Pi®’s software up-to-date by opening a terminal and entering:
sudo apt-get update && sudo apt-get upgrade
Now reboot your Raspberry Pi®
sudo reboot
Enabling SPI port
To use PiFace™ Control and Display you need to enable your Raspberry Pi®’s SPI port, do
this by opening a terminal window and entering the following command:
sudo raspi-config
Use your keyboard’s arrow keys to select Advanced Options
to view the list of advanced
configuration options. Choose the SPI
option, set this to <Yes>
then select <OK>
then
<Finish>
.
Installing PiFace™ Control and Display Software
Install the latest PiFace™ Control and Display software by typing the following command in
a terminal:
sudo apt-get install python3-pifacecad
Now reboot your Raspberry Pi®
sudo reboot
Testing PiFace™ Control and Display Software
Test everything has installed by running the sysinfo.py program:
python3 /usr/share/doc/python3-pifacecad/examples/sysinfo.py
*replace “python3” with “python” if you are not using Python 3.

Details about your Raspberry Pi®’s temperature, memory and IP address should appear on
the LCD screen.
System info display on PiFace™ Control and Display LCD
First steps with Python
PiFace™ Control and Display can be controlled easily using Python. First open a terminal
window and start the Python interpreter by typing:
python3
To use PiFace™ Control and Display from Python you must import the pifacecad
module:
import pifacecad
Before use, you must create a PiFace™ Control and Display object:
cad = pifacecad.PiFaceCAD()
Now you can turn the LCD backlight on:
cad.lcd.backlight_on()
You can read the value of an input button like this:
cad.switches[3].value
This will return a 1 if the button is pressed and a 0 otherwise.

You can read the whole input port by reading the value of the switch_port
attribute:
cad.switch_port.value
You can write text to the LCD like this:
cad.lcd.write("HELLO WORLD")
For details of more commands, visit:
http://pifacecad.readthedocs.org/en/latest/example.html
Setting up your IR remote with PiFace Control and Display
You can use your TV (and other infrared) remotes to control your Raspberry Pi® using the
IR receiver on PiFace™ Control and Display.
Setting up the infrared receiver
Download and run the infrared receiver setup script:
wget
https://raw.github.com/piface/pifacecad/master/bin/setup_pifacecad
_lirc.sh
chmod +x setup_pifacecad_lirc.sh
sudo ./setup_pifacecad_lirc.sh
Alternatively you can set up the receiver manually. There is a guide on how to do this at:
http://pifacecad.readthedocs.org/en/latest/lirc.html#setting-up-the-infrared-receiver
Setting up your Remote
The /etc/lirc/lircd.conf
file tells LIRC about your remote control. Since every remote control
is different, you need to download or generate a config for each remote.
First open a terminal and backup the original lirc configuration file to your home directory
with
cp /etc/lirc/lircd.conf ~/.
If you ever want to restore these original settings use the command
sudo cp ~/lircd.conf /etc/lirc/lircd.conf
To setup your remote you should first try and find your remote control config file online
● In midori or another Internet browser, go to the address
http://lirc.sourceforge.net/remotes/

● Click on the manufacturer of your remote.
● Then right click on the model of your remote (not the .jpg file).
● Click ‘Save as...’ and save it somewhere.
Copy it in the /etc/lirc/directory as lircd.conf by typing the following
sudo cp downloadedFile /etc/lirc/lircd.conf
Alternatively, generate your own configuration
● Remove the current configuration
sudo rm /etc/lirc/lircd.conf
● Start the irrecord program
sudo irrecord -f -d /dev/lirc0 /etc/lirc/lircd.conf
● Carefully follow the onscreen instructions. At some point it will ask you to enter the
commands for each button you press.
● If you make a mistake repeat the process by first re-removing the configuration file
and restarting irrecord
● You can list the available commands (in another terminal) with
irrecord –list-namespace
After you have finished, reboot your Raspberry Pi®
sudo reboot
Once you have logged in, test your remote using the command
irw
Your commands will appear in the console when you press buttons on your remote. Press
Ctrl-c to exit this.
Warnings
● PiFace™ Control and Display boards are not intended for use in critical systems.
● Do not expose to water, moisture or extremes of temperature (below -40°C or above
85°C).
● Take care whilst handling to avoid mechanical and electrical damage to the device
and connectors.
● Take suitable precautions to minimise risk of causing damage by electrostatic
discharge.
● Connection to unapproved devices may affect compliance or result in damage to
unit and invalidate any warranty.
● Connections to PiFace™ Control and Display, including connecting external circuits
or other add-on boards, should only be made with the power supply disconnected.
Compliance information
● This PiFace™ board complies with the relevant provision of the RoHS Directive for
the European Union. In common with all Electronic and Electrical Equipment this

PiFace™ board should not be disposed of in household waste. Alternative
arrangements may apply in other jurisdictions.
● PiFace™ Control and Display board is CE marked. It is a class B product. The EMC
emission test was performed with a PiFace™ Control and Display on a Raspberry
Pi® Model B and a PiFace™ Control and Display 2 on a Raspberry Pi® Model B+.
Due to the nature of the board, as a prototyping and development board, fast
transient immunity tests and conducted radio-frequency immunity tests have not
been executed. ESD handling precautions should be observed. The board may be
considered a component if integrated into another product. Any person designing or
developing a product that uses one or more PiFace™ Control and Display boards or
any other PiFace™ products is responsible for ensuring that it is compliant and any
modification to a PiFace™ board or inter-connection of other elements and devices
with a board does not change compliance.
● This Class B digital apparatus complies with CAN ICES-3 (B). Cet appareil
numérique de la classe B est conforme à la norme NMB-003 du Canada.
● This device complies with part 15 of the FCC Rules. Operation is subject to the
following two conditions: (1) This device may not cause harmful interference, and (2)
this device must accept any interference received, including interference that may
cause undesired operation.
http://www.piface.org.uk
PiFace™ is designed in the UK by OpenLX SP Ltd. Registered Office 145-157 St John
Street, London, EC1V 4PW.
PiFace™ is distributed by Premier Farnell UK, 150 Armley Road, Leeds LS12 2QQ, UK
Manufactured in the UK.
Documentation Revision 2.1 January 2015
Raspberry Pi is a Trademark of the Raspberry Pi Foundation. All other Trademarks
acknowledged.
Table of contents
Popular Control Unit manuals by other brands

White Rodgers
White Rodgers 36J27-554 installation instructions

Alcad
Alcad 912-DMH Quick programming guide

H-2 Technik
H-2 Technik UDL-001 quick guide

Warner Electric
Warner Electric EM-FBB Series installation instructions

Kenton
Kenton KILLAMIX-MINI user manual

GEM
GEM 0326 2M 74 41G4010810 operating instructions

Blindleistungsregler
Blindleistungsregler TSM-AT quick start guide

Stanley
Stanley 71504 Instruction and service manual

Comelit
Comelit Simplebus2 UT2010 Technical manual

Texas Instruments
Texas Instruments CC256xEM user guide

Savant
Savant CLI-1WIRE2 Quick reference guide

INOXPA
INOXPA C-TOP+ operating instructions