Raspberry Pi Pin Numbers – Python

Python provides two different ways of identifying the GPIO pins on the Raspberry Pi P1 header socket. For example, pin 11 in the BOARD scheme is the same as GPIO17 in the BCM scheme. There are two options as follows.

  • GPIO.setmode(GPIO.BCM)
  • GPIO.setmode(GPIO.BOARD)

Of the two options, I would choose BOARD because it follows the numbers marked on the GPIO P1 socket. This is probably the easiest scheme to use because you can simply count off the numbers. The BCM option represents the pin numbers on the Broadcom BCM2835 processor; therefore, a translation table is required to determine how they map to the P1 socket. The BCM option is the least useful option and usually not used.

Socket Number GPIO.BOARD GPIO.BCM
P1_01 1
P1_02 2
P1_03 3 GPIO0
P1_04 4 Not Connected
P1_05 5 GPIO1
P1_06 6 Not Connected
P1_07 7 GPIO4
P1_08 8 GPIO14
P1_09 9 Not Connected
P1_10 10 GPIO15
P1_11 11 GPIO17
P1_12 12 GPIO18
P1_13 13 GPIO21
P1_14 14 Not Connected
P1_15 15 GPIO22
P1_16 16 GPIO23
P1_17 17 Not Connected
P1_18 18 GPIO24
P1_19 19 GPIO10
P1_20 20 Not Connected
P1_21 21 GPIO9
P1_22 22 GPIO25
P1_23 23 GPIO11
P1_24 24 GPIO8
P1_25 25 Not Connected
P1_26 26 GPIO7

Related Articles

Raspberry Pi Blink LED
Test Circuit Breadboard Build
Raspberry Pi Blink LED Tutorial 2
Raspberry Pi Pin Numbers - Python
Current Limiting Series Resistance Calculator for LEDs