03-26-2019, 09:57 AM
I have speed control adding to crontab:
* * * * * fancontrol.py
It only cuts on if I am compiling something or using a lot of cpu. Normally using conservative governor with 408mhz. I have the large heatsink (designed for not fan) but I have a fan anyway.
The fan does not run very fast even at full speed. It is a 12v fan. I didn't measure the voltage powering it, I suspect it only gets 5 volts even at max speed.
* * * * * fancontrol.py
Code:
#!/usr/bin/python
import os
def write_fan(pwm):
try:
f = open('/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1', 'w')
f.write("%d" % pwm)
except:
print 'failed to write fan'
def read_temp():
try:
f = open('/sys/devices/virtual/thermal/thermal_zone0/temp')
return float(f.readline())/1000.0
except:
print 'failed to read temperature'
return 80
t = read_temp()
# cut on at 58C
speed = min(int(10*(t - 58) + 120), 255)
if speed < 120:
speed = 0
write_fan(speed)
It only cuts on if I am compiling something or using a lot of cpu. Normally using conservative governor with 408mhz. I have the large heatsink (designed for not fan) but I have a fan anyway.
The fan does not run very fast even at full speed. It is a 12v fan. I didn't measure the voltage powering it, I suspect it only gets 5 volts even at max speed.