Skip to main content

The Raspberry Pi, the microSD card and the lab

The Raspberry Pi 5 is a small but complete Linux computer: CPU, memory, USB, network, HDMI and a row of GPIO pins for electronics. In this class it is the server of the IoT system:

sensors ──> Arduino Uno ──USB serial──> Raspberry Pi 5 ──> MariaDB database ──> web page (Flask or PHP)

The Arduino is good at reading sensors in real time. The Pi is good at storing data, running a web server and talking to the network. Each does the part it is good at.

The card is the computer​

The Pi has no hard disk. It boots from the microSD card, and everything lives on that card: Raspberry Pi OS, Apache, MariaDB, your databases, your Python files. So:

  • Your card is your work. Any Pi 5 in the lab becomes "your" Pi when your card is in it.
  • What you install stays installed from lab to lab: you only install LAMP and phpMyAdmin once.
  • The clock does not stay right. Set it every lab. See why the clock resets.
  • Cutting the power can damage the card. Always shut down first. See repairing corruption.

What runs on it​

SoftwareVersion on Raspberry Pi OS 12 (Bookworm)Job
Linux kernel + Debian 12 "Bookworm"uname -r, cat /etc/os-releaseThe operating system
Apache2.4Web server on port 80
MariaDB10.11Database on port 3306
PHP8.2Runs .php pages and phpMyAdmin
Python3.11Your scripts, pyserial, pymysql, Flask

Check any version yourself: apache2 -v, mariadb --version, php -v, python3 --version.

Pi 5 things that are different from older Pis​

Most guides online are for the Pi 3 or 4. On the Pi 5:

TopicPi 5What it means for you
Power5 V 5 A USB-C (27 W official supply)A phone charger causes undervoltage, crashes and card corruption.
Videomicro-HDMINormal HDMI cables need an adapter.
GPIO chipNew RP1 chipRPi.GPIO does not work. Use gpiozero (see Python and GPIO).
Boot files/boot/firmware/Old guides say /boot/config.txt; on Bookworm it is /boot/firmware/config.txt.
Power buttonBuilt in (next to the USB-C port)One press: shutdown menu on the desktop. Hold: hard power off (avoid).
ClockHas a clock chip, but no battery in the labTime is still lost when unplugged.

Where to go next​