O'Reilly logo

Raspberry Pi Cookbook, 2nd Edition by Simon Monk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Hardware Basics

9.0 Introduction

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

Note

Be sure to check out the accompanying video for this recipe at http://razzpisampler.oreilly.com.

Problem

You need to connect electronics to the GPIO connector, but first you need to know more about what all the pins do.

Solution

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. 

Figure 9-1 shows the GPIO pinout for revisions 1 and 2 of the original Raspberry Pi Model B. The quick way to distinguish the boards is knowing that if you have one of the very first revision 1 boards, it has a black audio socket. The revision 2 boards have a blue audio socket.

rpck 0801
Figure 9-1. The GPIO pinout (26-pin models)

There were three changes to the GPIO connector between revision 1 and revision 2. These are highlighted in Figure 9-1. First, the I2C port was swapped. The two pins SDA and SCL are still SDA and SCL but use a different internal I2C interface. This means that if you’re using the pins as GPIO rather than I2C, then you will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required