To communicate with the outside world, the Raspberry Pi has a component called the GPIO, which stands for General Purpose Input Output.

The GPIO is a set of 40 pins that are located on the side of the Raspberry Pi and are used for a variety of hardware applications.

A Raspberry Pi 4 with the 40 pin General Purpose Input Output header on the right side.

As their name suggests, the GPIO pins are capable of both the input and output of data. In this lesson, we will focus on using the GPIO to light up LEDs!


The image in the workspace identifies each pin number for the GPIO and the function it provides:

  • Pins 1 and 17: 3.3V supply, which equates to the positive terminal on a 3.3V electric supply.
  • Pins 2 and 4: 5V supply, which equates to the positive terminal on a 5V electric supply.
  • Pins 6, 9, 14, 20, 25, 30, 34 and 39: Ground, the negative terminal on any power supply.

The remaining 28 pins (17 on older models) are Input-Output pins. Labeled “GPIO#”, the I/O pins can act as input to read 0 or 3.3V or act as output to supply 0V or 3.3V.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?