Cooling Fan Control Raspberry Pi Libreelec.

  • exactly 17 uses 3.3v for management


    if I use the script with PWM pin18 my fan have to be attached on 2/4, isn’t it?

    you can use 2 or 4 positive and 6 negative for 5v or 1 positive and 6 negative for 3.3v and then pin 18 to control...if you r going for the PWM script just use 5v and set speeds from script....if you r going for just ON/OFF script use 3.3v as fan when ON will always be on full throttle and may be bit noisy on 5v.

  • you can use 2 or 4 positive and 6 negative for 5v or 1 positive and 6 negative for 3.3v and then pin 18 to control...if you r going for the PWM script just use 5v and set speeds from script....if you r going for just ON/OFF script use 3.3v as fan when ON will always be on full throttle and may be bit noisy on 5v.

    I prefer this one with the speed adjustment but which one will you recommend? Could you share your exact script and how you set it?

    I red the forum before but there are a few scripts and several ways to launch them and as I am fully beginner I was puzzled

    Are you using this circuit?

  • I prefer this one with the speed adjustment but which one will you recommend? Could you share your exact script and how you set it?

    I red the forum before but there are a few scripts and several ways to launch them and as I am fully beginner I was puzzled

    Are you using this circuit?

    Same curcuit but with no diode or resistance...just transistor

    I m using this script run-fan.py.txt

    Then place this in system.drun-fan.service.txt

    Enable it with

    Code
    systemctl enable run-fan

    and start it with

    Code
    systemctl start run-fan

    Check

    Code
    systemctl status run-fan.service

    As you can see from script I created a folder in userdata called fan and placed run-fan.py in there ...you put run-fan.service in /storage/.config/system.d

    Edited 2 times, last by Mario77 (January 9, 2020 at 8:41 AM).

  • For the record of this thread,

    This is another script I found that uses PWM for RPI's

    Been edited slightly to work with LibreElec.

    Fan speed changes depending on Temp not just On and OFF..

    You can set the speeds you want for the chosen Temperatures

    fan.py.txt

  • Hi,

    I would like to use a 4 wire fan (NF-A4x10 5V PWM) with pwm control. Do you think, the PWM frequency in the script could be set to 25kHz, which ist the required frequency for the PWM control?

    Cheers

    Roland

  • Hi,

    I would like to use a 4 wire fan (NF-A4x10 5V PWM) with pwm control. Do you think, the PWM frequency in the script could be set to 25kHz, which ist the required frequency for the PWM control?

    Cheers

    Roland

    It's already set to 25 if you look at line 15 of last script in post #60..

    Regarding your fan..I m not sure how you could connect it but having a look at it you might not need a transistor...

    Might work if you connect black to ground,yellow to power and blue for PWM to GPIO here and here

    Not tested so make your own research before you try ;)

    I m just using 2 wired 5v fans and controlled from a transistor..

  • Same curcuit but with no diode or resistance...just transistor

    I m using this script run-fan.py.txt

    Then place this in system.drun-fan.service.txt

    Dear Mario77,

    I did everything as written in post # 58, but it gives me this error:

    Code
    ● run-fan.service - to control the fan based on temperature.   Loaded: loaded (/storage/.config/system.d/run-fan.service; enabled; vendor preset: disabled)   Active: activating (auto-restart) (Result: exit-code) since Sun 2021-01-03 20:43:25 UTC; 13s ago  Process: 842 ExecStart=/usr/bin/python /storage/.kodi/userdata/fan/run-fan.py (code=exited, status=1/FAILURE) Main PID: 842 (code=exited, status=1/FAILURE)

    What have I done wrong?

    Thank you!

  • Hi

    The wiring is understood, no need for a Transistor or similar. The question is the 25 kHz. If I understood correctly, the 25 in the post you mentioned is Hz, not kHz.

    Roland

  • Dear Mario77,

    I did everything as written in post # 58, but it gives me this error:

    Code
    ● run-fan.service - to control the fan based on temperature.   Loaded: loaded (/storage/.config/system.d/run-fan.service; enabled; vendor preset: disabled)   Active: activating (auto-restart) (Result: exit-code) since Sun 2021-01-03 20:43:25 UTC; 13s ago  Process: 842 ExecStart=/usr/bin/python /storage/.kodi/userdata/fan/run-fan.py (code=exited, status=1/FAILURE) Main PID: 842 (code=exited, status=1/FAILURE)

    What have I done wrong?

    Thank you!

    Make sure

    you installed raspberry pi tools addon from libreelec repo

    chmod 777 the run-fan.py script

    run dos2unix command on script

    you can run script from ssh directly to test...fan should start

    Edited once, last by Mario77 (January 4, 2021 at 9:21 AM).

  • Make sure

    you installed raspberry pi tools addon from libreelec repo

    chmod 777 the run-fan.py script

    run dos2unix command on script

    you can run script from ssh directly to test...fan should start

    Hi!

    Yes, installed raspberry pi tools addon from libreelec repo

    Yes, chmod 777 the run-fan.py script

    І am run script from ssh directly to test...but fan does not work

    but it gives me again error.

    What have I done wrong?

    Thank you!

  • What error you get when you run script manually?..If I remember correctly you should connect pwm transistor base to gpio18 which is pin 12

    Edited once, last by Mario77 (January 4, 2021 at 4:46 PM).

  • What error you get when you run script manually?..If I remember correctly you should connect pwm transistor base to gpio12 which is pin 18

    .i ll double check when home

    It worked with the script from post #12.

    Thank you.

    Edited once, last by Dmitry (January 4, 2021 at 7:00 PM).

  • Взаимодействие с другими людьми

    It worked with the script from post #12.

    Thank you.

    Post #12 that is the service script...to start fan on boot...

    So you still using the pwm script from latest post?


    Hi

    The wiring is understood, no need for a Transistor or similar. The question is the 25 kHz. If I understood correctly, the 25 in the post you mentioned is Hz, not kHz.

    Roland

    It s hz not khz..that s what you need

    Edited once, last by Mario77: Merged a post created by Mario77 into this post. (January 4, 2021 at 3:12 PM).