Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours

(singke) #1
TABLE 24.1 The GPIO Pins

Watch Out!: GPIO Pins Versus Signals
The GPIO signals are numbered after the pin number on the Broadcom chip.
Unfortunately, they don’t correlate the actual pins used in the GPIO interface. (For
example, GPIO signal 2 is on pin 3 of the GPIO interface.) You must be careful when
referencing the pin connections. Make sure you know whether you’re working with pin
numbers or signal numbers. The code in this hour uses signal numbers because this is
the method most hardware interface devices use.

Connecting to the GPIO


There are three common ways to connect to the GPIO pins on the Raspberry Pi motherboard:


Directly plug wires into them.
Use the Pi Cobbler breakout box.
Use the Gertboard experimental device.

Watch Out!: Connecting to the GPIO
Although you can plug wires directly into the GPIO pins on the motherboard, doing so
is somewhat of a risky adventure. If you accidentally short out the wrong pins, you risk
damaging your entire Raspberry Pi unit! It’s much safer (especially for beginners) to
use either the Pi Cobbler or the Gertboard.

Let’s take a closer look at how to connect to the GIO using the Pi Cobbler and the Gertboard.


Connecting to the GPIO via the Pi Cobbler


The Pi Cobbler is an inexpensive breakout box that connects to the GPIO pins using a standard 26-pin
ribbon cable. It then breaks out the pins into a form that you can plug into a standard breadboard
socket (see Figure 24.1).

Free download pdf