Cooling Fan Control Raspberry Pi Libreelec.

  • The scripts posted here works perfectly for me...just there is no speed control which is not an issue...just on and off...just set min temp and max temp as far as you can so the fan won't turn on and off constantly...

  • I suppose there is something wrong with the script, because although it works as I did not notice fan speed variation according to temperature increase, at the moment I will use the scripts already posted in this topic, because it works correctly for me.

    Thank you friend!

    Check these scripts...they make more sense to me..

    Variable Speed Cooling Fan for Raspberry Pi using PWM

    #138 Variable Speed Cooling Fan for Raspberry Pi using PWM

  • What script are you currently using? I noticed that this topic has no speed control, and the noise is rather loud.

    Hi I'm using the script from GaryB available on this's neatly edited to work with libreelec...I only have a cheap fan..and it's not noisy but it was at the beginning until I connected it to the 3.3v pin instead of works much better and still cooling nicely..It's been going since August never had the rpi's only on or off no speed control tough.No power issues whatsoever and the rpi is also powering an hdd all from a 2amp supply.

    Did you have a look at the links in #38 regarding speed control?

  • here is my script that is working for almost a year. I am not taking any credit and dont consider myself a programmer. Studied a few scripts and got help from python reference tutorial and GPIO examples at sourceforge. This one works and fan speed varies with temperature. Starts at 60 degree and full speed at 78.

    shared just in case someone needs it. uses PWM for speed control. I am using a transistor for supplying power to DC fan and GPIO triggers that

  • Interesting @Imran a couple of questions if you don't mind...what kind of fan are you using,is it just the 2 wired one?

    Looks similar to my setup..gpio that triggers a transistor but not sure how the PWM is working...

  • Sorry I didn't check the forum for a long time.

    The fan is simple DC fan 5V purchased from Aliexpress. Yes it is 2 wire.

    And sorry for posting here as at that time I was using Openelec. I have recently switched to Libreelec and will shortly implement this too.

    For PWM you can check here

    So basically I can leave the same setup...just editing line 7 of your script to match Libreelec Tools...and line 13 for gpio pin I ll be using?

    Would be nice if someone manages to add some type of logging for this script.

  • Just tried the PWM with my setup and fan is working fine...gpio remains the same as before gpio12/ just had to change line 7 for PWM to work with Libreelec to


    Changed dc input from the 3.3 to the 5v pin now as fan is mostly running on low speed...before was always on 3.3 cause was bit noisy on 5v as always running on full speed on or off...

    ...I ll let you know how it goes..

    Just missing the logging now...

  • Hello when Im trying run script always end with

    LibreELEC:~/.kodi/userdata # python

    Traceback (most recent call last):

    File "", line 10, in <module>

    import RPi.GPIO as GPIO

    ImportError: No module named RPi.GPIO

  • Did you install Raspberry pi tools addon from repo?

  • Dear All,

    This is very interesting topic! Full respect for your job and inputs. I am quite new with rpi4 and what I saw.

    There is a way to manage the fan speed with pin 17 under Raspberian(with resistor+transistor), here in LibreELEC I see solutions for pin 12 and 18.

    I am puzzled now. Should I have to switch the pins under different OS?

    Please help me to find the proper circuit with resistors/transistors and a script which is using the same pins on both Raspberian and LibreELEC


  • PWM is available on 12 and 17 is 3.3v so probably was used for power