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
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
| Feature | Raspberry Pi 4 Model B | Raspberry Pi 400 | Raspberry Pi 5 |
|---|---|---|---|
| Form | Bare board | Board built into a keyboard | Bare board |
| SoC · CPU | BCM2711 · 4 × Cortex-A72, 1.5–1.8 GHz | BCM2711 · 4 × Cortex-A72, 1.8 GHz | BCM2712 · 4 × Cortex-A76, 2.4 GHz |
| RAM | 1, 2, 4 or 8 GB | 4 GB | 2, 4, 8 or 16 GB |
| USB | 2 × USB 3 (blue), 2 × USB 2 (black) | 2 × USB 3 (blue), 1 × USB 2 (black) | 2 × USB 3 (blue), 2 × USB 2 (black) |
| Video | 2 × micro-HDMI | 2 × micro-HDMI | 2 × micro-HDMI |
| Network | Gigabit Ethernet, Wi-Fi, Bluetooth | Gigabit Ethernet, Wi-Fi, Bluetooth | Gigabit Ethernet, Wi-Fi, Bluetooth |
| GPIO | Vertical 40-pin header | Horizontal 40-pin header on the back edge | Vertical 40-pin header |
| Extras | 3.5 mm audio/video jack, camera and display connectors | Keyboard built in, no audio jack | Power button, PCIe connector, real-time clock, fan header, no audio jack |
| Power supply | 5 V / 3 A (15 W), USB-C | 5 V / 3 A (15 W), USB-C | 5 V / 5 A (27 W), USB-C |
| Cooling | Heatsink helps under load | Built-in metal heat spreader | Active cooler or fan case recommended |
| Separate keyboard | Required | Not required | Required |
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
| Connector | How to recognise it | What goes in it today |
|---|---|---|
| USB-C power | Small oval socket, on the same edge as the HDMI sockets | The official-style supply for the model. Plug it in last. |
| Micro-HDMI × 2 | Two 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 socket | The 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 socket | Keyboard and mouse. They need almost no bandwidth. |
| Ethernet (RJ45) | The wide socket with a clip | A network cable if the class network is wired. Otherwise nothing. |
| MicroSD slot | Spring 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 header | Two rows of 20 pins along one long edge | Nothing today. Week 4 and onward. |
| Camera / display ribbons, PCIe (Pi 5) | Flat, thin ribbon connectors with a lifting latch | Nothing 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:
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).
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 andconfig.txt.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
/.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
gpiozerouse BCM numbers. Example: physical pin 11 is BCM GPIO17.
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.
| Raspberry Pi 4 / 400 / 5 | ESP32 board | |
|---|---|---|
| Kind of device | Single-board Linux computer | Microcontroller development board |
| Software | Full operating system, many programs at once | One firmware program, uploaded from the Arduino IDE |
| Strengths | Web server, database, Python, MQTT broker, user interface | Reading sensors, driving outputs precisely, tiny power budget |
| Analog input | None on the header | 12-bit ADC on several pins (use ADC1 pins, GPIO32–39, when Wi-Fi is on) |
| Logic level | 3.3 V | 3.3 V |
| Talks to the other over | Wi-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?
Where does Raspberry Pi OS live while the Pi is switched off?
Why can the ESP32 read the photocell but the Raspberry Pi cannot?
A Pi 5 keeps rebooting a few seconds after the desktop appears. Cheapest hypothesis?
vcgencmd get_throttled.