Raspberry Pi: bare board to booted Linux
420-302-VA · WEEK 2 · FALL 2026

Stage 2 of 6 · Theory hour

Know the board

Before you write a single byte to your boot drive, you should be able to point at every connector on your Raspberry Pi and say what it is for. This page gives you the vocabulary, the three models used in D-221, and the two electrical facts that will keep your board alive.

A computer on one board

A Raspberry Pi is a single-board computer (SBC): a processor, memory, storage interface, video output, USB, networking and a row of input/output pins, all on one printed circuit board. It runs a complete Linux operating system with a desktop, a terminal, Python, a web server and everything else a computer can run.

That is what separates it from the Arduino boards you programmed in Robotics I and II. An Arduino or ESP32 is a microcontroller board: it runs one program that you compile and upload, with no operating system underneath. Both are useful. In this course they work as a team, and the division of labour is explained below.

Desktop PC

Separate motherboard, CPU, RAM sticks, graphics card, disks. Hundreds of watts. You rarely touch its pins.

Raspberry Pi (SBC)

Everything soldered on one board. 5 to 27 W. Runs Linux. Exposes 40 pins you can wire to.

ESP32 (microcontroller)

One chip with flash and RAM inside. Under 1 W. Runs one firmware program. Has analog inputs and Wi-Fi.

Six blocks that explain the whole board

Functional anatomy of a Raspberry Pi: SoC and RAM in the centre, boot storage, power, display, USB, network and GPIO around it SoC CPU cores · GPU · controllers RAM (working memory) Boot firmware EEPROM: finds the OS Power in USB-C · 5 V Storage microSD · USB SSD GPIO header 40 pins · 3.3 V logic Display 2 × micro-HDMI USB · network USB 2/3 · Ethernet · Wi-Fi
Every Raspberry Pi model in this course has these six blocks. Only their position, speed and connector shape change from model to model.
  1. SoC. The processor chip: several 64-bit ARM CPU cores, a GPU for the desktop and video, and the controllers for USB, HDMI and the GPIO. Pi 4 and Pi 400 use the BCM2711; Pi 5 uses the faster BCM2712.
  2. RAM. Working memory for running programs: 1 to 8 GB on Pi 4, 4 GB on Pi 400, 2 to 16 GB on Pi 5. Emptied when power goes away.
  3. Boot firmware. A small program in an EEPROM chip. At power-on it looks for a bootable device in a set order (microSD, then USB by default on recent firmware) and loads the operating system from it.
  4. Storage. Where the OS and your files live: a microSD card in the dedicated slot, or a USB SSD in a blue port. Both work; the SSD is faster, the card is smaller. If you boot from an SSD, leave the card slot empty, because the card is tried first.
  5. Interfaces. USB for keyboard, mouse and an SSD if you use one; micro-HDMI for the screen; Ethernet and Wi-Fi for the network; Bluetooth; a USB-C socket for power.
  6. GPIO header. Forty pins that let Python programs switch LEDs, read buttons and talk to chips over I²C, SPI and UART. Digital only, 3.3 V only.

The three models used in D-221

Learn to tell them apart at a glance. Power supplies and port positions differ; the software you install is the same.

