© Warren Gay 2018
Warren GayAdvanced Raspberry Pihttps://doi.org/10.1007/978-1-4842-3948-3_4

4. LEDs and Header Strips

Warren Gay1 
(1)
St. Catharine’s, Ontario, Canada
 

This chapter introduces the Raspberry Pi LEDs and header strips. These are important interfaces from the Pi to the outside world. You may want to use a bookmark for Table 4-5, which outlines the GPIO (general purpose input/output) pins on the modern header strip P1.

Status LEDs

The Raspberry Pi has different sets of LED indicators, depending upon the model. Table 4-1 provides an overall reference chart.5 The Raspberry Pi Zero and Zero W have been lumped together.
Table 4-1

Table of Raspberry Pi LED Indicators

LED

Color

A

A+

B

B+

Pi 2

Pi 3

Zero/W

OK/ACT

Green

Yes

Yes

Yes

Yes

Yes

Yes

Yes

PWR

Red

Yes

Yes

Yes

Yes

Yes

Yes

No

FDX

Green

No

No

Yes

Yes

Jack

Jack

No

LINK

Green

No

No

Yes

Jack

Jack

Jack

No

10M/100

Yellow

No

No

Yes

No

No

No

No

OK/ACT LED

This is the SD (secure digital) card activity indicator.

PWR LED

On the original Model B and the following Model A, this LED was wired to the 3.3 V regulator and indicated that the regulator had power. In later models, this LED will flash when the input power falls below 4.63 V.

FDX LED

This indicates that the network is full duplex connected.

LINK LED

The LINK LED indicates if there is network activity on the LAN (local area network).

10M/100 LED

This yellow LED indicates when the network is operating at 100 Mbit/s.

Original Header P1

The original Raspberry Pi models A and B used a 13 x 2 header strip identified as P1, which exposes the GPIO pins. This includes the I2C, SPI, and UART peripherals as well as power connections. Table 4-2 lists the connections for this older header strip.
Table 4-2

Original Pi GPIO Header Connector P1 (Top View)

Lower Left

Pins

Upper Left

3.3 V power

P1-01

P1-02

5 V power

GPIO 0 (I2C0 SDA)+R1=1.8k

P1-03

P1-04

5 V power

GPIO 1 (I2C0 SCL)+R2=1.8k

P1-05

P1-06

Ground

GPIO 4 (GPCLK 0/1-Wire)

P1-07

P1-08

GPIO 14 (TXD)

Ground

P1-09

P1-10

GPIO 15 (RXD)

GPIO 17

P1-11

P1-12

GPIO 18 (PCM_CLK)

GPIO 21 (PCM_DOUT)

P1-13

P1-14

Ground

GPIO 22

P1-15

P1-16

GPIO 23

3.3 V power

P1-17

P1-18

GPIO 24

GPIO 10 (MOSI)

P1-19

P1-20

Ground

GPIO 9 (MISO)

P1-21

P1-22

GPIO 25

GPIO 11 (SCKL)

P1-23

P1-24

GPIO 8 (CE0)

Ground

P1-25

P1-26

GPIO 7 (CE1)

Revised GPIO Header P1

Table 4-3 illustrates the revisions made to the original a 13 x 2 header strip P1. Notice that the I2C peripheral changed from I2C0 to I2C1.
Table 4-3

Revised Original Pi GPIO Header Connector P1 (Top View)

Lower Left

Pins

Upper Left

3.3 V power, 50 mA max

P1-01

P1-02

5 V power

GPIO 2 (I2C1 SDA1)+R1=1.8k

P1-03

P1-04

5 V power

GPIO 3 (I2C1 SCL1)+R2=1.8k

P1-05

P1-06

Ground

GPIO 4 (GPCLK 0/1-Wire)

P1-07

P1-08

GPIO 14 (TXD0)

Ground

P1-09

P1-10

GPIO 15 (RXD0)

GPIO 17 (GEN0)

P1-11

P1-12

GPIO 18 (PCM_CLK/GEN1)

GPIO 27 (GEN2)

P1-13

P1-14

Ground

GPIO 22 (GEN3)

P1-15

P1-16

GPIO 23 (GEN4)

3.3 V power, 50 mA max

P1-17

P1-18

GPIO 24 (GEN5)

GPIO 10 (SPI_MOSI)

P1-19

P1-20

Ground

GPIO 9 (SPI_MISO)

P1-21

P1-22

GPIO 25 (GEN6))

GPIO 11 (SPI_SCKL)

P1-23

P1-24

GPIO 8 (CE0_N)

Ground

P1-25

P1-26

GPIO 7 (CE1_N)

Older models that had the P1 connector in Table 4-3 also had the P5 header shown vin Table 4-4.
Table 4-4

Rev 2.0 P5 Header (Top View)

Lower Left

Pins

Upper Left

(Square) 5 V

P5-01

P5-02

