Cooling Fan Control Raspberry Pi Libreelec.

  • I should have explained why I said that. If your storage is on an SD card constantly updating a log file can shorten the life of the card, though I guess just the one file a few times a day won't have much impact. Mine is stored on a RAID array on a server so it isn't an issue for me.


    No, no resistance. I connected the fan to +5v and the collector, emitter to GND, GPIO pin to base. (I think that's right, got it the wrong way round when I first typed it.)

  • I should have explained why I said that. If your storage is on an SD card constantly updating a log file can shorten the life of the card, though I guess just the one file a few times a day won't have much impact. Mine is stored on a RAID array on a server so it isn't an issue for me.


    No, no resistance. I connected the fan to +5v and the collector, emitter to GND, GPIO pin to base. (I think that's right, got it the wrong way round when I first typed it.)

    Ok got you...don't think logging would be an issue tough...I can send logs to connected hdd so shouldnt be a problem...log only contains 16 lines after 8 hours..

    Thanks a lot for your help Gary...didn't think it was going to be this easy to be honest as the scripts I found online weren't for LE and I m useless to edit coding....


    Now waiting for some bits trough the post to complete the circuit...in the meantime the script is running without the fan..I ll let you know when fan is up and running...


    Thanks again

  • Hi Gar

    I should have explained why I said that. If your storage is on an SD card constantly updating a log file can shorten the life of the card, though I guess just the one file a few times a day won't have much impact. Mine is stored on a RAID array on a server so it isn't an issue for me.


    No, no resistance. I connected the fan to +5v and the collector, emitter to GND, GPIO pin to base. (I think that's right, got it the wrong way round when I first typed it.)

    Hi Gary..just to let you know that I got the fan and connected and all is working fine..just playing with the min and max temperatures...just not sure if the fan got to be facing in or out..going to be screwed in the top cover...

  • I mounted mine with the fan under the lid of the case with air blowing out (upwards), and drilled 8 holes that lined up with the fan. My reasoning was that's the way the air would be flowing when the fan isn't running due to convection currents. It probably doesn't really matter though, the main thing is just that air moves through the case.

  • I think any npn transistor should work with similar values. I am using 3904 npn, which is working all good.

  • I don't want to thread jack, but where are you guys getting the pi tools addon from?

    I've searched and searched and can't seem to figure it out. On my C2 running 8.2 it's not listed anywhere in the stock LibreELEC repo.

  • HK provide their own version of wiringPi, which almost certainly means they have adjusted it to match the GPIO layout. I doubt the Pi add-on can be ported directly.

  • for some reason I can not succeed in autostart for this script:

    [Unit]

    Description = PWM Fan Control

    After = mediacenter.service



    [Service]

    Type = simple

    ExecStart = / usr / bin / python /storage/fan/cooler.py

    Restart = always



    [Install]

    WantedBy = default.target





    Path: /storage/.config/system.d/fanctrl.service



    What is wrong?

  • Are you trying to control fan speed too or just on and off?

  • I found a script where it also controls the fan speed, rename with autoexec.py in the userdata folder it works ok, but when using other gpio pins, it causes the script to stop. Here's the py script:

    [anexo = 3178] [/ attach]

    Files

    • autoexec.txt

      (2.63 kB, downloaded 473 times, last: )

    Edited 2 times, last by valdolopes ().

  • Are you sure that script is for libreelec or at least for Rpi? I m not good with scripts but can't find anything that is measuring the temp in the script something like "vcgencmd measure_temp"

  • Yes! take a look

    http:// w ww. instruc tables.com/ id/PWM-Regulated-Fan -Based-on-CPU-Temperature-for-Ras/

    sorry, I do not know if the forum accepts third-party links, contains some spaces

  • I m gonna try to explain to you how my script is working and enabled...assuming you already installed RPI tools addon...try to follow this...

    Make a folder in Storage/.kodi/userdata/and name it "fan" and place your cooler.py in there.Anywhere in /storage should work but I m using this location as an example and that is where I keep my scripts..


    Copy this and save it as "cooler.service"


    Then place the "cooler.service" in Storage\.config\system.d


    After you place your file in system.d go to ssh to your Rpi


    Enable it with

    Code
    systemctl enable cooler


    and then start it with

    Code
    systemctl start cooler


    Check if its working

    Code
    systemctl status cooler.service

    Hope I helped you in some way.

  • I suppose there is something wrong with the script, because although it works as autoexec.py 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!