A short introduction to the GPIO pins of the Raspberry Pi

A Short Introduction to the GPIO pins of the Raspberry Pi
Published: by
Last updated:

The Raspberry Pi is equipped with a set of input/output or GPIO (general-purpose input/output) pins. This powerful feature significantly expands the Raspberry Pi’s abilities to communicate with other devices. These pins are connected directly the to CPU of the Raspberry Pi.

This is an ongoing post. Please suggest corrections, explanations, etc. in the comment section at the bottom of this page.

The newer Raspberry Model B, including the Raspberry Pi 2 & 3 have a total of 40 GOI pins, while the older Model A boards have a total of 26 pins. The Raspberry Pi Zero and Raspberry Pi Zero W has 40 unpopulated/headerless pins (holes). Pins are aligned as two equal rows (i.e. 2x 20 or 2x 13).

The pins include 5V (2), 3.3V (2), ground (5 for A & 8 for B) and a few other pins mentioned below. Apart from sensing high and low signals, some of the GPIO pins also doubles for other functions.

Through, for example, Linux Bash and Python programming, complex logic to and from these pins can be programmed to interact with various microelectronic components such as LEDs, switches, buttons, communication and display modules. The networking capabilities and the control of various USB devices makes the possibilities almost endless.

Raspberry Pi GPIO specifications

Model B

Operating voltage (logic level): 3.3V DC
Input voltage: 5V DC
Power source: 5V via Micro-B or GPIO I/O pins
Digital I/O (read/write) pins: 22
Interrupt pins: all
Analog input pins:
Operating current (per I/O pin): ~8 mA (15 mA max) (50 mA max all)
Interfaces: Serial/UART (GPIO 14 & 15), SPI, I2C
Breadboard friendly: na
Pin size: male, 5 x 2.54 mm

Raspberry Pi model B GPIO pinout

Raspberry Pi GPIO Layout Model B Plus
Example of a Raspberry Pi Model B GPIO pinout. This pinout is commonly used when for e.g. using the Wiring Pi Python library. Other libraries might use a different pinout. Image from RaspberryPi-Spy.co.uk

Output pins

A GPIO pin designated as an output pin can be set to HIGH (3.3V) or LOW (0V).

Input pins

A GPIO pin designated as an input pin can be read as HIGH (3.3V) or LOW (0V). This is made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have fixed pull-up resistors, but for other pins this can be configured in software.

Interrupt pins

On the Raspberry Pi, each GPIO pin can also be configured as an interrupt pin.

Serial pins

The Raspberry Pi is capable of serial communication with other devices. Tx (GPIO14) and Rx (GPIO15) pins uses 0 and 3.3 V TTL (transistor-transistor logic) to produce its signal. Also read using the UART interface for more advanced information on how to set up serial communication on the Raspberry Pi.

Raspberry Pi GPIO libraries

There are currently a couple of libraries available to be able to utilise the GPIO pins of the Raspberry Pi. GPIO Zero (which is included by default in the Raspbian image) and Wiring Pi are fairly comprehensive. Other, less developed libraries include RPi.GPIO, pi-gpio and raspberry-gpio-python.

Related product links

Please support Behind The Scenes by using these links to purchase these related products online from our partner websites. Links will open in a new window...

About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.
Behind the Scenes is a free, informative website. If you find value in any of out content, please consider making a donation to our cause.
Donate via PayPal

Save, share & Disqus

Use the buttons below, on the left or the bottom of this page to share this post. Your comment is important, but don't be a knob. Keep it constructive and polite.

Comment via Disqus

Disqus is a worldwide comment hosting service for web sites and online communities. This secure platform ensures a pleasant commenting environment which is manageable from one account. Use the Login button to sign up.

More Raspberry Pi related posts

Fiverr – Freelance services marketplace for the lean entrepreneur
Fiverr – Freelance services marketplace for the lean entrepreneur
16 July 2019
Ad: Fiverr is the world’s largest freelance services marketplace for entrepreneurs to focus on growth & create a successful business at affordable costs. More…
Raspberry Pi media centre
Using a Raspberry Pi as a cheap media centre
2 March 2019
With a plethora of mini media centre boxes becoming readily available, it comes as no surprise that open source platforms are also available for this purpose. Kodi is one such platform and it is available to be installed onto a Raspberry Pi. More…
Categories
KodiRaspberry Pi
Getting started with private projects on Raspbian and Bitbucket
Getting started with private projects on Raspbian and Bitbucket
28 October 2018
Bitbucket is a great alternative to Github to start, store and track simple programming dependant project files. On a Raspberry Pi it can be simply done using Raspbian. In addition to Github, projects uploaded to Bitbucket with less than 6 contributors can be kept private and won’t cost a cent. More…
Taking a screenshot on a Raspberry Pi from a remote location
Taking a screenshot on a Raspberry Pi from a remote location
1 July 2018
Whether it is for debugging purposes, making images for tutorials or capturing a moment in a game, screenshots (screengrabs or screen captures) often come in handy. Most operating systems, including Raspbian, will have options to create screenshots by using the keyboard, but what if no keyboard is connected? More…
Categories
Raspberry Pi