Projects / PoE HAT fan and temperature

PoE HAT fan and temperature

Beginner45 minGuided buildReviewed

Build it step by step

0 of 7 done
  1. Pi 4RASPBERR

    Fit the HAT

    On standoffs, with the Pi off.

  2. Pi 4RASPBERR

    Connect the PoE+ switch

    Boot the Pi.

  3. Pi 4

    Read the temperature

    At idle.

  4. Pi 4

    Edit config.txt

    Add the trip points.

  5. Pi 4

    Reboot and run the log

    Watch the fan state.

  6. Pi 4

    Run the load test

    Five minutes.

  7. Pi 4

    Adjust the points

    Find a quiet setting.

In short

How do you build a poE HAT fan and temperature?

Read the Pi's temperature and tune the PoE+ HAT fan curve for quiet running. You need Raspberry Pi 4 Model B (4 GB), Raspberry Pi PoE+ HAT and SanDisk microSD card 32 GB (A1, Class 10). It takes 7 steps and about 45 minutes.

Level
Beginner
Time
About 45 min
Parts
3

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
PoE+ HATPi 40-pin header and the PoE header pins, on standoffsPower from a PoE switch and a fan
Network cablePi Ethernet port from a PoE+ switchPower and data
SD cardPi microSD slotRaspberry Pi OS

Code

The official PoE+ HAT has a small fan that the firmware starts at set temperatures; the defaults start it early and it can be noisy. The lines in config.txt move the four trip points up so the fan stays off for light use and comes on only when needed; each pair gives the temperature at which a fan speed starts and how far the Pi must cool before that speed drops, in thousandths of a degree. Start with the values shown, run the load test for five minutes, and watch the log: if the CPU stays below about 70 C it is happy, and the Pi will slow itself down automatically near 80 C. Never block the vents. Only power the Pi from the HAT with a PoE+ switch or injector rated 802.3at, and do not also power it from USB-C at the same time. The file name is /boot/firmware/config.txt on current Raspberry Pi OS. The script looks for the cooling device with PoE in its type; if it prints unknown, list the files in /sys/class/thermal/ to find yours.

# 1. Fan trip points: add to /boot/firmware/config.txt, then reboot. Temperatures are in thousandths of a degree.
dtparam=poe_fan_temp0=50000
dtparam=poe_fan_temp0_hyst=5000
dtparam=poe_fan_temp1=60000
dtparam=poe_fan_temp1_hyst=5000
dtparam=poe_fan_temp2=70000
dtparam=poe_fan_temp2_hyst=5000
dtparam=poe_fan_temp3=80000
dtparam=poe_fan_temp3_hyst=2000

# 2. Log the CPU temperature and fan state every 10 seconds (save as fanlog.sh, run with bash fanlog.sh)
while true; do
  t=$(cat /sys/class/thermal/thermal_zone0/temp)
  state="unknown"
  for d in /sys/class/thermal/cooling_device*; do
    if grep -qi poe "$d/type" 2>/dev/null; then state=$(cat "$d/cur_state"); fi
  done
  echo "$(date +%T) cpu=$((t/1000))C fan_state=$state" | tee -a fanlog.txt
  sleep 10
done

# 3. Load test in a second window: install stress-ng, then run   stress-ng --cpu 4 --timeout 300s

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
IdleFan off, CPU well under 50 C
Load testFan starts, temperature levels off
After the loadFan stops as it cools
Log fileShows the fan states over time

If it does not work

Fan never starts

Check the HAT is seated and the config line has no typo.

Fan always on

Raise the first trip point.

Script shows unknown

Find the cooling device name under /sys/class/thermal.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the poE HAT fan and temperature?

Raspberry Pi 4 Model B (4 GB), Raspberry Pi PoE+ HAT and SanDisk microSD card 32 GB (A1, Class 10).

How long does the poE HAT fan and temperature take to build?

About 45 minutes for a beginner maker, in 7 steps.

How do I know the poE HAT fan and temperature works?

Idle: Fan off, CPU well under 50 C. Load test: Fan starts, temperature levels off. After the load: Fan stops as it cools.

Fan never starts: what should I check?

Check the HAT is seated and the config line has no typo.

Fan always on: what should I check?

Raise the first trip point.

Script shows unknown: what should I check?

Find the cooling device name under /sys/class/thermal.