Chapter 9. Hardware Basics
This chapter contains some basic recipes for setting up and using the Raspberry Pi’s general-purpose input/output (GPIO) connector. This connector allows you to connect all sorts of interesting electronics to your Raspberry Pi.
9.1 Finding Your Way Around the GPIO Connector
You need to connect electronics to the GPIO connector, but first you need to know more about what all the pins do.
There have actually been three versions of the Raspberry Pi GPIO connector: two 26-pin layouts for the original Raspberry Pi, and one 40-pin layout that came in with the Raspberry Pi “+” models and has been in use ever since.
Figure 9-1 shows the current 40-pin layout, which is the same for all 40-pin GPIO Raspberry Pi models right up to the Raspberry Pi 4.
The top 26 pins are the same as the 26 pins of the original Raspberry Pi model B revision 2. This allows the 40-pin Raspberry Pi models to use hardware and software designed for the earlier 26-pin Raspberry Pi designs. The extra pins of the 40-pin connector are made up of three useful extra GND connections and nine GPIO pins. The ID_SD and ID_SC pins are intended for use in communicating with a special serial memory chip, which can be included on interface boards that conform to the Hardware Attached on Top (HAT) standard and allows the Raspberry Pi to identify the board (see the Discussion section, next).
At the top of the connector, ...