FeatureRaspberry Pi 4 Model BRaspberry Pi 400Raspberry Pi 5
FormBare boardBoard built into a keyboardBare board
SoC · CPUBCM2711 · 4 × Cortex-A72, 1.5–1.8 GHzBCM2711 · 4 × Cortex-A72, 1.8 GHzBCM2712 · 4 × Cortex-A76, 2.4 GHz
RAM1, 2, 4 or 8 GB4 GB2, 4, 8 or 16 GB
USB2 × USB 3 (blue), 2 × USB 2 (black)2 × USB 3 (blue), 1 × USB 2 (black)2 × USB 3 (blue), 2 × USB 2 (black)
Video2 × micro-HDMI2 × micro-HDMI2 × micro-HDMI
NetworkGigabit Ethernet, Wi-Fi, BluetoothGigabit Ethernet, Wi-Fi, BluetoothGigabit Ethernet, Wi-Fi, Bluetooth
GPIOVertical 40-pin headerHorizontal 40-pin header on the back edgeVertical 40-pin header
Extras3.5 mm audio/video jack, camera and display connectorsKeyboard built in, no audio jackPower button, PCIe connector, real-time clock, fan header, no audio jack
Power supply5 V / 3 A (15 W), USB-C5 V / 3 A (15 W), USB-C5 V / 5 A (27 W), USB-C
CoolingHeatsink helps under loadBuilt-in metal heat spreaderActive cooler or fan case recommended
Separate keyboardRequiredNot requiredRequired
Schematic top view of a Raspberry Pi 4 Model B with the main connectors labelled 40-pin GPIO header (pin 1 at the left end) SoC RAM Ethernet 2 × USB 3 (blue) 2 × USB 2 (black): keyboard, mouse USB-Cpower HDMI0 HDMI1 AV jack microSD slot(underside)
Raspberry Pi 4 Model B, schematic. Not to scale. The blue pair is USB 3: an SSD boot drive uses one of them. Keyboard and mouse go in the black USB 2 pair. HDMI0 is the micro-HDMI socket nearest the power socket. The round AV jack is the quickest way to tell a Pi 4 from a Pi 5.
Raspberry Pi 4 Model B photograph with labels: processor, choice of RAM, USB-C power supply, two micro-HDMI ports, USB 3 and USB 2 ports, Gigabit Ethernet
Raspberry Pi 4 Model B, photograph. Compare with the schematic above: USB-C power and the two micro-HDMI sockets on the near edge, the black USB 2 pair at the front of the right edge, the blue USB 3 pair behind it, Ethernet at the back. Image: Raspberry Pi Ltd.
Rear panel of a Raspberry Pi 400 showing GPIO, microSD, USB-C, two micro-HDMI, two USB 3, one USB 2 and Ethernet Raspberry Pi 400, seen from the back 40-pin GPIO microSD USB-C power 2 × micro-HDMI 2 × USB 3 USB 2 Ethernet lock
Raspberry Pi 400. Same chip family as the Pi 4, packaged in a keyboard. Every port faces backwards, including the horizontal GPIO header on the left. You still need a mouse and a micro-HDMI cable; the microSD slot is on the back edge, and an SSD boot drive would use a blue USB 3 port.
Schematic top view of a Raspberry Pi 5 with the main connectors labelled: power button, USB 2 nearest the header, USB 3, Ethernet at the corner near the HDMI edge, PCIe and fan connectors 40-pin GPIO header (pin 1 at the left end) SoC RAM fan 2 × USB 2 (black): keyboard, mouse 2 × USB 3 (blue) Ethernet powerbutton USB-Cpower HDMI0 UART HDMI1 camera / display ribbons PCIeribbon microSD
Raspberry Pi 5, schematic. Not to scale. Same size as a Pi 4, but the Ethernet and USB stacks trade places, the USB 2 pair sits nearest the header (with the fan connector beside it), and the round audio jack is gone. New on this model: a power button, a PCIe ribbon connector, a debug UART socket between the HDMI sockets, and a battery connector for the real-time clock.

Tell them apart in two seconds

  • Keyboard? Pi 400.
  • Power button and no round audio jack? Pi 5.
  • Round 3.5 mm jack next to the HDMI sockets? Pi 4 Model B.

Connectors you must be able to identify

