1. Overview

What makes Raspberry Pi 5 special?

Key specifications

Processor Broadcom BCM2712 – 64-bit quad-core Arm Cortex-A76 @ 2.4 GHz CPU (8 MB L2)
GPU VideoCore VII (@800 MHz) with OpenGL ES 3.1 & Vulkan 1.2 support
Memory LPDDR4X-4267 variants 2 GB / 4 GB / 8 GB / 16 GB
Display Dual micro-HDMI 2.0 (up to 4 K p60 HDR)
Camera / Display FPC Two 4-lane MIPI CSI/DSI (22-pin) connectors
PCIe One PCIe 2.0 ×1 (FPC) via RP1 south-bridge (supports M.2 HAT+)
USB 2 × USB 3.0 (5 Gb/s), 2 × USB 2.0
Networking Gigabit Ethernet (+PoE+ HAT), dual-band 802.11ac Wi-Fi & Bluetooth 5.0
Power / Management USB-C PD (5 V @ 5 A), on-board power-button, integrated RTC with rechargeable Li-Mn coin-cell connector

Note: Active cooling is strongly recommended; use the clip-on Active Cooler or the official fan-equipped case.

2. Preparing Your Pi

From parts to first boot

2.1 Required Hardware

  1. Raspberry Pi 5 board + official 5 V / 5 A USB-C PSU
  2. micro-SD card (A1/U1 class, ≥16 GB) or NVMe drive via M.2 HAT+
  3. Micro-HDMI cable or headless network access
  4. Cooling: Active Cooler or case fan
  5. Optional: RTC battery, cameras, HATs, GPIO accessories

2.2 Flashing an OS

Use Raspberry Pi Imager (macOS/Windows/Linux) → pick Raspberry Pi OS (64-bit, Bookworm), click the cog ⚙️ to preset locale, Wi-Fi, SSH, and username, then write to the chosen storage.

2.3 Headless Setup (SSH + Wi-Fi)

# ① Enable SSH by creating an empty file
touch /Volumes/boot/ssh     # macOS
# ② Add Wi-Fi credentials
cat >> /Volumes/boot/wpa_supplicant.conf <<EOF
country=ZA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="MyNetwork"
    psk="SuperSecret"
}
EOF

Insert media → power-up → find its IP via router and run ssh pi@<IP>.

3. First-Boot Configuration

Secure and update your installation

3.1 raspi-config basics

sudo raspi-config
  1. 1 System Options ➜ Change password, Hostname
  2. 3 Interface Options ➜ Enable SSH, I2C, SPI, Camera
  3. 4 Performance ➜ Fan profile / overclock limits
  4. 6 Advanced ➜ Exp. filesystem, RTC charging

3.2 System updates

sudo apt update && sudo apt full-upgrade -y
# Update Pi firmware & EEPROM
sudo rpi-eeprom-update -a

4. Storage Options

micro-SD vs NVMe SSD (PCIe)

4.1 Using the M.2 HAT+

  1. Attach the HAT+, flat-flex cable to PCIe FPC, mount NVMe M-key drive.
  2. Boot from SD → imager → choose NVMe target, flash OS.
  3. Reboot, clone bootloader to NVMe, change BOOT_ORDER=0x14 if desired.

The PCIe link runs at Gen 2 ×1 (≈ 5 Gb/s), ideal for storage or accelerators.

5. GPIO & Electronics

Physical computing with 40-pin header

5.1 Pinout

The 40-pin HAT header follows the classic layout (Broadcom BCM numbering). Voltage is 3 V3 tolerant; avoid 5 V signals without level-shifting.

5.2 Python Blink Example


import RPi.GPIO as GPIO
from time import sleep

pin_led = 18
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin_led, GPIO.OUT)

try:
    while True:
        GPIO.output(pin_led, True)   # .on()
        sleep(0.5)
        GPIO.output(pin_led, False)  # .off()
        sleep(0.5)
except KeyboardInterrupt:
    GPIO.cleanup()

Hint: Use pigpio for precise PWM, or libgpiod from C for low-latency I/O.

6. Media & Peripherals

Cameras, displays, audio & USB

6.1 Dual Cameras

Both CSI connectors now expose four data lanes: run two × 13-MP HQ modules simultaneously or drive high-bandwidth sensors. Record 4 K streaming via libcamera or GStreamer.

6.2 Displays

  1. Micro-HDMI ➜ monitors/TVs (HDCP off, 4 K p60).
  2. DSI ➜ touch panels (e.g., 7″ official display) or custom e-paper/OLED via 4-lane DSI.

6.3 Audio

HDMI audio by default. Analogue 3.5 mm jack removed; use a USB DAC or I²S codec HAT for low-latency audio projects.

7. Project Ideas

Put your Pi to work

  1. NVMe-based Home-Assistant server (Docker).
  2. Real-time audio FX pedal (USB audio + GPIO foot-switch).
  3. Edge-AI inference hub (PCIe Coral TPU).
  4. High-speed NAS (USB3 to SATA RAID).
  5. Robotics brain with synchronized dual cameras & ROS 2.

