🛠 Refroidir le CM5 : ventilateur PWM sur le connecteur JST-SH et tachymétrie

Raspberry Pi Compute Module 5 (compute-module-5) · intermediaire · Schéma : IMG-compute-module-5-intermediaire-2-ventilateur-pwm-cm5io.svg — CM5IO Board vue de dessus avec le connecteur ventilateur JST-SH 4 broches (5 V, PWM, tachy, GND) branché à un petit ventilateur ; la ligne Fan_Tacho (GPIO29) remonte vers RP1 ; un graphique température/rotation relie le contrôle PWM à la consigne thermique.

Objectives

The CM5 delivers significantly more performance than the CM4 and generates more heat (throttling at 85 °C case temperature); the CM5IO Board provides a 4-pin JST-SH fan connector (5 V, Fan_PWM, tachometer, GND) and the firmware controls the PWM similarly to the Pi 5. This tutorial covers wiring the fan, reading the tachometer on Fan_Tacho (GPIO29), and understanding the documented pitfall: Fan_PWM stops at shutdown, but a fan powered separately with 5 V may continue to spin if the carrier board does not cut its power supply.

Hardware

Complete Code

#!/usr/bin/env python3
# rpm-ventilateur.py — lit Fan_Tacho (GPIO29) du connecteur ventilateur CM5IO.
from gpiozero import DigitalInputDevice
from time import sleep

compte = 0
def tick(_):
    global compte
    compte += 1

tach = DigitalInputDevice(29, pull_up=True, bounce_time=0.0005)
tach.when_activated = tick
sleep(5)
rpm = compte / 5 / 2 * 60          # 5 s, 2 impulsions par tour (typique)
print(f"~ {rpm:.0f} tr/min")
tach.close
# Température et état de throttle pendant la montée en charge
vcgencmd measure_temp && vcgencmd get_throttled
sudo apt install -y stress-ng && stress-ng --cpu 4 --timeout 90 &
sleep 45; python3 rpm-ventilateur.py; vcgencmd measure_temp

Expected Verification

The script displays a stable speed (e.g., ~2000 RPM); under stress, the temperature rises and the firmware accelerates the fan (the displayed speed increases, get_throttled remains at 0x0). Upon shutdown (sudo systemctl poweroff), the fan connected to the IO Board connector must stop — if it is still spinning, your carrier board does not cut the 5 V supply to the fan.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials