GPIO pins

GPIO pins

The Raspberry Pi’s GPIO port is a 26-pin port, fitted with two rows of 13 male 2.54 mm headers at the factory. The spacing of these headers is particularly important: 2.54 mm pin
spacing (0.1 inches) is a very common sight in electronics.

GPIO stands for General Purpose Input Output . The GPIO pins on the Raspberry Pi are connected directly to the GPIO ports on the processor. The processor runs at 3.3V and as such the GPIO ports are designed for 3.3V. The output of the GPIO is able to provide a current of up to 16mA. The GPIO port provides seven pins for general-purpose use by default: Pin 11, Pin 12, Pin 13, Pin 15, Pin 16, Pin 18 and Pin22. Additionally, Pin 7—while defaulting to providing a clock signal for general purpose use—can also be used as a generalpurpose pin, giving eight pins in total. These pins can be toggled between two states: high, where they are providing a positive voltage of 3.3 V; and low, where they are equal to ground or 0 V. This equates to the 1 and 0 of binary logic, and can be used to turn other components on or off.


the GPIO ports on the Raspberry Pi make it possible to connect simple electronic circuits to the Raspberry Pi.  There have been some changes to the GPIO port numbers used on the GPIO pins. In September 2012, the revision 2 boards were released and they changed some of the pin allocations. The model B+ and A+ boards (released July 2014 and November 2014 respectively) added 14 new pins, thereby increasing the total pins from 26 to 40.

In the  26 pins version, the top left pin is called pin 1, the one to the right of it is pin 2. So the next row is 3, 4 etc. and on down to 25, 26. This is how pin headers are numbered. But Pins have names too. This is slightly confusing, as each pin has also a name, according to what it does. 




red:  +voltage for power (3.3V or 5V)
black: -volatge or in other name ground
yellow: all dedicated general purpose I/O ports 
greeny/grey: i2c interface
light grey: UART (serial port)
orange: SPI (Serial Peripheral Interface)

For GPIO programming purposes,  the best is to use the yellow ones (these are dedicated to this purpose.) The  green/grey/orange can all be used as well as GPIO ports, but they have other functions too, so additional attention is needed to avoid any conflicts.

In Python RPi.GPIO module, you can use either pin numbers (BOARD) or the Broadcom GPIO numbers (BCM), but you can use only one of them.

In Python it looks like this:
import RPi.GPIO as GPIO  
  
# for GPIO numbering, choose BCM  
GPIO.setmode(GPIO.BCM)  
  
# or, for pin numbering, choose BOARD  
GPIO.setmode(GPIO.BOARD)  

# but you can't have both, so only use one!!!  

=============================================

Extension Board (SunFounder)


This extension board implements an additional naming scheme:





Finding the correct pin, can be done with this table:



==================================


Pi 1 Model B Revision 2.0:





Pi1 Model B+, Pi 2B, Pi Zero and Pi 3B:



No comments:

Post a Comment