I tried generate some code via chatgpt but it seems a lot of GPIO libraries is not supported on RPI5. So this python code below works for me with Noctua NF-A4x10 5V PWM connected to GPIO.
more details about connection is for example there -> https://blog.driftking.tw/en/2019/11/Us ... its-Speed/
my code in python
more details about connection is for example there -> https://blog.driftking.tw/en/2019/11/Us ... its-Speed/
my code in python
Code:
from gpiozero import PWMOutputDeviceimport timeimport osFAN_PWM_PIN = 18 # GPIO18 (physical pin 12)# Safe frequency for LGPIO / Pi 5 PWM: 800 Hzfan = PWMOutputDevice(FAN_PWM_PIN, frequency=800, initial_value=0)def get_cpu_temp(): temp_str = os.popen("vcgencmd measure_temp").readline() return float(temp_str.replace("temp=", "").replace("'C\n", ""))try: while True: temp = get_cpu_temp() if temp < 45: duty = 0.0 else: duty = 0.5 + ((temp - 45) // 5) * 0.1 if duty > 1.0: duty = 1.0 fan.value = duty print(f"Temp: {temp:.1f}°C | Fan duty: {duty*100:.0f}%") time.sleep(5)except KeyboardInterrupt: print("Stopping fan...") fan.value = 0Statistics: Posted by ao0 — Sun Sep 14, 2025 8:13 pm