Post

Watercooling My Raspberry Pi 5

Watercooling My Raspberry Pi 5

Introduction

Running a Raspberry Pi 5 as the brain of a self‑hosted homelab is a common pattern for DevOps engineers who need a low‑cost, low‑power compute node for tasks such as DNS caching, CI runners, or edge monitoring. The Pi 5 brings a quad‑core Cortex‑A76 CPU, up to 8 GB of LPDDR4X RAM, and a 2 GHz boost clock that can sustain heavy workloads for extended periods.

In a typical rack‑mount or bookshelf setup, the Pi is often cooled with a passive heatsink and a small fan. That works for light loads, but when you push the device—running Docker containers, compiling code, or streaming video—the silicon can quickly approach its thermal throttling threshold (≈ 85 °C). Thermal throttling reduces clock speed, introduces latency, and can destabilize long‑running pipelines.

Enter water‑cooling. While it may sound like a novelty reserved for high‑end gaming rigs, a properly designed liquid‑cooling loop can keep the Pi 5 well below 50 °C even under sustained 100 % CPU load. For a DevOps professional, this translates into:

  • Predictable performance – no surprise throttling during CI builds.
  • Extended hardware lifespan – lower junction temperatures reduce electromigration.
  • Quiet operation – replace noisy fans with a pump that runs at a few hundred RPM.

This guide walks you through the entire process of water‑cooling a Raspberry Pi 5 for production‑grade homelab use. We’ll cover the theory behind liquid cooling, the hardware you need, step‑by‑step assembly, configuration of temperature monitoring, and best‑practice optimizations for a reliable, self‑hosted infrastructure. By the end, you’ll have a repeatable workflow that can be scripted and version‑controlled, fitting naturally into a DevOps automation pipeline.


Understanding the Topic

What Is Water‑Cooling?

Water‑cooling (or liquid cooling) is a heat‑transfer technique that moves thermal energy from a hot component to a cooler fluid—typically distilled water mixed with a corrosion inhibitor. The fluid circulates through a cold plate attached to the heat source, then through a radiator where a fan dissipates the heat to ambient air. A pump maintains flow, and optional reservoirs provide fluid volume and a place for air bubbles to escape.

In the context of a Raspberry Pi 5, the cold plate replaces the traditional metal heat sink. The Pi’s System‑on‑Chip (SoC) and voltage regulator die are directly coupled to the plate via a thin thermal interface material (TIM). Because water has a thermal conductivity (~0.6 W/m·K) far higher than air (~0.025 W/m·K), the temperature gradient across the plate is dramatically reduced.

History and Development

Liquid cooling has been used in mainframes and high‑performance computing since the 1960s, but the hobbyist market exploded with the advent of all‑in‑one CPU water blocks for desktop PCs in the early 2000s. The Raspberry Pi community adopted the technique later, initially with custom‑machined copper blocks for the Pi 3 and Pi 4. The Pi 5’s larger PCB and higher power envelope prompted manufacturers to release purpose‑built water‑cooling kits in 2023, featuring CNC‑machined copper cold plates and 3‑mm ID tubing that fits the board’s limited clearance.

Key Features and Capabilities

FeatureDescriptionImpact on Pi 5
Cold Plate MaterialCNC‑machined copper (≥ 99.9 % purity)Maximizes heat spread, low thermal resistance
Tubing Size3 mm ID / 6 mm OD PTFE or siliconeFits tight board spacing, low flow restriction
Pump TypeLow‑profile DC brushless (≈ 12 V, 120 mA)Quiet, sufficient for ~0.5 L/min flow
Radiator120 mm × 60 mm × 25 mm aluminum fin stackCompact, fits in a 1U rack or shelf
CoolantDistilled water + 10 % propylene glycolPrevents corrosion, safe for electronics
Temperature SensorsDS18B20 digital sensor (optional)Enables software throttling alerts

Pros and Cons

ProsCons
Superior thermal performance – ΔT ≈ 10 °C vs. air cooling ΔT ≈ 30 °CInitial cost – cold plate, pump, radiator, coolant
Reduced acoustic noise – pump < 20 dBComplexity – risk of leaks if not assembled correctly
Scalable – can add multiple Pi nodes to a single loopMaintenance – periodic coolant replacement, bleed air
Aesthetic – clean look for showcase homelabsSpace constraints – requires room for tubing and radiator

Use Cases and Scenarios

  • CI/CD runners – Docker‑in‑Docker builds that max out the CPU for minutes at a time.
  • Edge AI inference – Running TensorFlow Lite models on the Pi’s GPU while maintaining low latency.
  • Media transcoding – 4K video encoding with hardware acceleration, which generates sustained heat.
  • High‑availability clusters – Multiple Pi nodes in a Kubernetes “k3s” cluster where node stability is critical.

