Hi I tried it and fan didn’t start.
When I started services it started.
Here is video of fan https://youtu.be/2T9r_hqpfuc
CPU has more than 50C and lv3 was set to 30.
Slow CPU fan speed
Hi Peter_Paulen,
please post here your /etc/rockpi-sata.conf, as 2 eyes more potentially discover a typo e.g. unwanted blank etc.
Secondly another explanation why after succesfull start it stops could be that during the regular timer based temperature measurement and new computed fan alignment in some of the Python scripts an error / exception occurs and crashes the fan.py without any further indication.
Did you modify the code?
Does it stop all time after an exact duration of running?
Maybe you want to try with a new installtion at least of the Python script portion.
Here is my actual config https://pastebin.com/4ssDgduD
Fan didn’t stop after start it stop (didn’t start after reboot) when I disable services.
And fan start after I manually started services. And fan is running very slowly and I can not see any differences in fan speed when I change settings in config.
config looks OK, stating
75% fan speed at 25 degree CPU temp
100% fan speed at 30 degree CPU temp
with that your fan should turn full power.
a) As it is PWM fan do you have an oscilloscop like DSO 138 to see if duty cycle is as expected?
b) ensure you have still
/lib/systemd/system/pigpiod.service:
ExecStart=/usr/bin/pigpiod -l -m -n 127.0.0.1 -p 8888
Mine got lost after a DietPi ugrade.
a) nope, doesn’t have it
b) file is there because before some days ago I tried to reinstall tools
but this is what I have in service file
ExecStart=/usr/bin/pigpiod -l
But pigpiod is listenning on port 8888
root@DietPi:~# netstat -tulpn|grep 8888
tcp6 0 0 ::1:8888 :::* LISTEN 394/pigpiod
please have a look here
Ok I will try but I think in past as default I have not enable it and services didn’t start.
Tested, pigpiod.service can’t start without IPv6 enabled
Nov 14 20:18:30 DietPi pigpiod[1150]: 2021-11-14 20:18:30 initInitialise: bind to port 8888 failed (Cannot assign requested address)
Nov 14 20:18:30 DietPi pigpiod[1150]: Can’t initialise pigpio library
Nov 14 20:18:30 DietPi systemd[1]: pigpiod.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 20:18:30 DietPi systemd[1]: pigpiod.service: Failed with result ‘exit-code’.
to allow fan control ipv6 have to be OFF in dietpi-config
my /lib/systemd/system/pigpiod.service looks like:
[Unit]
Description=Daemon required to control GPIO pins via pigpio
[Service]
#ExecStart=/usr/bin/pigpiod -l
ExecStart=/usr/bin/pigpiod -l -m -n 127.0.0.1 -p 8888
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target
after updating your /lib/systemd/system/pigpiod.service
ensure you reboot and that no relevant services are disabled
pls post than your netstat -tulpn|grep 8888
Ok
output of netstat
root@DietPi:~# netstat -tulpn|grep 8888
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 396/pigpiod
This looks good
But CPU has 60C and now it has 55 im not sure if it is working.
Later maybe I will dismantle it and I will check the fan.
do you use the original Metal Case?
Then you might check
Nope, I do not have case, everything is open.
if you feel confident
save a copy of fan.py
replace in fan.py the
/sys/class/thermal/thermal_zone0/temp
with a filename you own and enter an inital value of 40000 in that file
restart rockpi-sata.service
then just “play” in that file with temp values e.g. 30000, 40000, 50000, 60000
wait for the new “temp” reading and see how your fan reacts
and finally restore your saved original of fan.py and restart rockpi-sata.service
Testet no changes, any values and fan is running always with same speed.
Hi, are you using rpimonitor? Because it has same port 8888. Backup it’s settings, uninstall it and reboot.
and for the software side
to ensure to determine that fan.py is ongoing running as expected,
please insert logging in fan.py at indicated position in def read_temp(cache={}):
with open('/sys/class/thermal/thermal_zone0/temp') as f:
t2 = int(f.read().strip()) / 1000.0
# >> logging here: timestamp and t2
return max(t1, t2)
you should see than an continous logging
nope I do not use it
Sorry I do not understand what I need to put into fan.py
use this as fan.py
find log in /var/log/fan.log
be not surprised when it is hourly cleared to 0 by cron
#!/usr/bin/env python3
import re
import time
import misc
import syslog
import pigpio # pylint: disable=import-error
from pathlib import Path
import logging
logging.basicConfig(filename='/var/log/fan.log', level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%d.%m.%Y %H:%M:%S')
pattern = re.compile(r't=(\d+)\n$')
class MockPigpio:
@classmethod
def pi(cls):
try:
host = misc.check_output("netstat -l | grep -o '\S*:8888' | tr -d ':8888'")
gpio = pigpio.pi(host=host)
except Exception:
gpio = cls()
return gpio
def __init__(self):
syslog.syslog('PWM of pigpio is not available. Use on/off to control the fan.')
syslog.syslog('If you use pre-release kernel, please go back to stable release.')
def hardware_PWM(self, pin, _, dc):
misc.set_mode(pin, bool(dc))
gpio = MockPigpio.pi()
# t1: sensor_temp, t2: cpu_temp
def read_temp(cache={}):
w1_slave = cache.get('w1_slave')
if not w1_slave:
try:
w1_slave = next(Path('/sys/bus/w1/devices/').glob('28*/w1_slave'))
except Exception:
w1_slave = 'not exist'
cache['w1_slave'] = w1_slave
if w1_slave == 'not exist':
t1 = 42
else:
with open(w1_slave) as f:
t1 = int(pattern.search(f.read()).groups()[0]) / 1000.0
with open('/sys/class/thermal/thermal_zone0/temp') as f:
t2 = int(f.read().strip()) / 1000.0
logging.info('cpu: ' + str(t2) + ', hdd: '+str(t1 - 20))
return max(t1, t2)
# return t1
def turn_off():
misc.conf['run'].value = 0
gpio.hardware_PWM(12, 0, 0)
gpio.hardware_PWM(13, 0, 0)
def get_dc(cache={}):
if not(misc.conf['run'].value):
return 0
if time.time() - cache.get('time', 0) > 60:
cache['time'] = time.time()
cache['dc'] = misc.fan_temp2dc(read_temp())
return cache['dc']
def change_dc(dc, cache={}):
if dc != cache.get('dc'):
cache['dc'] = dc
gpio.hardware_PWM(12, 25000, dc * 10000)
gpio.hardware_PWM(13, 25000, dc * 10000)
logging.info('TEST'+str(dc*1))
def running():
while True:
change_dc(get_dc())
time.sleep(0.1)
Soo
I tried it with newest image of DietPi 7.8.2 with ARMv8 and this is my findings.
/etc/rockpi-sata.conf has these values
lv0 = 35
lv1 = 40
lv2 = 45
lv3 = 50
and there is output from log
21.11.2021 18:40:22 cpu: 10.0, hdd: 22
21.11.2021 18:40:22 TEST50
21.11.2021 18:41:22 cpu: 10.0, hdd: 22
21.11.2021 18:42:22 cpu: 40.0, hdd: 22
21.11.2021 18:43:22 cpu: 40.0, hdd: 22
21.11.2021 18:44:22 cpu: 50.0, hdd: 22
21.11.2021 18:44:22 TEST100
21.11.2021 18:45:22 cpu: 20.0, hdd: 22
21.11.2021 18:45:22 TEST50
21.11.2021 18:46:22 cpu: 46.0, hdd: 22
21.11.2021 18:46:22 TEST75
21.11.2021 18:47:22 cpu: 1.0, hdd: 22
21.11.2021 18:47:22 TEST50
So it looks like it can not run under 50% only for 50, 75 or 100%
But in 100% for me is slow I can’t feel fresh wind behind the fan.
I have old fan from RPi3 but it hasn’t PWM it is much faster and make much more noise but it not interested me because it is in garage