Hardware Reference
In-Depth Information
General purpose input outputs (GPIOs) are signals connected to the central
processor of a computer system. They are designed with no specific purpose in
mind but are general purpose and can be assigned a use by the designer of a
circuit, usually to control and sense external electronic circuits.
On some computers, like the Raspberry Pi, the GPIO circuitry is brought out to special
pins on the side of the computer. A GPIO pin can either be set up as an input to sense
some external voltage, or it can be set up as an output to control some external volt-
age. The voltages used by your Raspberry Pi or your Arduino board are 3.3 volts, which
is quite small, but there is enough current provided by these pins in order to power an
LED or sense a button press. By comparison, the UK mains electricity supply is
240 volts, which is a very high (and dangerous) voltage, and the electricity pylons you
see in the country use 230,000 volts! By comparison, the voltages used in computer
circuits are very small.
A computer is a digital machine, meaning that it uses numbers internally. All modern
computers are digital and use the numbers 1 and 0. When using GPIO pins with a
computer, a 0 normally represents no voltage (off), or 0 volts, and a 1 normally repre-
sents a voltage being present (in this case, 3.3 volts). When you use GPIO pins to sense
external voltages, the computer can only internally represent the voltage on these pins
as a digital 0 or 1. A voltage that is close to 0 volts is a 0, and a voltage that is close to
3.3 volts is a 1. Anything in the middle is a bit of a grey area and might be seen as a 0
or a 1 by the computer.
Setting Up the.PC or Mac to
Control Electronic Circuits
If you have a Raspberry Pi, you can skip this section and go onto the next section,
“Controlling an LED”. This is because the Raspberry Pi has its own GPIO pins already
built in, which makes it a really good computer for controlling electronic circuits.
PCs and Macs don't have GPIO pins built in, so you have to add them with an extra
circuit board. here are lots of ways you could do this, but for this topic I have chosen
to use a small, pre-programmed Arduino board. You won't be learning anything about
the Arduino in this topic but if you want to know more about the little computer, check
the links in the Where Next section in the appendix at the back of this topic.
 
Search WWH ::




Custom Search