Fan support like in raspi-config?

Hello!!

I just bought and installed a GeeekPi RPi4 Aluminum Heatsink and, in the instructions, it says to run “sudo raspi-config” to enable the fan under performance options.

Is there something similar in DietPi to support the fan??

Thanks!

Hi,

the raspi-config “Fan” option doesn’t install any service. It only adds a single line to config.txt that loads the kernel overlay gpio-fan. You can do the same on DietPi by hand.

First, please check how your fan is connected:

  • 2 wires (red/black on 5V + GND): the fan runs all the time, there is nothing to configure.
  • 3 wires (red 5V, black GND, blue/control wire on a GPIO, usually GPIO14 = pin 8): the overlay switches the fan on and off through the control wire.

For the 3-wire version, add this to the end of /boot/firmware/config.txt:

dtoverlay=gpio-fan,gpiopin=14,temp=65000
  • gpiopin = the GPIO (BCM number) the control wire is connected to
  • temp = switch-on temperature in millidegrees (65000 = 65 °C)
  • optional: hyst=10000 = the fan switches off again 10 °C below temp (this is the default)

Then reboot. Please note this is only on/off control, not real PWM speed control.

Important for GPIO14: GPIO14/15 are the serial UART pins, and on DietPi the serial console is enabled there by default (if not disabled manually). This conflicts with the fan control. Either:

  1. disable the UART: dietpi-config > Advanced Options > Serial/UART > ttyS0 (mini UART) device > Off, then reboot, or
  2. if your fan has separate jumper wires, move the control wire to a free GPIO, e.g. GPIO18 (pin 12), and use gpiopin=18. Make sure that pin isn’t used by anything else (e.g. an I2S audio HAT or LED strip).

After the reboot you can test it, e.g. with a lower temporary temp value, or check the current temperature with cpu.

Awesome, thanks a lot for such detailed information.
I just added that line to my config.txt and it seems to be working properly (UART was already disabled).

Thanks!!

FYI: Add PWM fan control to dietpi-config by zumbiepig · Pull Request #8269 · MichaIng/DietPi · GitHub

So there is a new overlay added by one of our contributors. I did not find the time to implement a choice between the two, which is IMO needed, but support for this is coming to dietpi-config.

That’s awesome!!