Libreelec on Pi 4 Cooling Fan control

  • Hi,

    I have installed Libreelec 9.2.1 on Pi 4 with cooling fan that is connected to GPIO 4 (red) and 6 (black) directly without a transistor. I wanted to control this fan depending on the temperature of CPU. Found some information on internet, and based on these i programmed the Pi as the following:

    Created a file in /storage/.config/ with access 755.

    It contains the following script

    Then i made another file named in /storage/.config/ with access 755

    Lastly i created an file in /storage/.config/ with


    I have reboot the pi, but the fan is not controlled, it is non stop works with cpu temperature 35.

    What did i do wrong? How to make it work?

    thank you

  • You can't control the fan if you didn't add the transistor.

    Pins 4/6 are +5V and GND so the fan will be constantly running as long as your RPi is powered up.

    The python script you posted expects a transistor connected to GPIO 17.

    BTW: a much simpler alternative to using a python script is to use the gpio-fan DT overlay. GPIO number and temperature can be passed in as parameters. eg


    see also here linux/README at rpi-4.19.y · raspberrypi/linux · GitHub and here

    linux/gpio-fan-overlay.dts at rpi-4.19.y · raspberrypi/linux · GitHub

    so long,


  • Sorry if I reply to an old thread. I just wanted to know: the solution you provided still needs a transistor to work?