9

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?

bmargulies
  • 97,814
  • 39
  • 186
  • 310
kettlepot
  • 10,574
  • 28
  • 71
  • 100
  • 7
    With your operating system being… Windows XP? OS X? AmigaOS? – Tadeusz A. Kadłubowski Mar 19 '10 at 18:09
  • 6
    I know this is contrary to the Python spirit (not to mention to the letter of the question), but is there some reason you wouldn't just install a free program like SpeedFan (http://www.almico.com/speedfan.php), and use that time for other exciting Py adventures? – harpo Mar 19 '10 at 18:11
  • 1
    Fan controller bugs notwithstanding, how do you know it's not required to be running at full speed? – DNS Mar 19 '10 at 18:55
  • Do you want to cook eggs on your laptop? More seriously, does anyone know if there is a real threat to letting a processor overheat (lets say in a laptop)? – Morlock Mar 19 '10 at 19:15
  • 1
    the problem is speedfan doesn't work on my computer (it crashes when i start it) and my fan does hell of a mess, while my pc is quite cold – kettlepot Mar 19 '10 at 22:53
  • @Morlock - yes, the threat is damage to the components. CPU heat , if not properly dissipated, will transmit throughout the machine, and most of the components are not designed to tolerate that heat. @terabytest, there are better options, besides a python app. – Cheeso Mar 23 '10 at 19:49
  • Mentioning what is your operating system, and adding such system as a tag, would help a lot in your question description. – Denilson Sá Maia Mar 29 '10 at 17:07
  • @Morlock: Greater heat equates to greater electrical resistance and distortion or even burning circuits. Very small cracks can form, expand and contract eventually breaking something and causing issues in the meantime. Occasionally doing house calls for dying computers, about 40% or more of the older models have gotten really dusty inside and start booting up super-slow, opening a browser can become a nightmare. These can often be drastically improved right away with a can of air to clear the dust and allow heat to escape. – That Realty Programmer Guy Mar 23 '11 at 08:57

3 Answers3

5

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.

Community
  • 1
  • 1
Cheeso
  • 189,189
  • 101
  • 473
  • 713
1

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

Community
  • 1
  • 1
Seth
  • 45,033
  • 10
  • 85
  • 120
-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

sanchezis
  • 429
  • 4
  • 9