Upgrading PC Cooling With Software

As computing power increases with each new iteration of processors, actual power consumption tends to increase as well. All that waste heat has to go somewhere, and while plenty of us are content to add fans and heat sinks for a passable air-cooled system there are others who prefer a liquid cooling solution of some sort. [Cal] uses a liquid cooler on his system, but when he upgraded his AMD chip to one with double the number of cores he noticed the cooling fans on the radiator were ramping quickly and often. To solve this problem he turned to Python instead of building a new cooling system.

The reason for the rapid and frequent fan cycling was that the only trigger for the cooling fans available on his particular motherboard is CPU temperature. For an air cooled system this might be fine, but a water cooled system with much more thermal mass should be better able to absorb these quick changes in CPU temperature without constantly adjusting fan speed. Using a python script set up to run as a systemd service, the control loop monitors not only the CPU temperature but also the case temperature and the temperature of the coolant, and then preferentially tries to dump heat from the CPU into the thermal mass of the water cooler before much ramping of cooling fans happens.

An additional improvement here is that the fans can run at a much lower speed, reducing dust in the computer case and also reducing noise compared to before the optimizations. The computer now reportedly runs almost silently unless it has been under load for several minutes. The script is specific to this setup but easily could be modified for other computers using liquid cooling, and using Grafana to monitor the changes can easily be done as [Cal] also demonstrates when calibrating and testing the system. On the other hand, if you prefer a more flashy cooling system as a living room centerpiece, we have you covered there as well.

21 thoughts on “Upgrading PC Cooling With Software

    1. LOL. Please. Its a 5950X, not a 10 year old atom. The overhead savings is minimal and using python for this task likely has zero real world measurable impact.

      C when speed matters (I use it for RF stuff) python for ease of use and simple/not speed sensitive stuff. By speed sensitive I mean microsecond resolution.

        1. Its more than run time that comes into play. You have to look at what happens in hardware. Pyrhon is incredibly bloated compared to a staticly linked small C program. Cache fills, memory accesses, and TLB misses use power. There is a lot of those running an interpreter not to mention loading lots of libraries. Also anything spiled from caches has to be refilled when your script is done.

      1. heh, i found two things about this response a little amusing.

        first, a 10 year old atom is a fantastically fast cpu. if your *fan controller* benefits in any way from the last decade of cpu development, you’ve got a problem.

        second, python is just so good at being shockingly inefficient. so, here’s the scenario i can imagine…what if it starts up a new instance of the python interpretter every second, maybe because it has to do it to call back to the fan controller? ‘time python -c exit()’ is tolerably fast but imagine if it has to load up a bloated (iow, “pythoned”) library each time? then you could very easily use up a measurable fraction of one of your cores, and that would be a travesty.

        the ugly side of a lot of modern / convenience programming methods is that the inefficiencies *compound*. python may be “only” 100x slower than C, but if your code itself is 10x slower, and then you endure its startup overhead repeatedly *within a component that is already itself bloated and slow*, you can very easily come up with something 1,000,000 times slower than it needs to be.

        the funny thing is, even 1,000,000 times too slow hardly matters given today’s cpu performance!

        personally, i would probably insist on writing it in C for a more critical reason: reliability. python is nothing if not a dependency nightmare, so one day i’d be running ‘apt install’ and the fan controller would go awol and i wouldn’t notice until i did. otoh, i don’t have any interest in liquid cooling or performance cpus…my experience violates the premise of the article, my newer more powerful CPUs run cooler than their predecessors! people who drive sports cars are generally tolerant of the fact that they break easily.

        1. >i would probably insist on writing it in C for a more critical reason: reliability.

          I would simply put a PTC/NTC sensor in the coolant loop and control the fans directly in hardware. If you have to load an operating system to turn your system cooling fans on, you’re already failing really hard in reliability engineering.

    2. I prefer C overall, hate the whitespace python insists on being formatted with… but if Python works for this task, then it WORKS FOR THIS TASK. Any perceived inferiority of python then becomes irrelevant, IT WORKS, end of story.

  1. a neat project…i have some thoughts…

    i can’t believe this is necessary. wouldn’t everyone who sells a liquid cooling kit include a liquid-temperature-driven fan control module as part of the kit???

    i think it’s neat to imagine using the fan as part of a PID loop to keep the temperature of the liquid near a set point!

    i’m skeptical of running the fan below spec. without running experiments, my intuition is that it might heat up and not last as long running like that. especially if, as it ages, it spends a long time stalled in the low-speed condition. but otoh i suspect if you’re playing with liquid cooling already then probably you don’t care about fan longevity particularly.

    1. I’m a little surprised that it is necessary just because even ordinary air coolers have decent bit of thermal mass to them; so PWM curves that are downright obnoxious for an AIO would still be on the twitchy side regardless.

      It’s a lot less surprising that you don’t necessarily get a fan controller with an AIO. Using the PWM fan headers that the motherboard already has typically works fine; and a fan controller means that you need another power connector and suffer either on price competitiveness or margin.

      You can certainly get coolers that have them; but it’s hardly a requirement for minimum viability.

      1. There are cooling fans, such as the ARCTIC F12 TC that have temperature sensors and automatically ramp the speed up from mix to max between 30 – 40 C. The sensor is on a cable, so if you stick that onto your AIO’s radiator inlet, it just works automatically. You leave it on full and it does its thing.

        1. The fan controller however usually throttles one fan based on CPU temp, another fan by case temp etc. so if you have dual fans on your radiator then only one will be controlled by the remote sensor while the other runs up and down based on CPU load.

          The AIO can only do what it can to keep the water temperature low, and the CPU or GPU will stabilize to whatever temperature they get on that coolant temperature, so it’s better if both fans have a single controller with both fans running at medium speed instead of one running on full and the other on idle.

          1. I’ve not been buying external fan controllers or remote coolant sensors so I can’t speak to them, but the onboard control of every motherboard I remember for the last several years has not limited you to only one fan being controlled per sensor. They’ve also all had at least two connectors that default to CPU and two that default to case temp without changing settings. Am I misunderstanding?

  2. Can do one better: give it enough surface area and ditch the fans entirely. I have a 7900x that never goes over ambient+30 with no fans, and the same loop also does the GPU.

    Can’t say I would recommend this route though, changing GPU’s means a search for a new block, any upgrade means 50% of the time is spent working around the water, the setup requires 2 people to move, and given that industry has settled on using quite noble metals it’s not a cheap hobby. Air cooling has gotten good enough for water cooling not to be justifiable for silence.

  3. Baffled. My mobo has 3 fan connectors and the BIOS allows me to set temps and fan speeds. Afterburner controls the RTX. Simply test the lowest RPM for the heat to stop rising above your chip’s max temp then play with the ramp. My cpu cooling system er is never heard, my mobo fans are just noticeable and my RTX is noticeable but not “jet thruster” when benchmarking or gaming.

  4. How about do it in hardware?
    A pump that runs at two or more speeds and a fan (or more), both controlled by a temperature sensor mounted on the radiator’s exit.
    The pump would normally run on low speed with the fans off or at low speed. If the coolant’s temperature increases above a certain threshold, ramp up both the pump and the fans.
    Simple as that! Given the rather static thermal properties of all the substances involved, plotting a graph CPU-coolant temperatures dependencies is pretty easy, if not trivial.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.