The Raspberry Pi General Purpose Input/Output (GPIO) port shown above is available on the Raspberry Pi A+, Raspberry Pi B+, and Raspberry Pi 2 Model B systems. It is an upgrade from the 26 pin version found on the Raspberry Pi Model A and B.
The Raspberry Pi’s GPIO port has been designed to allow the single-board micro-computer to reach the physical world. Most of the pins of the GPIO can be used as either Inputs or Outputs depending upon a particular application’s needs.
The GPIO pins can be used to control buttons, lights, robots, alarms, sensors, home automation, and much more. The interaction between the programs written for the Raspberry Pi and what is controlled via the GPIO port are part of what makes physical computing a great way to learn about the field of Computer Science.
It is interesting to note that there are 2 different numbering systems for the GPIO pinout. Referring to the pins by the numbers indicated by the pin’s physical location is known as the BOARD mode in the programming language Python. Alternatively, referring to the pins as the Broadcom System On Chip (SOC) sees them is known as BCM mode. For example, in the image above, physical pin 3 is labeled “2” and physical pin 11 is labeled “17”.
In the programming language Python, it is necessary to let the system know which numbering system one is using in a particular application. Luckily, it is as simple as incorporating one of the following GPIO.setmode() commands into one’s code: