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 te开发者_开发知识库mperature and/or set the fan speed?
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.
You might be able to do it in WMI. There's a related question here.
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
精彩评论