ConnectorHow to recognise itWhat goes in it today
USB-C powerSmall oval socket, on the same edge as the HDMI socketsThe official-style supply for the model. Plug it in last.
Micro-HDMI × 2Two very small trapezoid sockets. Not the size of a TV HDMI plug.Micro-HDMI to HDMI cable to the Pi screen, in the socket nearest the power socket (HDMI0).
USB 3 × 2 (blue)Blue plastic inside the socketThe SSD, if that is your boot drive. USB 3 moves data at 5 Gbit/s; USB 2 at 480 Mbit/s.
USB 2 (black)Black plastic inside the socketKeyboard and mouse. They need almost no bandwidth.
Ethernet (RJ45)The wide socket with a clipA network cable if the class network is wired. Otherwise nothing.
MicroSD slotSpring slot on the underside (Pi 4, Pi 5) or the back edge (Pi 400)Your microSD card, if that is your boot drive. Otherwise empty: a card here boots before a USB SSD.
40-pin GPIO headerTwo rows of 20 pins along one long edgeNothing today. Week 4 and onward.
Camera / display ribbons, PCIe (Pi 5)Flat, thin ribbon connectors with a lifting latchNothing in this course. Do not force the latches.

Where the operating system lives

Students often confuse RAM with storage because both are "memory". Keep the two apart:

RAM

Volatile. Holds the running kernel, your desktop and your Python program while power is on. Nothing survives a power cut. Size: gigabytes. Speed: nanoseconds.

Boot drive (microSD or SSD)

Persistent. Holds the boot partition, Linux, installed packages, your home folder and your project files. Everything survives a power cut if it was written before the cut. Size: tens to hundreds of gigabytes. Speed: microseconds.

When you press power, this chain runs in about ten seconds:

  1. EEPROM bootloader

    Firmware on the board wakes up, checks the boot order, and looks for a device with a boot partition: the microSD slot first, then USB. On the Pi 4, Pi 400 and Pi 5 it can boot from USB. Some early Pi 4 boards need a bootloader update first (see Troubleshoot).

  2. Boot partition

    The first, small partition on the boot drive (FAT format, mounted later as /boot/firmware). It holds the GPU firmware, the Linux kernel and config.txt.

  3. Linux kernel

    The kernel is copied from the drive into RAM and started. It detects the hardware and mounts the second, large partition as the root file system /.

  4. Raspberry Pi OS

    Services start, the network comes up, the login screen or desktop appears. From now on every file you save is written back to the drive.

This is why the last rule matters: shut down before removing power. A clean shutdown tells the kernel to finish writing and unmount the drive. Pulling the plug while a write is in progress leaves half-written files behind.

Power and cooling

Pi 4 and Pi 400

5 V / 3 A (15 W) through USB-C. A phone charger that cannot deliver 3 A produces random reboots, a lightning-bolt icon on screen and USB devices that disappear.

Pi 5 with a USB SSD

Use the 5 V / 5 A (27 W) supply. If the Pi 5 detects only a 15 W supply it limits USB peripherals to a total of 600 mA, and a USB SSD may not spin up or may drop out mid-boot.

The Pi 5 runs hot under sustained load and throttles its clock when it reaches 80 °C; a fan case or the active cooler keeps it at full speed. The Pi 4 benefits from a heatsink. The Pi 400 uses its keyboard's metal plate as a heat spreader and needs nothing. You can check both at any time:

$ vcgencmd measure_temp
$ vcgencmd get_throttled   # 0x0 means no power or heat problem since boot

The 40-pin header

The header is where the Raspberry Pi meets electronics. You will not wire anything today, but you should understand the map before Week 4. Two numbering schemes exist and every diagram or program must say which one it uses:

  • Physical (BOARD) numbering counts header positions 1 to 40. Pin 1 is the corner pin nearest the microSD slot; it is usually marked with a square pad.
  • BCM numbering uses the SoC signal names, GPIO2 to GPIO27. Python libraries such as gpiozero use BCM numbers. Example: physical pin 11 is BCM GPIO17.
3.3 V power5 V powerGround GPIO (digital, some PWM)I²CSPIUARTHAT ID EEPROM (reserved)

Odd pins are the row nearest the board edge on a Pi 4 and Pi 5 when the header is at the top; on the Pi 400 the header is mirrored on the back edge, so confirm pin 1 on the physical board before trusting any diagram. Pins 27 and 28 are reserved for HAT identification and should not be used as ordinary GPIO.

Rules of the header

