Operation Manual

Human-computer interfacing
125
Notes:
Lesson 4.5: General Purpose Input/Output (GPIO)
GPIO is short for “General Purpose Input/Output. Your keyboard, mouse and
monitor are examples of input and output devices on a computer, but they are for
specialised and well-defined tasks. The “General” part of GPIO indicates that you
can design your own device and connect it up to the Raspberry Pi.
This section explains the technicalities of how inputs and outputs are connected
and processed by computers. Following that, there is a technical reference of the
GPIO capabilities of a Raspberry Pi. I’ll finish off with some simple electronic
circuits and software that you can build and use on your Raspberry Pi. In this
guide, we are going to be concentrating on the digital GPIO interface, which is the
simplest to use and understand as a beginner.
So, let’s begin by looking at how computers receive and use information.
Sensors and output devices
Inputs are pieces of information sent into a computer, much like a human can feel,
smell, taste, hear and see things. Outputs are the pieces of information that are
produced and sent out by a computer, much as you can speak or gesture. As
computers are electrical, inputs and outputs must be converted to and from an
electrical form so that the computer can work with them. A sensor is a piece of
electrical hardware that detects and converts something in the real world (such as
the speed of a wheel) into an electrical signal. An output device is something that
converts an electrical signal to another form (such as a light, a buzzer or a motor).
Digital and analogue input/ouput
A digital signal is one that can exist in one of only two states, such as a light switch
that is either on or off. While one digital channel (digit) can be either on (“1) or off
(“0”), we can combine several digits to make a number. This is the binary system
covered in the Python chapter – each binary digit represents one digital channel.
With two digital bits we can create:
To produce useful
results, computers need
data to work with.
Data comes from inputs,
and inputs arrive via
sensors, of one
kind or another.
Binary Decimal
0 0
1 1
10 2
11 3