3.3 V, 50 mA

GPIO 28

P5-03

P5-04

GPIO 29

GPIO 30

P5-05

P5-06

GPIO 31

Ground

P5-07

P5-08

Ground

Revision 2.0 GPIO Header P1

Starting with the Model B+ and A+, the GPIO header was standardized to use a 40-pin (20 x 2) header. GPIO pins ID_SD (GPIO0, P1-27) and ID_SC (GPIO1, P1-28) are reserved for board (HAT) detection/identification. These pins are used to read the 24Cxx type 3.3 V 16-bit addressable I2C EEPROM in the HAT.
Table 4-5

The Standardized 40-Pin Raspberry Pi GPIO Header (All Modern Units)

Lower Left

Pins

Upper Left

3.3 V power, 50 mA max

P1-01

P1-02

5 V power

GPIO 2 (I2C1 SDA1)+R1=1.8k

P1-03

P1-04

5 V power

GPIO 3 (I2C1 SCL1)+R2=1.8k

P1-05

P1-06

Ground

GPIO 4 (GPCLK 0/1-Wire)

P1-07

P1-08

GPIO 14 (TXD0)

Ground

P1-09

P1-10

GPIO 15 (RXD0)

GPIO 17 (GEN0)

P1-11

P1-12

GPIO 18 (PCM_CLK/GEN1)

GPIO 27 (GEN2)

P1-13

P1-14

Ground

GPIO 22 (GEN3)

P1-15

P1-16

GPIO 23 (GEN4)

3.3 V power

P1-17

P1-18

GPIO 24 (GEN5)

GPIO 10 (SPI_MOSI)

P1-19

P1-20

Ground

GPIO 9 (SPI_MISO)

P1-21

P1-22

GPIO 25 (GEN6))

GPIO 11 (SPI_SCKL)

P1-23

P1-24

GPIO 8 (CE0_N)

Ground

P1-25

P1-26

GPIO 7 (CE1_N)

GPIO0 (ID_SD)

P1-27

P1-28

GPIO1 (ID_SC)

GPIO5

P1-29

P1-30

Ground

GPIO6

P1-31

P1-32

GPIO12 (PWM0)

GPIO13 (PWM1)

P1-33

P1-34

Ground

GPIO19 (MISO)

P1-35

P1-36

GPIO16

GPIO26

P1-37

P1-38

GPIO20 (MOSI)

Ground

P1-39

P1-40

GPIO21 (SCLK)

Safe Mode

Raspbian Linux used to support a safe mode, but it has been removed as of March 2014. However, NOOBS may still support it.6

Pin P1-05, GPIO3 is special to the boot sequence. Grounding this pin or jumpering this to P1-06 (ground) causes the boot sequence to use a safe mode boot procedure. If the pin is used for some other purpose, you can prevent this with a configuration parameter:
avoid_safe_mode=1

Be very careful that you don’t accidentally ground a power pin (like P1-01 or P1-02) when you do use it. If your Pi fails to respond to safe mode, it may be due to a manufacturing error or lack of firmware support. See this message:

www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=12007

When safe mode is invoked by the jumper, the config.txt file is ignored except for the avoid_safe_mode parameter. Additionally, this mode overrides the kernel command line, and kernel_emergency.img is loaded. If this file is unavailable, kernel.img is used instead.

The intent of this feature is to permit the user to overcome configuration problems without having to edit the SD card on another machine in order to make a correction. The booted emergency kernel is a BusyBox image with /boot mounted so that adjustments can be made. Additionally, the /dev/mmcblk0p2 root file system partition can be fixed up or mounted if necessary.

Logic Levels

The logic level used for GPIO pins is 3.3 V and is not tolerant of 5 V TTL logic levels. The Raspberry Pi pcb is designed to be plugged into pcb extension cards (HATs) or otherwise carefully interfaced to 3.3 V logic. Input voltage parameters VIL and VIH are described in more detail in Chapter 11.

GPIO Configuration at Reset

The Raspberry Pi GPIO pins can be configured by software control to be input or output, to have pull-up or pull-down resistors, or to assume some specialized peripheral function. After reset, only GPIO14 and 15 are assigned a special function (UART). After boot up, however, software can even reconfigure the UART pins as required.

When a GPIO pin is configured for output, there is a limited amount of current that it can drive (source or sink). By default, each P1 GPIO is configured to use an 8 mA driver, when the pin is configured as an output. Chapter 11 has more information about this.

Note

Raspbian default 1-Wire bus is GPIO 4 (GPCLK0) Pin P1-07.

1-Wire Driver

The default GPIO pin for the 1-Wire driver used to be hard-coded to use GPIO4. This can now be configured.

Summary

This chapter provided an introduction to the LED indicators and header strips found on your Raspberry Pi. While all new Pi’s now use the 20 x 2 GPIO header strip, the original headers were described for reference purposes. A Pi is never too old to be put to work!