Electrical facts, not suggestions

  • 3.3 V logic. A GPIO output gives 0 V or 3.3 V. A GPIO input must never see more than 3.3 V. The 5 V pins are for powering things, not for signalling into the Pi. (The Pi 5's RP1 I/O chip tolerates 5 V on its pins only while the board is powered; in this course, treat every model as strictly 3.3 V.)
  • Milliamps, not amps. A GPIO pin sources around 16 mA; use a series resistor with every LED and never drive a motor or relay coil directly.
  • Digital only. A GPIO input answers "high or low". It cannot measure 1.7 V. There is no analog-to-digital converter on the header.
  • Power off to rewire. Shorting 5 V to a GPIO pin, or 3.3 V to ground, while the board is on can kill the SoC.

Raspberry Pi and ESP32: complementary, not interchangeable

The term project needs a light measurement. A photocell (light-dependent resistor) in a voltage divider produces an analog voltage that changes smoothly with light. The Raspberry Pi header cannot read that. The ESP32 can: it has a 12-bit analog-to-digital converter. So in this course the sensor node is the ESP32 and the Raspberry Pi is the brain and the face of the system.

System diagram: photocell and LED on an ESP32, which sends measurements over Wi-Fi to a Raspberry Pi running the broker, the control program, storage and the web dashboard Physical world light LED ESP32 node Arduino C++ firmware ADC reads photocell PWM drives LED Wi-Fi + MQTT client analog Wi-Fi · MQTT digital values Raspberry Pi Linux · Python 3 Mosquitto MQTT broker Control program (PID / on-off) Data log (SQLite) Flask web dashboard · setpoint
The course architecture, from Week 8 onward. Analog stays on the ESP32. Everything that needs an operating system, a network service or a screen runs on the Raspberry Pi. The Pi you configure today is the right-hand box.
Raspberry Pi 4 / 400 / 5ESP32 board
Kind of deviceSingle-board Linux computerMicrocontroller development board
SoftwareFull operating system, many programs at onceOne firmware program, uploaded from the Arduino IDE
StrengthsWeb server, database, Python, MQTT broker, user interfaceReading sensors, driving outputs precisely, tiny power budget
Analog inputNone on the header12-bit ADC on several pins (use ADC1 pins, GPIO32–39, when Wi-Fi is on)
Logic level3.3 V3.3 V
Talks to the other overWi-Fi (MQTT), or USB serial as a fallback. If you ever wire signal lines directly between them, they must share a ground.

Handling the board

  • Hold the board by its edges. Avoid touching the pins of the header and the small components.
  • Set it on a non-conductive surface, never on a metal desk or on top of a bag of resistors.
  • Connect screen, keyboard, mouse and the boot drive first; power last. Disconnect power first when you take the station apart, but only after a clean shutdown.
  • The Pi 5 power button: one short press starts it; a short press while running opens the shutdown dialog; holding it forces power off (only when the OS is frozen).

Check yourself

Your boot drive is a USB SSD. Which port should it use, and why?
A blue USB 3 port. USB 3 carries about ten times the data rate of USB 2, and the OS reads from the drive constantly. Keyboard and mouse go in the black USB 2 ports. A microSD card has its own slot, so the question never arises.
Where does Raspberry Pi OS live while the Pi is switched off?
On the boot drive, the microSD card or SSD (persistent storage). RAM is empty when power is off; the OS is copied from the drive into RAM at boot.
Why can the ESP32 read the photocell but the Raspberry Pi cannot?
The photocell divider gives an analog voltage. The ESP32 has an analog-to-digital converter; the Raspberry Pi header has digital inputs only, so it can only answer "high or low".
A Pi 5 keeps rebooting a few seconds after the desktop appears. Cheapest hypothesis?
Power. On a 15 W supply the Pi 5 limits USB to 600 mA, and a USB SSD can push it over. Switch to the 27 W supply, then check vcgencmd get_throttled.
Which pin is physical 11, and what is it in BCM numbering?
Physical pin 11 is BCM GPIO17. Physical numbers count positions on the header; BCM numbers are the SoC signal names used by Python libraries.