8. Thermal Management

Stay cool under load

The clip-on Active Cooler plus PWM fan header keeps CPU < 70 °C at full load and remains <34 dB(A).

# Adjust fan curve (Bookworm)
sudo raspi-config nonint do_fan 65 75 100

9. Troubleshooting Quick-Wins

Common issues & fixes

  1. Won’t boot ➜ Check PSU ≥ 5 V @ 5 A, verify green ACT LED blink pattern.
  2. Thermal throttle ➜ Install fan, apply heatsink, ensure airflow.
  3. No PCIe device ➜ Insure cable seated, add dtparam=pciex1 to /boot/config.txt.
  4. RTC not ticking ➜ Enable charger:
    sudo dtoverlay=rpi5-rtc,power-domain=0
    
Training session Junior match Goal celebration Team huddle Dribbling drill

11.2 Optical & Illumination Setup

  1. Pair camera with 850 nm (standard) or 940 nm (invisible) IR‑LED ring positioned co‑axially around lens to highlight pupil reflex while minimizing ambient light artifacts.
  2. Mount sensor 30–50 cm from eyes; pick 75° FoV for single‑eye, 120° FoV for binocular tracking.
  3. Use matt black surrounds to cut reflections; add short‑pass filter (850 nm) atop lens if daytime sun causes bloom.

Note: Autofocus motors (CM3) are disabled in total darkness—flash a brief visible LED during start‑up to lock focus, then switch to IR‑only capture.

11.3 Capturing High‑FPS Grayscale Streams

libcamera-vid -t 0 -n \
          --width 640 --height 480 \
          --framerate 120 \
          --codec yuv420 \
          -o - | ffplay -f rawvideo -pix_fmt yuv420p -video_size 640x480 -

This shell one‑liner delivers low‑latency preview at 120 fps; pipe to gstreamer or OpenCV for processing.

11.4 Minimal Pupil‑Detection Loop (C++ / OpenCV)

#include <opencv2/opencv.hpp> 
        using namespace cv;

int main(){
VideoCapture cap(0, CAP_V4L2);       // /dev/video0
cap.set(CAP_PROP_FPS, 120);
cap.set(CAP_PROP_FRAME_WIDTH, 640);
cap.set(CAP_PROP_FRAME_HEIGHT,480);
Mat frame, gray, thresh;
while(cap.read(frame)){
    cvtColor(frame, gray, COLOR_YUV2GRAY_I420);  // camera stream is YUV420
    medianBlur(gray, gray, 5);
    threshold(gray, thresh, 40, 255, THRESH_BINARY_INV);
    std::vector> ctrs;
    findContours(thresh, ctrs, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
    if(!ctrs.empty()){
        auto c = *std::max_element(ctrs.begin(), ctrs.end(),
            [](auto &a, auto &b){ return contourArea(a) < contourArea(b);} );
        RotatedRect box = fitEllipse(c);
        circle(frame, box.center, box.size.width/2, Scalar(0,255,0), 2);
        printf("Pupil @ %.1f,%.1f\n", box.center.x, box.center.y);
    }
    imshow("eye", frame);
    if(waitKey(1)==27) break;  // Esc to quit
}

}
Tips: calibrate pupil threshold per user; integrate KalmanFilter for smooth gaze estimation; log box.center to CSV for later ML regression.

11.5 Synchronizing Dual NoIR Cameras

  1. Attach both CSI cables (CAM0 & CAM1) ➜ enable dtoverlay=imx708_dual in /boot/config.txt.
  2. Use libcamera-still --list-cameras to verify dual streams.
  3. Launch separate libcamera-vid instances or aggregate in v4l2loopback for stereo fusion.

11.6 Latency & Power Budget

  1. CM3 @ 120 fps ≈ 450 mW sensor + 140 mW AF coil (only during focus)([adafruit.com](https://www.adafruit.com/product/5659?utm_source=chatgpt.com))
  2. 850 nm LED ring (8 × 5 mm) ≈ 120 mA @ 3.3 V; power via 5 V rail & FET driver.
  3. GPIO‑fan curve: keep SoC < 65 °C to avoid dropped frames.

11.7 Calibration Workflow

  1. Present nine‑point grid; record pupil center & map to screen coords with leastSquares.
  2. Store coefficients (A,B,C,D) in ~/.config/eyetracker.cfg.
  3. Re‑run quick 3‑point validation routine every session; apply drift‑correction with exponentialMovingAverage.

10. Further Reading & Sources

Official documents & community threads

  1. Raspberry Pi 5 Product Brief (PDF).
  2. “Introducing: Raspberry Pi 5!” blog.
  3. M.2 HAT+ documentation.
  4. Active Cooler product brief.
  5. Headless setup forum guide.
  6. Wi-Fi specification discussion.