Operation Manual

numbering pins, and because there are no markings on the Pi itself, its easy to get confused as to which pin is which.
Never connect anything to the pins marked Do Not Connect; these are reserved for internal functions of the Pi’s BCM2835 system-on-chip (SoC)
hardware. Connecting anything to these will result in damage to the Pi.
Although the Pis GPIO port provides a 5 V power supply, tapped from the incoming power on the micro-USB hub, on Pin 2,
the Pis internal workings are based on 3.3 V logic. This means that the components on the Pi work from a 3.3 V power supply.
If youre planning on creating a circuit that will interface with the Pi through its GPIO port, make sure you are using components
compatible with 3.3 V logic or are passing the circuit through a voltage regulator before it reaches the Pi.
Connecting a 5 V supply to any pin on the Raspberry Pi’s GPIO port, or directly shorting either of the power supply pins (Pin 1 and Pin 2) to any
other pin will result in damage to the Pi. Because the port is wired directly to pins on the Broadcom BCM2835 SoC processor, you will not be able to
repair any damage you do to it. Always be extra careful when working around the GPIO port.
The GPIO port provides seven pins for general-purpose use by default: Pin 11, Pin 12, Pin 13, Pin 15, Pin 16, Pin 18 and Pin
22. Additionally, Pin 7while defaulting to providing a clock signal for general purpose usecan also be used as a general-
purpose pin, giving eight pins in total. These pins can be toggled between two states: high, where they are providing a positive
voltage of 3.3 V; and low, where they are equal to ground or 0 V. This equates to the 1 and 0 of binary logic, and can be used
to turn other components on or off. You’ll learn more about this later in the chapter.
The Pis internal logic operates at 3.3 V. This is in contrast to many common microcontroller devices, such as the popular Arduino and its variants,
which typically operate at 5 V. Devices designed for the Arduino may not work with the Pi unless a level translator or optical isolator is used
between the two. Likewise, connecting pins on a 5 V microcontroller directly to the Raspberry Pi’s GPIO port will not work and may permanently
damage the Pi.
In addition to these general-purpose pins, the GPIO port has pins dedicated to particular buses. These buses are described in
the following subsections.
UART Serial Bus
The Universal Asynchronous Receiver/Transmitter (UART) serial bus provides a simple two-wire serial interface. When a serial
port is configured in the cmdline.txt file (as described in Chapter 6, “Configuring the Raspberry Pi), its this serial bus that is
used as the port for the messages. Connecting the Pis UART serial bus to a device capable of displaying the data will reveal
messages from the Linux kernel. If youre having trouble getting the Pi to boot, this can be a handy diagnostic toolespecially if
nothing is showing on the display.
The UART serial bus can be accessed on Pins 8 and 10, with Pin 8 carrying the transmit signal and Pin 10 carrying the receive
signal. The speed can be set in the cmdline.txt file, and is usually 115,200 bits per second (bps).
I²C Bus
As the name suggests, the Inter-Integrated Circuit (I²C) bus is designed to provide communications between multiple integrated
circuits (ICs). In the case of the Pi, one of those integrated circuits is the Broadcom BCM2835 SoC processor at the heart of
the system. These pins include access to pull-up resistors located on the Pi, meaning no external resistors are required to access
the I²C functionality.
The I²C bus can be accessed on Pins 3 and 5, with Pin 3 providing the Serial Data Line (SDA) signal and Pin 5 providing the
Serial Clock (SCL) signal. The I²C bus available on these pins is actually only one of two provided by the BCM2835 chip itself,
and is known as I²C0. The second, I²C1, is terminated at resistors on the Raspberry Pi circuit board itself and is not available for
general-purpose use.
SPI Bus
The Serial Peripheral Interface (SPI) bus is a synchronous serial bus designed primarily for in-system programming (ISP) of
microcontrollers and other devices. Unlike the UART and I²C buses, its a four-wire bus with multiple Chip Select lines which
allow it to communicate with more than one target device.
The Pis SPI bus is available on Pins 19, 21 and 23, with a pair of Chip Select lines on Pin 24 and Pin 26. Pin 19 provides the
SPI Master Output, Slave Input (MOSI) signal; Pin 21 provides the SPI Master Input, Slave Output (MISO) signal; Pin 23
provides the Serial Clock (SLCK) used to synchronise communication; and Pins 24 and 26 provide the Chip Select signals for
up to two independent slave devices.