We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Skip main navigation

General Purpose Input Output on the Raspberry Pi

One powerful feature of the Raspberry Pi is the row of GPIO pins along the top edge of the board. GPIO stands for General-Purpose Input/Output.
Children with electronic components on a table
© CC BY-SA 4.0
The GPIO pins are one way in which the Raspberry Pi can control and monitor the outside world by being connected to electronic circuits.
The Pi can control LEDs, turning them on or off, drive motors, and interact with many other objects. It can also detect the pressing of a switch, change in temperature, or light, etc, by attaching kinds of sensors. We refer to all these activities, and more, as physical computing.

GPIO

Most models of the Raspberry Pi have 40 pins that look like this:
GPIO pins
These pins are a physical interface between the Raspberry Pi and the outside world. Using them, you can program the Raspberry Pi to switch devices on and off (output), or receive data from sensors and switches (input). Of the 40 pins, 26 are GPIO pins and the others are power or ground pins (plus two ID EEPROM pins which you should not play with unless you know your stuff!)
Early models A and B have only 26 pins, and look like this:
26 pin layout

GPIO Pin Numbering

When programming the GPIO pins there are two different ways to refer to them: GPIO numbering and physical numbering. Throughout this course (and in all our resources) we will refer to the pins using the GPIO numbering scheme. These are the GPIO pins as the computer sees them. The numbers don’t make any sense to humans, they jump about all over the place, so there is no easy way to remember them. However, you can use a printed reference, a reference board that fits over the pins or a website guide to help you out.
GPIO layout
© CC BY-SA 4.0
This article is from the free online

Teaching Physical Computing with Raspberry Pi and Python

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education