
P A R T I V
H A R D W A R E H A C K I N G
222
Although the Pi’s GPIO port provides a 5 V power supply, tapped from the incoming power
on the micro-USB hub, on Pin 2, the Pi’s 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 you’re 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.
WARNING
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.
GPIO Features
The GPIO port provides eight pins for general-purpose use by default: Pin 7, Pin 11, Pin 12,
Pin 13, Pin 15, Pin 16, Pin 18 and Pin 22. 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.
WARNING
The Pi’s 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 7, “Advanced Raspberry Pi Configuration”), it’s this serial bus that is used as the port
for the messages. Connecting the Pi’s UART serial bus to a device capable of displaying the
data will reveal messages from the Linux kernel. If you’re having trouble getting the Pi to
boot, this can be a handy diagnostic tool—especially 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).
Summary of Contents for A
Page 1: ......
Page 2: ......
Page 3: ...Raspberry Pi User Guide 2nd Edition...
Page 4: ......
Page 5: ...Raspberry Pi User Guide 2nd Edition Eben Upton and Gareth Halfacree...
Page 10: ......
Page 26: ...R A S P B E R R Y P I U S E R G U I D E S E C O N D E D I T I O N 10...
Page 28: ......
Page 29: ...Chapter 1 Meet the Raspberry Pi...
Page 37: ...Chapter 2 Getting Started with the Raspberry Pi...
Page 56: ......
Page 57: ...Chapter 3 Linux System Administration...
Page 79: ...Chapter 4 Troubleshooting...
Page 89: ...Chapter 5 Network Configuration...
Page 109: ...Chapter 6 The Raspberry Pi Software Configuration Tool...
Page 122: ......
Page 123: ...Chapter 7 Advanced Raspberry Pi Configuration...
Page 140: ......
Page 141: ...Chapter 8 The Pi as a Home Theatre PC...
Page 151: ...Chapter 9 The Pi as a Productivity Machine...
Page 160: ......
Page 161: ...Chapter 10 The Pi as a Web Server...
Page 172: ......
Page 173: ...Chapter 11 An Introduction to Scratch...
Page 189: ...Chapter 12 An Introduction to Python...
Page 216: ......
Page 218: ......
Page 219: ...Chapter 13 Learning to Hack Hardware...
Page 234: ......
Page 235: ...Chapter 14 The GPIO Port...
Page 249: ...Chapter 15 The Raspberry Pi Camera Module...
Page 265: ...Chapter 16 Add on Boards...
Page 280: ......
Page 281: ...Appendix A Python Recipes...
Page 287: ...Appendix B Raspberry Pi Camera Module Quick Reference...
Page 293: ...Appendix C HDMI Display Modes...