Getting Started With A PiFace Interface Card
Part 1 - Introduction
The PiFace Digital I/O card connects to your Pi's 26-way IDC header and sits over the Pi to provide a compact interface to digital input and output ports. PiFace provides:
- 8 digit input ports - presented on a nine-way terminal strip, these will detect open circuit or closed circuit with respect to a common ground connection. The first four inputs have momentary pushbuttons so that you can perform basic testing.
- 8 digital output ports - presented on a nine-way terminal strip and share a common +5V connection. The first two outputs also drive separate SPDT relays that have three connections each: NO, NC, Common. Each output has its own LED to indicate an ON condition.
Hover your mouse over the picture of the PiFace to see a description of each main component.
The easiest way to install the PiFace software and associated system settings is to use PiFace's own disk image. This means you do not have to install the various packages and only have to make minimal system configuration changes yourself.
There are several jumpers on the PiFace boards and these have the following purposes:
- JP1 and JP2 - these jumpers set the board address so that up to four boards can be used.
- JP3 - connects to the +5V rail on the Pi. When fitted, the PiFace board can be powered from the Pi, or vice versa. Without the jumper, both devices must be powered separately.
- JP4 - connects the snubber diodes from the ULN2803A to 5V. However, if the open collectors are connected to >5V, JP4 must be removed.
- JP5 and JP6 isolate the two relays K1 and K0 respectively from outputs 1 and 0.
- JP7 - remove this to disconnect power to all on-board outputs, that is, disable the relays and LEDS.
While the two relays are rated at 10A 250V AC, documentation elsewhere states that the maximum voltage should be limited to 20V - presumably because of the proximity of the relay connections and control circuits. If you wish to switch mains voltages you will need separate mechanical or solid-state relays, though you could still use the PiFace's 5V supply to drive them.
Using C
I decided to use C to run my PiFace. The steps to have this working are shown in Part 2.