ar51an / raspberrypi-fan-control Goto Github PK
View Code? Open in Web Editor NEWRaspberry Pi Adjust Fan Speed With Temperature [C - WiringPi - Pigpio - Noctua PWM Fan]
License: MIT License
Raspberry Pi Adjust Fan Speed With Temperature [C - WiringPi - Pigpio - Noctua PWM Fan]
License: MIT License
Hard coded values prevent easy customization, reuse. A configuration file could make the rpfc more flexible, and it is clearly a very popular project in the raspberry pi community. E.g. I need to control 3x Noctua A6 5v fans I am using to cool a small blade case (a slightly modified Cloudlet by C4Labs.com), and the temperature to be checked will need to be the highest reported by a monitoring script - probably a custom file location rather than /sys/class/thermal/thermal_zone0/temp
.
Feature request: Read custom values for a setup from file:
Likely there are other values which could usefully be drawn from a configuration file, but these would be a great (for me!) start.
As per below, when I try run the binary from the 3.0 release, I get -bash: ./fan-control: cannot execute: required file not found
Meanwhile if I compile it myself, things work.
pi@raspberrypi:/opt/gpio/fan $ sudo wget -c https://github.com/ar51an/raspberrypi-fan-control/releases/download/v3.0/fan-control-release-3.0.tar.gz -O - | sudo tar -xz
Redirecting output to ‘wget-log’.
pi@raspberrypi:/opt/gpio/fan $ ll
total 40
-rwxr-xr-x 1 root root 14616 Feb 7 21:39 fan-control.backup
-rwxr-xr-x 1 pi pi 9938 Feb 7 21:39 fan-control.c
drwxr-xr-x 4 pi pi 4096 Nov 15 2022 fan-control-release-3.0
-rwxr-xr-x 1 root root 192 Feb 7 20:59 params.conf
-rw-r--r-- 1 root root 2262 Feb 8 17:05 wget-log
pi@raspberrypi:/opt/gpio/fan $ cd fan-control-release-3.0/
pi@raspberrypi:/opt/gpio/fan/fan-control-release-3.0 $ cd build/
pi@raspberrypi:/opt/gpio/fan/fan-control-release-3.0/build $ ll
total 72
-rwxr-xr-x 1 root root 67816 Dec 20 06:53 fan-control
-rw-r--r-- 1 root root 161 Dec 20 06:48 params.conf
pi@raspberrypi:/opt/gpio/fan/fan-control-release-3.0/build $ sudo ./fan-control
sudo: unable to execute ./fan-control: No such file or directory
pi@raspberrypi:/opt/gpio/fan/fan-control-release-3.0/build $ ./fan-control
-bash: ./fan-control: cannot execute: required file not found
Meanwhile compiling:
pi@raspberrypi:~/repos/raspberrypi-fan-control/src $ sudo ./fan-control
pi@raspberrypi:~/repos/raspberrypi-fan-control/src $ ll
total 8
-rw-r--r-- 1 pi pi 6744 Feb 8 16:45 fan-control.c
pi@raspberrypi:~/repos/raspberrypi-fan-control/src $ sudo gcc -Wall -O2 fan-control.c -o fan-control -lpigpio -lsystemd
pi@raspberrypi:~ $ journalctl -f
Feb 08 17:13:26 raspberrypi fan-control[6354]: Config values loaded: PWM_PIN=19 | TACHO_PIN=24 | RPM_MAX=5000 | RPM_MIN=1500 | RPM_OFF=0 | TEMP_MAX=55 | TEMP_LOW=40 | WAIT=5000 | TACHO_ENABLED=0 | THERMAL_FILE=/sys/class/thermal/thermal_zone0/temp
Feb 08 17:13:26 raspberrypi fan-control[6354]: Initialized and running ...
Feb 08 17:13:26 raspberrypi fan-control[6354]: [PWM] Temp: 51 | TempDiff: 73.3% | RPM: 3666
Feb 08 17:13:31 raspberrypi fan-control[6354]: [PWM] Temp: 51 | TempDiff: 73.3% | RPM: 3666
Feb 08 17:13:36 raspberrypi fan-control[6354]: [PWM] Temp: 48 | TempDiff: 53.3% | RPM: 2666
Feb 08 17:13:41 raspberrypi fan-control[6354]: [PWM] Temp: 49 | TempDiff: 60.0% | RPM: 2999
RPI 4 info:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
pi@raspberrypi:~ $ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Operating System: Raspbian GNU/Linux 12 (bookworm)
Kernel: Linux 6.1.0-rpi7-rpi-v8
Architecture: arm64
Just curious if anyone else has had issues with the binary in the releases.
I have observed if you restart the raspberry pi the service works, however the TACHO reading shows 0 throughout and although the PWM pin shows RPM reading
the fan doesn't seem to come on at all.
This is despite waiting for several minutes to an hour
If you manually stop and start the service it works, But I do not think this is designed in that manner.
I tried this using v1.4
FYI: The taco seems to give just 1 reading at the start up and the fan shuts off and doesn't come on again until you manually restart the service
I have tried setting this up from scratch 3-4 times and see the same behavior
So in order to mitigate it, I have added this crontab
@reboot sleep 60 && sudo systemctl restart fan-control
Hi,
First off, thank you for this useful piece of software. This works like a charm. Though, I was wondering if it was possible to have the fan not spin at all when under a certain temperature ?
Something like the gpio-fan dt-overlay (https://github.com/raspberrypi/firmware/blob/c167a3336a2a770ab840e94f2cb1d379d8478c1d/boot/overlays/README#L1446) but with the PWM feature.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.