As of 2024, most water‑cooling kits for the Pi 5 are open‑source hardware designs shared on GitHub, allowing users to 3‑D print mounting brackets or CNC‑mill custom plates. The community is experimenting with micro‑loop designs that eliminate the reservoir, relying on a sealed loop with a high‑flow pump. Future trends include integrated temperature‑aware pump control (PWM‑driven pumps that speed up when the Pi exceeds a threshold) and IoT‑enabled coolant monitoring (pH, conductivity sensors) to pre‑empt corrosion.

Comparison to Alternatives

Cooling MethodTypical ΔT (°C)Noise (dB)Cost (USD)Maintenance
Passive heatsink30–35< 105–15None
Active fan + heatsink15–2020–3010–25Fan replacement
Peltier (TEC) + fan5–1030–4030–50Power consumption, condensation risk
Water‑cooling5–10< 2045–80Coolant change, leak checks

While a Peltier can achieve lower temperatures, its inefficiency and condensation risk make it unsuitable for unattended homelab nodes. Water‑cooling offers the best balance of performance, reliability, and noise for continuous operation.


Prerequisites

Hardware Requirements

ItemRecommended ModelReason
Raspberry Pi 58 GB modelMaximizes compute headroom
Water‑cooling kitCNC‑machined copper cold plate + 120 mm radiatorFits Pi 5 PCB layout
Pump12 V DC brushless (e.g., EK‑XC 400)Low power, quiet
Tubing3 mm ID PTFE, 6 mm ODFlexible, chemical‑resistant
Reservoir (optional)100 ml acrylicSimplifies bleed
CoolantDistilled water + 10 % propylene glycolPrevents corrosion
Temperature sensorDS18B20 waterproof probeSoftware monitoring
Power supply5 V 3 A USB‑C (Pi) + 12 V 1 A (pump)Stable rails

Software Requirements

SoftwareMinimum Version
Raspberry Pi OS (64‑bit)2023‑05‑03
vcgencmd (included)N/A
lm-sensors3.6.0
systemd247
docker (optional for monitoring)24.0.5
python33.11
pip23.2
psutil (Python library)5.9.5

Network & Security Considerations

  • Isolated management VLAN – Keep the Pi’s SSH and monitoring ports on a dedicated VLAN to reduce exposure.
  • SSH key authentication – Disable password login (PasswordAuthentication no).
  • Firewall – Use ufw to allow only required ports (e.g., 22, 2375 for Docker API if needed).
  • Rootless Docker – Run containers without root privileges to limit impact of a compromised container.

User Permissions

  • Add the pi user to the docker group (sudo usermod -aG docker pi).
  • Ensure the user running the pump control script has write access to /sys/class/gpio (or use sudo with a limited sudoers rule).

Pre‑Installation Checklist

  1. Verify Pi 5 firmware is up‑to‑date (sudo rpi-eeprom-update).
  2. Confirm the case can accommodate tubing and radiator.
  3. Inspect all tubing for cracks; replace if any.
  4. Prepare a clean, static‑free workspace.
  5. Gather tools: torque screwdriver, thermal paste, zip‑ties, leak‑test container.

Installation & Setup

1. Prepare the Raspberry Pi 5

1
2
3
4
# Update OS and firmware
sudo apt update && sudo apt full-upgrade -y
sudo rpi-eeprom-update -d -a
sudo reboot

After reboot, enable the I²C bus (required for DS18B20) and the vcgencmd temperature interface:

1
2
3
sudo raspi-config
# → Interface Options → I2C → Enable
# → Advanced Options → Enable VCGENCMD → Yes

2. Install Required Packages

1
2
sudo apt install -y lm-sensors python3-pip git
pip3 install psutil

3. Assemble the Water‑Cooling Loop

  1. Apply Thermal Interface Material (TIM) – Use a pea‑size amount of high‑performance thermal paste (e.g., Arctic MX‑4) on the SoC and VRM.
  2. Mount the Cold Plate – Align the plate’s mounting holes with the Pi’s standoff locations. Tighten screws to 0.5 Nm torque to avoid PCB warping.
  3. Connect Tubing – Cut two 10 cm lengths of 3 mm ID tubing. Push one end onto the cold plate inlet/outlet ports until a snug fit is achieved. Secure with zip‑ties.
  4. Install Pump & Reservoir – Place the pump in a 12 V powered enclosure. Connect the pump’s inlet to the radiator outlet and outlet to the cold plate inlet. If using a reservoir, insert it between the pump and radiator to aid bleed.
  5. Radiator Placement – Mount the 120 mm radiator on a vertical surface with a 12 V PWM fan (e.g., Noctua NF‑F12) blowing air through the fins.

