DeskPi-Team / deskpi

DeskPi Pro is the Ultimate Case Kit for Raspberry Pi 4 with Full Size HDMI/2.5 Hard Disk Support and Safe Power Button, It has QC 3.0 Power Supply inside and New ICE Tower Cooler inside.
GNU General Public License v3.0
144 stars 46 forks source link

Automatic Fan Control Stops Working #81

Closed RadJKW closed 2 years ago

RadJKW commented 2 years ago

Hardware/Software

Issue Details

How did i find the issue?

I leave my deskpi running throughout the week in my office. If i pay attention, i will notice that the deskpi is running at around 60c on idle ( just loaded into the desktop environment). It took me a minute, but i realized that 60 degrees was a little high with the type of cooler in the deskpi case.

Can i fix the issue?

I have not completely "FIXED" the issue. However, if i run the command deskpi-config and choose 7 - Cancel manual control and enable automatic fan control. Immediately after the fan kicks on and the temperature reaches about 48c.

Other

sven1601 commented 2 years ago

based on the good job done by @bartlet7827 , I further modified the python pwmControlFan-mcb04.py file to be able to log the fan mode changes in /home/pi/fan.log file. so you would be able to know the history of CPU temperature and mode changes for whatever purpose, get a bit more feeling of how your machine and fan works.

Note: if the fan mode hasn't been changed, it will not write any log, to keep log file small in size.

the log file will looks like this:

--------------------------------------------------------
2022-07-31 23:30:46, Deskpi Fan service started!
--------------------------------------------------------
2022-07-31 23:30:46, CPU Temp is 47°C, adjust fan to 25%
2022-07-31 23:30:51, CPU Temp is 50°C, adjust fan to 50%
2022-07-31 23:30:56, CPU Temp is 48°C, adjust fan to 25%

pwmControlFan-mcb04-log.py

Great work, unfortunately your code doesn't run directly for me. I get some python errors in all lines where 'cpu_temp' (int) is compared to the 'cpuTemp_config' array (string).

I've added some type casting for 'cpuTemp_config' to int, now it works flawlessly for me.

Unfortunately I had to attach the file as txt, because GitHub won’t let me use py files for some reason.

pwmControlFan-mcb04-log.txt

bartlet7827 commented 2 years ago

Hi @sven1601, thank you for pickup the bug. The issue is in line 23 where if the /etc/deskpi.conf file doesn't exist (which I'm assuming is your case), it creates a list of temperatures and fanspeeds. These values should be integers not strings. Your fix works fine. Alternatively, you can remove the quotes around the numbers in line 23.

yoyojacky commented 2 years ago

if you have lost /etc/deskpi.conf, you can just create it by using deskpi-config and navigate to 6 option, and setting the threshold as you will.