Chapter 6 Physical computing with Scratch and Python 121THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE
Introducing the GPIO header
Found at the top edge of the Raspberry Pi circuit board and looking like two long rows of
metal pins, the GPIO header is how you can connect hardware like light-emitting diodes (LEDs)
and switches to the Pi for control under programs you create. The name might sound a little
confusing, but it describes the component well: its pins can be used for both input and output,
they have no fixed purpose, and when rows of pins are exposed on a circuit board like this
they’re known as a header. Thus: ‘general-purpose input/output header’.
14 15 18
2 3 4 17 27 22 5 6 13 19 2623 24 25 8 7
10 9 1112 16 20 21Raspberry Pi pin numbers (3B+, 3B, 2B, Zero, A+, B+)
GPIO Ground 3V3 5V ID EEPROMAdvanced use onlyThe Raspberry Pi GPIO header is made up of 40 male pins. Some pins are available for you
to use in your physical computing projects, some pins provide power, while other pins are
reserved for communicating with add-on hardware like the Sense HAT (see Chapter 7).
There are several categories of pin types, each of which has a particular function:
A permanently-on source of 3.3 V
power, the same voltage the
Raspberry Pi runs at internallyA permanently-on source of
5 V power, the same voltage as
the Raspberry Pi takes in at the
micro USB power connectorA ground connection, used to
complete a circuit connected to
power sourceThe GPIO pins available for your
programs, identified by a number
from 2 to 27Pins reserved for use with
Hardware Attached on Top (HAT)
and other accessories3V3 3.3 volts power5VGround (GND)5 volts power0 volts groundGPIO XXID EEPROMReserved special-
purpose pinsGeneral-purpose
input/output pin
number ‘XX’