BCM vs Board Pin Numbering on Raspberry Pi: Key Differences and Usage
BCM numbering refers to the Broadcom chip's GPIO pin numbers, while Board numbering refers to the physical pin positions on the Pi's header. BCM is based on the chip's internal numbering, and Board is based on the actual layout of pins on the hardware.Quick Comparison
Here is a quick side-by-side comparison of BCM and Board pin numbering systems on Raspberry Pi.
| Factor | BCM Numbering | Board Numbering |
|---|---|---|
| Definition | GPIO numbers from Broadcom chip | Physical pin positions on header |
| Reference | Chip datasheet GPIO layout | Pin layout on Raspberry Pi board |
| Pin Count | Depends on chip GPIO count | Fixed 40 pins (on modern models) |
| Use Case | Programming GPIO by function | Wiring and hardware connections |
| Example Pin | GPIO 17 | Pin 11 on header |
| Consistency | Same across Pi models with same chip | Same physical layout across models |
Key Differences
The BCM numbering system uses the GPIO numbers assigned by the Broadcom chip inside the Raspberry Pi. These numbers correspond to the chip's internal wiring and are consistent with the chip's datasheet. When programming GPIO pins using libraries like RPi.GPIO or gpiozero, specifying pins by BCM means you refer to the chip's GPIO numbers.
On the other hand, the Board numbering system refers to the physical pin positions on the Raspberry Pi's 40-pin header. This numbering is fixed by the hardware layout and is easier to use when connecting wires or hardware components because it matches the actual pin location on the board.
Choosing between BCM and Board depends on whether you want to think in terms of the chip's GPIO functions (BCM) or the physical layout of pins (Board). BCM numbering can be more flexible for programming, while Board numbering is more intuitive for hardware wiring.
Code Comparison
Here is an example of turning on an LED connected to GPIO 17 using BCM numbering in Python with the RPi.GPIO library.
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # Use BCM numbering GPIO.setup(17, GPIO.OUT) # Set GPIO 17 as output GPIO.output(17, GPIO.HIGH) # Turn LED on print("LED on using BCM pin 17") time.sleep(2) GPIO.output(17, GPIO.LOW) # Turn LED off GPIO.cleanup()
Board Equivalent
The same LED control using Board numbering refers to the physical pin 11, which corresponds to GPIO 17 on BCM.
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) # Use Board numbering GPIO.setup(11, GPIO.OUT) # Set physical pin 11 as output GPIO.output(11, GPIO.HIGH) # Turn LED on print("LED on using Board pin 11") time.sleep(2) GPIO.output(11, GPIO.LOW) # Turn LED off GPIO.cleanup()
When to Use Which
Choose BCM numbering when you want to write code that directly references the GPIO functions of the Broadcom chip, especially if you want your code to be consistent across different Raspberry Pi models with the same chip.
Choose Board numbering when you are wiring hardware and want to refer to the physical pin locations on the Raspberry Pi header, making it easier to connect components without confusion.
In summary, use BCM for programming clarity and Board for hardware wiring clarity.