Per the GPIO map, there is a convenient header 9J1:
Ground
GPIO (for tach)
5V
On the 40-pin header, there are 5 hardware PWMs we can use per our PWM guide. We do not want to waste CPU cycles to generate inaccurate PWM via software GPIO bitbanging.
This will create a hwmon device in /sys/class/hwmon/.
The fan speed can be read from the file fan1_input in the hwmon device directory: cat fan1_input
The pwm level (0-255) can be set by the file pwm1 in the hwmon device directory. echo 0 | sudo tee pwm1
To make it permanent:
sudo ldto merge pwm-a
sudo ldto merge pwm-a-fan
From here, you can write userspace software in any language to implement control systems by reading fan1_input and writing to pwm1.
Most users prefer to link fan speed to SoC temperatures. To enable temperature-based fan speed control, run the previous merge commands and then add:
sudo ldto merge pwm-a-fan-auto
After rebooting, fan speed should be directly controlled by SoC temperatures. This profile deactivates the fan < 50C and peaks at 60C for maintaining maximum performance.
Ok so on the 3 wire PWM fans and 2 wire fans that we can control with a transistor.
Which pins would you use for the fan switching and which for the tac? It doesn’t say
And does PWM turn the fan on and off automatically?
I don’t have a PWM fan to test this with, but it looks like they’re talking about pin 9J1 2 , and you have to work out how you want to control it, whether that be a python script or whatever.
I’m not sure on the others, I Just keep my 2 wire 5v 30mm fan on all the time. It’s quiet.
3 wire fans are not PWM. They are DC fans that require the input voltage to change. Header pins are static voltage and not dynamic so 3 wire fans can only sense speed with no speed control.
4 wire fans have a static input voltage pin and vary speed via PWM signal. Don’t confuse the two.
Using latest Raspbian image form downloads section for the board
For some reason the final step just didn’t work. “sudo ldto merge pwm-a-fan-auto” just kept poping up saying could not be created.
So for a work around I installed fancontroller and lm-sensors. I ran my fan wires exactly as shown in your image BYR in S/PDIF Header and Blue running to pin 33. sensors detected the pwm1 and temp1_input for the CPU no issue. following this guide here. https://www.libe.net/en-fan-control-debian#sudo-pwmconfig
but when I got to running sudo pwnconfig the fans would turn off but not back on drove me crazy. figured out pwmconfig would set pwm1_enable to a value of 0 and pwm1 to a value of 0. without a 1 in the pwm1_enable file the pwmconfigure program thought my fans had died.
nuts to all of that I just needed a clean config file that’s all.
here’s what I did.
took root using sudo su
then
cd /sys/class/hwmon/hwmon1
from here as root I did this
pwmconfig && echo 1 | sudo tee pwm1_enable && echo 255 | sudo tee pwm1
that command just ran pwmconfig but then enabled pwm1 and set pwm1 value to 255 the setting pwmconfig wanted to set.
after that i finished the config wizard then saved and closed
now to see if i can do the same to the Emuelec image