Function: what a Raspberry Pi 5 does in a circuit
A fast small computer on one board. It runs Linux, and your Python programs switch and read its 40 header pins through the gpiozero library.
- Runs your Python program on a fast Linux computer
- Switches and reads 26 GPIO pins at 3.3 V through the gpiozero library
- Connects a project to screens, a network, cameras and USB devices
- Handles heavy jobs such as image recognition and web servers
Raspberry Pi 5 key facts
| Processor | Broadcom BCM2712, four ARM Cortex-A76 cores at 2.4 GHz |
|---|---|
| Memory | 1, 2, 4, 8 or 16 GB RAM; programs and files on a microSD card |
| Input and output chip | RP1, designed by Raspberry Pi; it runs the header pins, USB and Ethernet |
| GPIO voltage | 3.3 V (pins are not 5 V tolerant); reads LOW below 0.8 V and HIGH above 2.0 V |
| GPIO current | about 16 mA from one pin, about 50 mA from all pins together |
| Header | 40 pins, the same layout as the Pi 4: 26 GPIO, two 5 V, two 3.3 V, eight GND, two ID pins |
| Analog inputs | none (add an ADC chip such as the MCP3008) |
| Fixed pull-ups | 1.8 kΩ on GPIO 2 (SDA) and GPIO 3 (SCL) |
| Ports | two USB 3.0, two USB 2.0, Gigabit Ethernet, two micro HDMI, two camera or display connectors, PCIe, fan, UART and clock battery connectors |
| Power | 5 V, 5 A through USB-C; power button on the board |
| Python GPIO library | gpiozero (RPi.GPIO does not work) |
| Size | 85 mm × 56 mm |
- What the Raspberry Pi 5 is
- What the Raspberry Pi 5 is for
- How the Raspberry Pi 5 runs your program and its pins
- How to use the Raspberry Pi 5 in the simulator
- Worked example
- Common mistakes
- Key words
- What to learn first and next
What the Raspberry Pi 5 is
The Raspberry Pi 5 is a single-board computer: a complete computer built on one circuit board about the size of a bank card (85 mm × 56 mm). It has a processor with four cores that runs at 2.4 GHz, between 1 GB and 16 GB of memory, Wi-Fi, Bluetooth, an Ethernet socket, four USB sockets and two outputs for screens. It has no hard disk. Its operating system, usually a version of Linux called Raspberry Pi OS, and all your files are kept on a small microSD card. You can plug in a screen, a keyboard and a mouse and use it like a desktop computer.
What makes it useful for electronics is the row of 40 metal pins along one edge, called the header. A program can switch 26 of these pins on and off, or read them, so the Pi can light LEDs, read buttons and sensors, and control motors through driver parts. This is different from a microcontroller board such as the Arduino Uno or the Raspberry Pi Pico. A microcontroller runs one program, starts in an instant and has no operating system. The Raspberry Pi 5 runs many programs at once under an operating system, is far faster, and is usually programmed in Python.
The Raspberry Pi 5 came out in 2023 and follows the Raspberry Pi 4 Model B. The header has the same 40 pins in the same places, so the same wiring works on both. Two things changed for a student who writes code. First, the header pins are now run by a separate chip called the RP1, not by the main processor. Second, because of that, the older Python library RPi.GPIO does not work on the Pi 5, and programs use the gpiozero library instead.
What the Raspberry Pi 5 is for
- Learning Python with real hardware. A few lines of Python make an LED blink or read a button, on a computer that can also show the result on a screen or a web page.
- Projects that need a full computer. Cameras and image recognition, a web server for a weather station, a media player, a home automation hub or a robot that plans its own route.
- Projects that need a network. Wi-Fi, Bluetooth and Ethernet are built in, so a sensor reading can be saved to a file or sent to another computer.
- A small desktop computer. It can run two 4K screens, a web browser and office programs.
- Not the best choice for a small battery-powered device, exact timing or reading analog sensors directly. A microcontroller such as the Raspberry Pi Pico, the ESP32 or an Arduino does those jobs better and costs less.
How the Raspberry Pi 5 runs your program and its pins
Starting up. When power is connected, the processor (a Broadcom BCM2712) loads the operating system from the microSD card. This takes some seconds. After that you open a terminal, which is a window where you type commands, and start your program with python3 name.py. The program runs until it ends or until you press Ctrl+C. In the simulator, Run starts the program and Stop is Ctrl+C.
The header. The 40 pins are in two rows of 20. Every pin has a physical number from 1 to 40, counted by position: pin 1 is at the end nearest the corner of the board, odd numbers are on the inner row and even numbers on the row at the edge. Twelve pins are for power: two give 5 V (pins 2 and 4), two give 3.3 V (pins 1 and 17) and eight are GND. Two pins (27 and 28) are kept for add-on boards. The other 26 are GPIO pins, and each of those also has a GPIO number. Physical pin 11, for example, is GPIO 17, and physical pin 15 is GPIO 22. The two numbers are different names for the same pin.
What a GPIO pin does. As an output, a pin is either HIGH (3.3 V) or LOW (0 V). As an input, the Pi reads a voltage below 0.8 V as LOW and a voltage above 2.0 V as HIGH. One pin can safely give about 16 mA, and all the pins together about 50 mA. The pins are not 5 V tolerant: 5 V on a GPIO pin damages the board. There is no analog input, so a sensor that gives a changing voltage needs a converter chip.
The RP1 chip. On older Raspberry Pi computers the main processor drives the header pins itself. On the Pi 5 the processor passes this job to the RP1, a chip designed by Raspberry Pi. The RP1 also runs the USB and Ethernet ports. The processor and the RP1 talk over a fast link called PCI Express.
Why RPi.GPIO fails and gpiozero works. The RPi.GPIO library reaches into the memory of the main processor to find the pins. On a Pi 5 the pins are not there, so the first GPIO.setup() stops with RuntimeError: Cannot determine SOC peripheral base address. SOC means “system on a chip”, the main processor. The gpiozero library does not reach into the processor. It asks the operating system for a pin, and the operating system knows about the RP1. That is why from gpiozero import LED then led = LED(17) works on every Raspberry Pi. gpiozero counts by GPIO number, so LED(17) is physical pin 11. To count by position, write LED("BOARD11").
Ready-made objects. gpiozero gives you an object for each kind of part. LED(17) has on(), off(), toggle() and blink(). Button(22) has is_pressed, wait_for_press() and when_pressed. Button switches on a pull-up resistor inside the Pi, so you wire the button between the pin and GND and need no resistor of your own. PWMLED sets a brightness from 0 to 1.
How to use the Raspberry Pi 5 in the simulator
- Open the Free build and choose Raspberry Pi 5 (Python) under Board, or open the Studio and add the Raspberry Pi 5 from Components › Boards.
- Read the starter program in the Code panel. It imports
LEDfrom gpiozero and blinks GPIO 17. - Wire the circuit: physical pin 11 (GPIO 17) to a 330 Ω resistor, the resistor to the long leg of an LED, and the short leg to a GND pin such as pin 6. Point at a header pin to see its physical number and its GPIO number.
- Press Run. The LED blinks and the terminal panel shows what the program prints.
- Press Stop. It acts like Ctrl+C in a real terminal.
- Try the error for yourself: replace the program with one that uses
import RPi.GPIO as GPIOandGPIO.setup(). It stops with the same message as a real Pi 5. - Then open the guided project “Button and LED with gpiozero” below and press Check when your program works.
Worked example
Question. A red LED with a forward voltage of about 2.0 V is wired to GPIO 17 of a Raspberry Pi 5 through a 330 Ω resistor. How much current does the pin give, and is that safe? Which physical pin is it, and what is the gpiozero line?
- A GPIO pin that is HIGH gives 3.3 V.
- The LED takes about 2.0 V, so the resistor gets 3.3 V − 2.0 V = 1.3 V.
- Current = voltage ÷ resistance = 1.3 V ÷ 330 Ω = 0.0039 A, which is 3.9 mA.
- One pin can give about 16 mA. 3.9 mA is well below that, so it is safe.
- GPIO 17 is physical pin 11 on the header.
- gpiozero counts by GPIO number, so the line is
led = LED(17).
Answer. The pin gives about 3.9 mA, which is safe. The LED is on physical pin 11, written LED(17) in gpiozero. Twelve LEDs like this lit at once would take about 47 mA, close to the 50 mA limit for all the pins together.
Common mistakes
- Using RPi.GPIO on a Raspberry Pi 5.It stops at GPIO.setup() with “Cannot determine SOC peripheral base address”. Use gpiozero: from gpiozero import LED.
- Mixing up physical pin numbers and GPIO numbers.LED(11) is GPIO 11, which is physical pin 23, not pin 11. For physical pin 11 write LED(17) or LED("BOARD11").
- Connecting a 5 V signal to a GPIO pin.The pins are 3.3 V only. A 5 V output, such as the Echo pin of an HC-SR04, needs a voltage divider: 1 kΩ and 2 kΩ turn 5 V into about 3.3 V.
- Wiring an LED with no resistor.The pin would try to give far more than 16 mA. Always put a resistor of about 330 Ω in series.
- Adding your own pull-up to a gpiozero Button, or wiring the button to 3.3 V.Button(22) already switches on the pull-up inside the Pi. Wire the button between the pin and GND.
- Expecting an analog reading.The Raspberry Pi 5 has no analog input. Use a digital sensor, or add a converter chip such as the MCP3008.
- Pulling out the power to switch off.That can damage the files on the microSD card. Press the power button, or shut down from the menu, and wait for the light to turn red.
Key words
- Single-board computer
- A complete computer, with processor, memory and sockets, built on one circuit board.
- Operating system
- The main program of a computer, which starts other programs and shares the processor, memory and devices between them. Linux and Windows are examples.
- GPIO
- General-purpose input and output: a pin that a program can set HIGH or LOW, or read.
- Header (on a circuit board)
- A row of metal pins on a board for connecting wires or add-on boards.
- Physical pin number
- The position of a pin on the 40-pin header of a Raspberry Pi, counted from 1 to 40.
- GPIO number
- The number the Raspberry Pi gives to a GPIO pin, also called its BCM number. It is not the same as the position of the pin.
- RP1
- The chip on a Raspberry Pi 5 that runs the header pins, the USB ports and the Ethernet port.
- Library (in programming)
- Code written by someone else that a program can import and use, such as gpiozero.
- gpiozero
- A Python library for the pins of a Raspberry Pi, with ready-made objects such as LED and Button.
- Pull-up resistor
- A resistor that joins an input pin to the supply voltage, so the pin reads HIGH when nothing else drives it.
- Microcontroller
- A small, complete computer on one chip, with a processor, memory and input and output pins.
- Pin (of a microcontroller)
- A metal contact on a chip or board through which it reads an input or drives an output.
- LED
- A light-emitting diode: a component that gives out light when current flows through it in one direction.
- Resistor
- A component made to have a fixed resistance.
- Forward voltage
- The voltage across an LED or diode when it is conducting.
- Voltage divider
- Two resistors in series that share a voltage, with the output taken from where they join. Also called a potential divider.
- Ground
- The point in a circuit taken as zero volts, from which other voltages are measured.
See every key word in the glossary
What to learn first and next
- Ohm’s law calculator: Voltage, current and resistance, which the worked example uses.
- LED resistor calculator: Work out the resistor that an LED needs on a 3.3 V pin.
- LED: The first part to connect to a pin.
- Button and LED with gpiozero: The guided project for this board.
- Raspberry Pi 4 Model B: The same header, with the RPi.GPIO library.
- Raspberry Pi Pico: A microcontroller board from the same maker, programmed in MicroPython.
- Voltage divider calculator: Bring a 5 V signal down to 3.3 V.
- Raspberry Pi course: Every Raspberry Pi lesson in teaching order.
How it works
A four-core 2.4 GHz ARM processor (the BCM2712) runs an operating system from a microSD card, so a program starts from a terminal with python3 name.py. The 40-pin header has the same layout as on the Raspberry Pi 4: 26 GPIO pins (general-purpose input and output) at 3.3 V, two 5 V pins, two 3.3 V pins and eight GND pins. The big change is who runs those pins. On the Pi 4 the processor drives them itself. On the Pi 5 a second chip made by Raspberry Pi, the RP1, runs the header, the USB ports and the Ethernet port, and the processor talks to it over a fast link called PCI Express. The older RPi.GPIO library looks for the pins inside the processor, does not find them, and stops with "RuntimeError: Cannot determine SOC peripheral base address". The gpiozero library asks the operating system for the pins instead, so it works on every Raspberry Pi: LED(17) is GPIO 17, which is physical pin 11. There is no analog input. In this simulator the Pi 5 is programmed in Python with gpiozero, and RPi.GPIO fails with the same message as on a real board.
What it is made of
- Processor and memory: Silicon chips: the BCM2712 under a metal lid and a separate memory chip SiCuAl
- RP1 input and output chip: A silicon chip designed by Raspberry Pi that runs the header pins, USB and Ethernet SiCu
- Circuit board: Layers of glass-fibre and epoxy with copper tracks CuSiO
- Header and ports: Gold-plated brass pins, steel port shells CuZnAuFe
- Solder: Lead-free tin alloy SnAgCu
Where the materials come from: Silicon purified from quartz sand; copper from ores in Chile and Peru; tin from Indonesia and China; gold for the pin plating from many mining countries. The boards are assembled in Wales.
The chemistry
The RP1 chip is built with larger transistors than the main processor. Larger transistors are slower, but they can handle the 3.3 V that header pins and USB signals need, while the tiny transistors in the processor work at a much lower voltage. Splitting the work between two chips lets each one use the kind of silicon that suits its job.
Biology connection
The Pi 5 passes the work of its pins to a helper chip, the RP1, so the main processor can concentrate on running programs. Your body does something similar: a reflex is handled in the spinal cord, so the brain does not have to deal with every signal itself. Nerve impulses →
Safety and the environment
Never connect 5 V to a GPIO pin: the pins are 3.3 V only and a higher voltage damages the RP1 chip for good. A 5 V sensor output such as the HC-SR04 Echo pin needs a voltage divider. Use a 5 V 5 A USB-C power supply; with a smaller one the board limits the current to its USB ports. Press the power button to shut the Pi down before unplugging it, so the microSD card is not corrupted. The processor gets hot under load, so a fan or heat sink helps. Recycle as e-waste.
Did you know? The Raspberry Pi 5 went on sale in 2023. It is the first full-size Raspberry Pi computer that uses a chip designed by Raspberry Pi itself, the RP1, and it has a power button on the board, so you no longer pull the plug to switch it off.
Raspberry Pi 4 Model BRaspberry Pi Zero 2 WRaspberry Pi PicoRaspberry Pi Pico WMCP3008 analog-to-digital converterLEDPush buttonMicrocontroller simulatorVoltage divider calculatorOhm’s law calculator Elements inside: SiCuAlOZnAuFeSnAg
Try it in the simulator
Build and code a circuit with a Raspberry Pi 5 in these practice projects:
Questions students ask
What does a Raspberry Pi 5 do?
A fast small computer on one board. It runs Linux, and your Python programs switch and read its 40 header pins through the gpiozero library. Main functions: runs your Python program on a fast Linux computer; switches and reads 26 GPIO pins at 3.3 V through the gpiozero library; connects a project to screens, a network, cameras and USB devices; handles heavy jobs such as image recognition and web servers.
Why does RPi.GPIO not work on a Raspberry Pi 5?
RPi.GPIO does not work on a Raspberry Pi 5 because the header pins are no longer run by the main processor. A separate chip, the RP1, runs them, and RPi.GPIO cannot find it, so GPIO.setup() stops with "RuntimeError: Cannot determine SOC peripheral base address". Use the gpiozero library instead: from gpiozero import LED, then led = LED(17).
How does a Raspberry Pi 5 work?
A four-core 2.4 GHz ARM processor (the BCM2712) runs an operating system from a microSD card, so a program starts from a terminal with python3 name.py. The 40-pin header has the same layout as on the Raspberry Pi 4: 26 GPIO pins (general-purpose input and output) at 3.3 V, two 5 V pins, two 3.3 V pins and eight GND pins. The big change is who runs those pins. On the Pi 4 the processor drives them itself. On the Pi 5 a second chip made by Raspberry Pi, the RP1, runs the header, the USB ports and the Ethernet port, and the processor talks to it over a fast link called PCI Express. The older RPi.GPIO library looks for the pins inside the processor, does not find them, and stops with "RuntimeError: Cannot determine SOC peripheral base address". The gpiozero library asks the operating system for the pins instead, so it works on every Raspberry Pi: LED(17) is GPIO 17, which is physical pin 11. There is no analog input. In this simulator the Pi 5 is programmed in Python with gpiozero, and RPi.GPIO fails with the same message as on a real board.
What is a Raspberry Pi 5 made of?
Processor and memory: Silicon chips: the BCM2712 under a metal lid and a separate memory chip. RP1 input and output chip: A silicon chip designed by Raspberry Pi that runs the header pins, USB and Ethernet. Circuit board: Layers of glass-fibre and epoxy with copper tracks. Header and ports: Gold-plated brass pins, steel port shells. Solder: Lead-free tin alloy.
Is a Raspberry Pi 5 safe? How should it be recycled?
Never connect 5 V to a GPIO pin: the pins are 3.3 V only and a higher voltage damages the RP1 chip for good. A 5 V sensor output such as the HC-SR04 Echo pin needs a voltage divider. Use a 5 V 5 A USB-C power supply; with a smaller one the board limits the current to its USB ports. Press the power button to shut the Pi down before unplugging it, so the microSD card is not corrupted. The processor gets hot under load, so a fan or heat sink helps. Recycle as e-waste.
More boards and wiring
Connected tools
The same idea from another angle, across the site.