Hardware Reference
In-Depth Information
Inputs
he screw terminals next to the on-board switches are used to connect external switches.
here are eight inputs, numbered 0-7 from the outside of the board to the middle, followed
by a connection to ground. PiFace Digital will register an input if there is an electrical con-
nection between the input terminal and ground - that is, there is a path for electrons to low.
Relays
When you turn either of the irst two outputs on you should notice that PiFace clicks. his sound
is as the contacts in the relay (the large rectangular components) change over. A relay can by
thought of as a computer-controlled switch. You'll use relays in Chapter 10, “he Twittering Toy”.
Outputs
As well as controlling the on-board LEDs and relays, PiFace Digital has “open-collector” out-
puts that can be used to control circuits. You can connect to these outputs with the screw
terminals next to the LEDs.
he term open collector describes how the output transistor is connected. Transistors are the
switches at the heart of computers - there are tens of millions of transistors in the processor
at the heart of the Raspberry Pi. Luckily they're only tens of nanometres (a nanometre is a
thousand millionth of a metre - you could it 2000 transistors across the width of a human
hair) in size. Although transistors behave in a similar way to switches and relays, the direc-
tion current lows through them afects how they behave, which needs to be considered
when connecting to them.
There are different types of transistors, which allow current to low in different ways. For
simplicity this chapter just uses examples of the type NPN.
Open-collector outputs can just sink current. hat is, they allow current to low to ground;
they are not a source for current. his means that circuits have to be wired up from a power
source, through the component being controlled, through the transistor and then to ground.
Figure 9-7 shows a typical setup. Remember, current has to low for electricity to do work, so
until the transistor turns on and allows current to low to ground the LED will not come on.
he transistors on PiFace already have the connection to ground wired up.
 
Search WWH ::




Custom Search