4. Fill and Leak‑Test the Loop

  1. Fill the reservoir with the coolant mixture.
  2. Power the pump without connecting the Pi to verify flow (you should feel a slight vibration).
  3. Run the pump for 10 minutes while checking for leaks at every connection. Use a paper towel to detect moisture.

If any leak is found, shut down power, tighten the offending zip‑tie, and repeat the test.

5. Power Integration

Create a simple Power‑Distribution Board (PDB) using a 12 V‑to‑5 V buck converter (e.g., LM2596) to feed the Pi from the same 12 V source that powers the pump. This reduces cable clutter.

1
2
3
4
# Example wiring diagram (text description)
# 12V PSU --> Pump (direct)
# 12V PSU --> Buck Converter --> Pi 5 USB‑C Power Input
# Ground lines common across pump, Pi, and buck converter

6. Verify Temperature Reduction

After the system is fully assembled, boot the Pi and run a stress test:

1
2
3
4
5
# Install stress-ng
sudo apt install -y stress-ng

# Run a 5‑minute CPU stress on all cores
stress-ng --cpu 4 --timeout 300s

While the test runs, monitor temperature:

1
watch -n 1 vcgencmd measure_temp

You should see a stable temperature below 55 °C after the first minute, compared to > 80 °C with a stock fan.

7. Optional: Docker‑Based Monitoring Service

Deploy a lightweight container that publishes the Pi’s temperature via a Prometheus endpoint.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# docker-compose.yml
version: "3.8"
services:
  pi-temp-exporter:
    image: ghcr.io/prometheus/node-exporter:latest
    container_name: pi-temp-exporter
    restart: unless-stopped
    privileged: true
    command:
      - --collector.textfile.directory=/run/prometheus
    volumes:
      - /run/prometheus:/run/prometheus
    networks:
      - monitoring
networks:
  monitoring:
    driver: bridge

Create a script that writes the temperature to a textfile collector:

1
2
3
4
#!/usr/bin/env bash
# /usr/local/bin/pi_temp_collect.sh
TEMP=$(vcgencmd measure_temp | cut -d= -f2)
echo "pi_temperature_celsius $TEMP" > /run/prometheus/pi_temp.prom

Add a systemd timer to run the script every 15 seconds:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# /etc/systemd/system/pi-temp-collector.service
[Unit]
Description=Collect Raspberry Pi temperature for Prometheus

[Service]
Type=oneshot
ExecStart=/usr/local/bin/pi_temp_collect.sh

# /etc/systemd/system/pi-temp-collector.timer
[Unit]
Description=Run Pi temperature collector every 15 seconds

[Timer]
OnBootSec=10sec
OnUnitActiveSec=15sec
Unit=pi-temp-collector.service

[Install]
WantedBy=timers.target

Enable the timer:

1
2
sudo systemctl daemon-reload
sudo systemctl enable --now pi-temp-collector.timer

Now the node-exporter container will expose pi_temperature_celsius for Grafana dashboards or alerting rules.


Configuration & Optimization

1. Fine‑Tuning the Pump Speed

Most low‑profile pumps support PWM control on the power line. Connect the pump’s PWM pin to a Raspberry Pi GPIO (e.g., GPIO 18) and use pigpio to adjust speed based on temperature.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# pump_control.py
import pigpio
import subprocess
import time

PWM_PIN = 18
MIN_DUTY = 30   # 30 % duty cycle
MAX_DUTY = 100  # 100 % duty cycle
TARGET_TEMP = 45.0  # °C

pi = pigpio.pi()
pi.set_mode(PWM_PIN, pigpio.OUTPUT)

def get_temp():
    out = subprocess.check_output(['vcgencmd', 'measure_temp']).decode()
    return float(out.split('=')[1].replace("'C", ""))

while True:
    temp = get_temp()
    duty = MIN_DUTY + (temp - 30) * (MAX_DUTY - MIN_DUTY) / (TARGET_TEMP - 30)
    duty = max(MIN_DUTY, min(MAX_DUTY, duty))
    pi.set_PWM_dutycycle(PWM_PIN, int(duty))
    time.sleep(5)

Run the script as a systemd service to ensure it starts on boot.

1
2
3
4
5
6
7
8
9
10
11
12
# /etc/systemd/system/pump-control.service
[Unit]
Description=Dynamic pump speed controller for Pi water‑cooling
After=network.target

[Service]
ExecStart=/usr/bin/python3 /opt/pump_control.py
Restart=on-failure
User=pi

[Install]
WantedBy=multi-user.target
1
sudo systemctl enable --now pump-control.service

2. Security Hardening

  • Limit GPIO access – Add the `
This post is licensed under CC BY 4.0 by the author.