Controlling the fan speed and detecting the inside temperature of the pc with python?

若如初见. 提交于 2019-12-19 18:31:19

问题


Since my pc's fan is very loud, I'd like to make myself a program to "shut it up" when it's not required to be running at full speed. I want to make it with python, so is there any module that can detect the temperature and/or set the fan speed?


回答1:


You might be able to do it in WMI. There's a related question here.




回答2:


Don't use python, or WMI.

If you have Windows, and if you can't use speedfan, this is best done in the BIOS layer, with Microsoft's ASL Compiler. Using that, you can set temp thresholds for various fan speeds. It works nicely. Be careful though. This will void your warranty and for good reason. Using this tool incorrectly or carelessly, you could set your fan to never turn on, which would cook your components straightaway. So read up on it and get a temperature monitor (software app) before using this tool.

I had this problem on my laptop, waaay too much heat. After investigating, it turns out a major culprit was the graphics chip, which was set to ALWAYS be on, with the default Windows Vista driver install. It wasn't the CPU that was generating the heat. It was the GPU. Apparently it was set this way to support the Aero graphics. So in addition to doing the ASL temp/fan speed thing, I turned down the GPU. Also I turned down the clock speed, because silence and cool temps are more important to me than potential CPU speed.

This super user post describes the problem & the solutions I used in more detail.




回答3:


I have found something that at least can be interesting. It does not control de fan "direclty" it controls de CPU Temperature to that the fan depends to. I use it for cleaning purposes. I just run this code, and with air dust cleaner it is possible to clean the fan.

import multiprocessing

def worker():
    """worker function"""
    print ('Worker')
    k = []

    # of course in an infinite loop
    while True:
        # lets use the cpu mathematical power, to increse its temp
        l = (2*33) >> 3 
        # it is also possible to consume memory..
        # but it will crash windows 8.1 after a while
        # k.append(l)
        pass
    return

if __name__ == '__main__':
    jobs = []

    cpu = multiprocessing.cpu_count()
    print("CPU count=" + str(cpu))
    for i in range(cpu):
        p = multiprocessing.Process(target=worker)
        jobs.append(p)
        p.start()

But, do not uncomment the memory part, it will crash your PC. This is using python 3.5 version on an i7 8core logical cpu PC



来源:https://stackoverflow.com/questions/2479558/controlling-the-fan-speed-and-detecting-the-inside-temperature-of-the-pc-with-py

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!