Skip to content

Fan Control for a Raspberry Pi4 LibreELEC installation with HifiBerry AMP2 shield

License

Notifications You must be signed in to change notification settings

FUEL4EP/Libreelec_Raspberry_Pi4_Fan_Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libreelec fan control for a Raspberry Pi 4 + HifiBerry Amp2 shield License: CC BY-NC-SA 4.0 Hits

  • ideal for video streaming
  • quiet
  • metal case
  • external WiFi antenna
  • temperature controlled PWM of fan
  • simple, only few additional hardware components are required

hardware

  • Raspberry Pi 4 4GByte with U.FL antenna connector e.g. from geeks-r-us
  • WLAN Upgrade Kit Raspberry Pi / ESP8266 5dBi e.g. from geeks-r-us
    • drill an additional 6.5 mm hole for the RP-SMA socket into the metal case next to the fan opening
  • Hifiberry AMP2 shield e.g. from Reichelt
  • power supply LEICKE 72W Netzteil 12V 6A e.g. from Amazon
  • metal case for Raspberry Pi 4 & HiFiBerry AMP2, black e.g. from Reichelt
  • very quiet 25mm fan with ball bearing EBM Papst 255M axial flow fan 5 V/DC 2.3 m³/h (L x B x H) 25 x 25 x 8 mm e.g. from Conrad
  • heat sink 40 mm x 30 mm for Raspberry Pi 4 e.g. from Reichelt
  • spacers, screws as appropriate
  • loudspeaker and speaker cables
  • TV or monitor
  • for the fan control
    • 2N 7000 FAI MOSFET, N-CH, 60V, 0,115A, 0,4W, TO-92 e.g. from Reichelt
    • resistor 10kOhm e.g. from Reichelt
    • resistor 100Ohm e.g. from Reichelt
    • diode 1N4148 e.g. from Reichelt
    • schematics of fan control: Schematics
    • solder as floating wiring, ensure that all components are isolated by insulation tape
    • as reference, the GPIO pinout of a Raspberry Pi 4 is available e.g. here
    • used Raspberry Pi 4 GPIO pins:
      • +5V power (#2)
      • GND ground (#6)
      • BCM24 (#18)
      • note: do not use GPIOs that are used by the Hifiberry AMP2, see here

software

  • Libreelec Rpi4 nightly build e.g. this one (may not exist anymore) (worked for me, please check for the latest available RPi4 nightly builds at https://test.libreelec.tv/11.0/RPi/RPi4/: LibreELEC-RPi4.arm-11.0-nightly-*.img.gz)
  • replace the Rapberry Pi 4's config.txt:
    • connect to the Raspberry Pi 4 via ssh:

      • enable ssh access in Libreelec

      ssh root@<raspberry_pi4_ip_address>

      • the default ssh password is: libreelec (if not changed yet, it is strongly recommended to change the default password!)
      • the /flash boot partition is read-only by default, so we need to remount it in read-write mode:

      mount -o remount,rw /flash

      • now execute the following commands at the command line

      cd /flash

      wget https://github.com/FUEL4EP/Libreelec_Raspberry_Pi4_Fan_Control/blob/master/config.txt

      • then set the /flash partition back to read-only mode:

      mount -o remount,ro /flash

      • and reboot for the changes in config.txt to be applied:

      reboot

  • the fan control software is derived from here. Many thanks to internauta37 !
    • installation procedure for the fan control (derived from here.)

    • major change is that the fan is turning at 'turn_on_speed (default: 65%)' speed for 1 second after each change of the fan speed

    • to make the fan working on LibreELEC it is necessary to perform the following steps:

      • install the Addon Raspberry Pi Tools in LibreELEC

      • connect to the Raspberry Pi 4 via ssh:

        • enable ssh access in Libreelec

        ssh root@<raspberry_pi4_ip_address>

        • the default ssh password is: libreelec
        • check that all the libraries by Raspberry Pi Tools have been installed correctly:

        ls -la /storage/.kodi/addons/virtual.rpi-tools/lib

        • download the python script that starts and manages the fan:

        mkdir /storage/.config/fan_controller

        cd /storage/.config/fan_controller

        wget https://raw.githubusercontent.com/FUEL4EP/Libreelec_Raspberry_Pi4_Fan_Control/master/fan_controller.py

        • create the autostart.sh file and let his start the python script that takes care of controlling the fan:

        touch /storage/.config/autostart.sh

        chmod +x /storage/.config/autostart.sh

        nano /storage/.config/autostart.sh

        • adding to it:

        (python3 /storage/.config/fan_controller/fan_controller.py)&

        • save it; now all that remains is to restart the Raspberry and enjoy the fan running:

        reboot

        • ensure that the fan is turning after the reboot
        • experts can observe debug messages by invoking from the command line after setting 'debugFlag=True' in the python script 'fan_controller.py':

        python3 /storage/.config/fan_controller/fan_controller.py

        • please do not forget to set 'debugFlag=False' afterwards
  • I got some Mediathek addons working properly by installing the following VideoPlayer InputStream LibreELEC Addons:
    • InputStream Adaptive
    • Inputstream FFmpeg Direct
    • RTMP Input
  • without these 3 addons the seeking forward and backward is not working!
  • CURRENTLY NOT WORKING DUE TO NOT MAINTAINED releases.json FILE: for manual updates inside Libreelec please define in Settings => LibreElec => Updates:
  • then select the latest update in 'available updates'
  • alternative manual update via ssh is as follows:

final step

  • seal the SD card opening of the case with black adhesive tape in order to avoid a bypass of the air flow. Keep the fan opening free.

disclaimer

  • use of these instructions is on your own risk! No liability by the publisher!
  • ensure that the fan is turning after installation
  • ensure that your raspberry pi4 is not overheating due to a wrong installation
  • it is strongly recommended to make a backup of your SD card before you upgrade the Libreelec nightly build

donation

  • if you like my contribution, please feel free to spend me a coffee:
  • Buy Me a Coffee at ko-fi.com

license

Creative Commons BY-NC-SA
Give Credit, NonCommercial, ShareAlike

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

About

Fan Control for a Raspberry Pi4 LibreELEC installation with HifiBerry AMP2 shield

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published