I was looking to cool my Raspberry Pi which was running LibreELEC. The Raspberry Pi case was equipped with a 5V fan. It was running all the time on full speed when mounted to the 5V pin. It was too loud.
With this open-source project I wanted to:
The available 5V fan has active power of up to 1W. However, the GPIO pins can only deliver 3.3V with a maximum of 1mA each. With a NPN transistor it is possible to control the 5V circuit with a low current from a GPIO pin providing voltage of 3.3V. To control the fan speed, Pulse-width modultion (PWM) is used (available on GPIO 12), with which the average power delivered to the 3.3V circuit can be controlled.
NPN-Transistor: 2N3904
Install on LibreELEC the 'Raspberry Pi Tools' addon
Addons --> install from repository --> LibreELEC Add-ons --> Program Addons --> Raspberry PiTools
Run python program 'calibrate.py' to change speed via SSH for testing before setting lowest speed in the script.
/storage/.kodi/userdata/PWM_fan/PWM_fan.py
chmod 777
/storage/.config/system.d/PWM_fan.service
systemctl enable PWM_fan
systemctl start PWM_fan
systemctl status PWM_fan.service
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Distributed under the MIT License. See LICENSE for more information.