When using the RPi.GPIO library in Python you have to call

import RPi.GPIO as GPIO

and then

GPIO.setmode(GPIO.BOARD)

or

GPIO.setmode(GPIO.BCM)

What is the difference between these two options?

up vote 126 down vote accepted

I got the information below from here.

The GPIO.BOARD option specifies that you are referring to the pins by the number of the pin the the plug - i.e the numbers printed on the board (e.g. P1) and in the middle of the diagrams below.

The GPIO.BCM option means that you are referring to the pins by the "Broadcom SOC channel" number, these are the numbers after "GPIO" in the green rectangles around the outside of the below diagrams:

Unfortunately the BCM numbers changed between versions of the Pi1 Model B, and you'll need to work out which one you have guide here. So it may be safer to use the BOARD numbers if you are going to use more than one Raspberry Pi in a project.

  • The Model B+ uses the same numbering as the Model B r2.0, and adds new pins (board numbers 27-40).
  • The Raspberry Pi Zero, Pi 2B and Pi 3B use the same numbering as the B+.

Pi1 Model B+, Pi 2B, Pi Zero and Pi 3B: GPIO pin numbering diagram


Pi 1 Model B Revision 2.0:

GPIO pin numbering diagram


Pi 1 Model B Revision 1.0: GPIO pin numbering diagram

  • 1
    And for completeness the A is the same as later model B boards and the A+ is the same as the B+. – Peter Green Jun 8 '17 at 12:58
  • 1
    It's annoying. Just put two small numbers by each pin. Seriously @LadyAda – user2497 Aug 28 '17 at 22:16

protected by Ghanima Aug 27 '17 at 17:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.