0
0
Iot-protocolsComparisonBeginner · 4 min read

BCM vs Board Pin Numbering on Raspberry Pi: Key Differences and Usage

On Raspberry Pi, 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.

FactorBCM NumberingBoard Numbering
DefinitionGPIO numbers from Broadcom chipPhysical pin positions on header
ReferenceChip datasheet GPIO layoutPin layout on Raspberry Pi board
Pin CountDepends on chip GPIO countFixed 40 pins (on modern models)
Use CaseProgramming GPIO by functionWiring and hardware connections
Example PinGPIO 17Pin 11 on header
ConsistencySame across Pi models with same chipSame 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.

python
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()
Output
LED on using BCM pin 17
↔️

Board Equivalent

The same LED control using Board numbering refers to the physical pin 11, which corresponds to GPIO 17 on BCM.

python
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()
Output
LED on using Board pin 11
🎯

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.

Key Takeaways

BCM numbering refers to Broadcom chip GPIO numbers; Board numbering refers to physical pin positions.
Use BCM numbering for programming GPIO functions consistently across Pi models.
Use Board numbering for wiring hardware by physical pin location on the Pi header.
Both numbering systems can control the same pins but use different references.
Always specify the numbering mode in your code to avoid confusion.