MSI shipped a genuinely good motherboard and forgot to wire one chip, so PWM doesn't work. Instead of tossing the board or living with the noise, I decided to make lemonade.
An Arduino Nano generates the 25kHz PWM signal, and a companion Windows application reads CPU temp and sends the duty cycle over serial. The Arduino firmware is open source (MIT).
That might work for the PWM signal, however you'd still need some electronics as the fan has internal pull-up to 5V and expects it to be pulled low by the PWM signal.
But a small circuit with a Schmitt-trigger inverter IC and some resistors and capacitors might do the trick, for example.
If windows crashes, then the audio generation crashes, so the fan will start to operate without PWM. Should default to 100%. At least that's how the PWM fans I have behave when the PWM signal suddenly disappears.
We don't live in the AMD Athlon era[0] anymore. Modern CPUs are designed to boost until they hit a thermal limit, improper cooling is just going to result in a lower clock speed.
Ironic, the day after the launch of Artemis II that people are using microcontrollers far more powerful than the original Apollo 11 navigation computer to control a single fan in their PCs now.
One could go farther and complain that it's a waste of a microcontroller at all to control a fan when an analog circuit for fan speed vs temperature would work fine.
True, a very simple analog circuit would be enough.
However the bane of analog circuits was that they age, so a control circuit that works perfectly today will drift and no longer work as intended after some years.
The second problem is that analog circuits need adjustments to set them at the exact desired parameters.
Adjustments can be done either by using an adjustable element in the circuit, e.g. an adjustable resistor or capacitor or inductor, or by measuring many resistors and/or capacitors and/or inductors and selecting the ones with the right values to be used by your device.
Redoing periodically the adjustments also solves the aging problem. However, both the initial adjustment and any periodic readjustments need a lot of work, so they are no longer acceptable in the industry.
When doing something for yourself, you may make an analog controller and the initial adjustment would not be a problem, but even in this case it would be annoying to keep track and remember something like having to readjust a fan controller every 6 months, to be sure that it still works as intended.
You're over thinking it. If the application is very simple and needs to do one thing, an analog system works fine. Once you start needing sequencing, multiple adjustments, and maybe a little smarts then a CPU can get involved.
I worked at a shop that had an old closed loop water-air chiller for a laser. The water temperature controller was a small PCB with an op-amp chip with some passives and the temperature was set by a potentiometer. That thing ran fine until the compressor died and it sent to scrap.
My analog fan control comment was a bit tongue-in-cheek, but turning a knob on a potentiometer to adjust fan speed has some personal appeal - no digging around for a sw utility, no poking interfaces to see if the motherboard mfr bios exposed the control, of if it exposed it but doesn't actually hook the right plug, no adjusting to see if the right temp input is reading correctly. Fewer layers of things to go wrong can be so nice.
I bet you can. But you can't turn a simple single linear amplifier into a PID controller with zero physical changes, can you?
My point was that, if you want additional behavior, you need to bake that in from the start. With an MCU you can trivially switch it in-the-field to literally anything you can imagine.
Yup. You could use a quad opamp to build a PWM controller with closed loop control but then you need all the passives to setup the oscillator and so on.
I went through this years ago making a fan driver for my vehicles HVAC blower. The analog setup was fun to make but you use more board space, higher BOM count, and really, higher BOM cost vs a micro-controller.
It's crazy how far technology has advanced. A μc with RAM and a bunch of input and output ports and some code is cheaper today than a pile of analog components.
I am not controlling a single fan though.
It's wired to a fan hub, so the PWM signal is sent to all the fans in the system.
I also wrote a companion windows application that reads CPU temps using PawnIO or HWiNFO which follow a curve that the user sets, and it sends the proper duty cycle to the arduino.
It's not just a dumb fan controller that I could've bought off aliexpress.
>This board has a Fintek F71878AD, a perfectly capable Super IO controller that can read temperatures, control fan PWM, and monitor fan speeds, but MSI just didn't connect it to the board.
is not true. There is a diagram available for this mobo and U32 (F71889AD) is connected over LPC (modern serial ISA version). Its a full Super IO and it cant be _not connected_ as it also provides keyboard/mouse, serial and printer ports.
The problem must lie elsewhere, most likely bad BIOS.
>Here's what I knew:
> Windows can read CPU temperature directly from the CPU's internal thermal diode, completely bypassing the useless Super IO chip.
why not read temperature directly from Fintek using HwInfo?
Yeah I was going to say that the presence of a PS/2 port almost certainly means it has a SuperI/O chip wired up. You wouldn't be able to shutdown the PC without the LPC bus talking to the SuperI/O. MSI just didn't write code to talk to the fan controller or just didn't bother with displaying it in the BIOS config page.
There are multiple pictures of msi 970 master bios displaying temps and fans just fine so it did work at some point in time. Author either updated to some poorly validated bugfix only/beta bios, or maybe wrong bios for the board.
And I've tried a couple of versions available there.
I was even able to find some beta/unreleased bioses that I've also tested.
Unfortunately, none of them enable fan control or fix temp & fan speed monitoring.
> Its a full Super IO and it cant be _not connected_ as it also provides keyboard/mouse, serial and printer ports.
Maybe the ps/2 port and serial/parallel ports also don't work? Lots of people use USB for human inputs, and few people use serial/parallel ports, so I wouldn't expect OP to have tested those ports.
They probably work on most boards, just like the PWM probably works on most boards. But his board seems to have a broken trace or a faulty chip.
I can show you a HWiNFO screenshot of it not reading anything off the SuperIO except Chassis Intrusion: https://imgur.com/a/dYPETWz
The only way I can get a temperature reading is off the CPU probe directly, which I am already making use of. As the article covers in later parts, I'm using HWiNFO and/or PawnIO to do exactly what you say (reading off the CPU probe sensor) and feed it into a fan curve, which then sends the appropriate duty cycle to the arduino.
In the BIOS there's no temperature reading, no fan speed display, and no PWM control whatsoever.
So maybe MSI did wire up the SuperIO, I can't say for sure, but they definitely didn't wire up something, otherwise the BIOS could at least control the fans or see their RPM.
And I've also tried with multiple BIOS versions, so it can't be BIOS related.
Some people online had working sensors on their MSI 970 boards, some didn't, leading me to believe it must've been a defective batch where they forgot something.
I assumed LLM gave you or validate the idea one of the biggest mobo manufacturers on the planet didnt wire temp/fan control on their flagship Gaming board?
Only one pin comes to mind that would break all temp sensors, fans and Voltage monitoring but not ps2/serial/lpt, that pin is 88 analog ground.
>HWiNFO screenshot of it not reading anything
HWiNFO has this "feature" that makes it hide sensors reporting maximum/minimum possible values. HWiNFO considers such readings sign of a missing/broken sensor. Broken analog ground pin on your motherboard would make all those sensors return bad value.
> Think I could wire pin 88 to ground and basically fix it?
I think you could check if the pin is reliably connected to ground.
Did you buy this board already broken? Its also possible someone connecting Fans shorted 12V to Fintek FAN tacho input (two middle pins on 4 pin connector) frying all ADC inputs, in that case only replacement chip would work.
Honestly I have no idea what this board has been through before getting to me. It had the PWM/Temp/RPM issue from the moment I got it. Maybe someone did break the chip. I'm gonna look up that diagram and try to see if the pin is connected to ground
Glad you shared this. I ran into something similar when I tried using a Pico W as a USB HID device, hardware was up to the task, but the firmware just wouldn’t let me get where I wanted..
Using Arduino and serial is a smart way to go here. Still, it’s worth remembering: the Pico W has built-in WiFi, so you don’t have to lean on serial if you don’t want to. You could have your temp-reading app send control signals over HTTP instead. No need to tie up the USB port, and the connection isn’t killed if someone yanks the cable.
And yes, big agreement on the watchdog or failsafe. Any fan controller that doesn’t ramp up to 100% if it loses connection is just waiting for trouble. Fire risk is real.
I've built 4 different fan controllers for my companies' embedded board so far.
We work in very hot greenhouses, so fans (and peltiers) are essential. And proper thermal sensors. I check 4 different ones. Esp. needed is also a humidity sensor, because we don't want it to cool down below the dew point.
Peltiers have a lifetime measured in cycles, cycling from active (maximum delta Temp) to inactive (both sides ambient). After 1-2k cycles, Peltiers gradually lose efficiency and transition from a heat pump to a hot plate. For this reason I've avoided them in my own permanent installations. Have you encountered this?
This looks really good! I am trying to do the same thing for cooling 11th gen Intel laptop motherboards with micro RP2050 board but came to the conclusion that I should just do it with ESP32 as mine has some limitations.
Would you mind sharing more technical review of what you created?
RP2050 would work, as it also has the necessary built-in peripherals. ESP32 would add wifi and better ESPHome support. I suggest you stay away from the ESP8266, as it needs to do PWM in software and struggles with the 25kHz output frequency.
From my experience: ESP32/RP2040 work without additional circuitry which works with most fans, but for protection, you want to add level shifters. Not all fans pull up the PWM pin to 3.3V, the spec allows for 5V.
Shameless plug, hopefully this is allowed here.
I built something like that, that allows fan control via WiFi. First I built it only for myself, but since the spare boards from PCBA quickly sold, I decided to keep it stocked.
Short gist: 12V Input, ESP32S2, ESPHome-based. Has 4 PWM-fan outputs, onboard temperature & humidity sensor and Qwiic expansion port.
If you want to build it by yourself, the schematic is in the hardware folder. And if you don't want to use ESPHome - there is no firmware lock, you find the pin assignment on the product page and can write your own firmware if you so desire.
MSI shipped a genuinely good motherboard and forgot to wire one chip, so PWM doesn't work. Instead of tossing the board or living with the noise, I decided to make lemonade.
An Arduino Nano generates the 25kHz PWM signal, and a companion Windows application reads CPU temp and sends the duty cycle over serial. The Arduino firmware is open source (MIT).
Could you use an audio out port for creating the signal and ditch the Arduino?
That might work for the PWM signal, however you'd still need some electronics as the fan has internal pull-up to 5V and expects it to be pulled low by the PWM signal.
But a small circuit with a Schmitt-trigger inverter IC and some resistors and capacitors might do the trick, for example.
Interesting idea, I'll look into it.
What if Windows crashes? It's better to attach a thermal sensor to the heatsink, I think.
Just send a heartbeat every few milliseconds and set fan speed to 100% if it died. Bonus: You get an audible indicator that the system crashed.
If windows crashes, then the audio generation crashes, so the fan will start to operate without PWM. Should default to 100%. At least that's how the PWM fans I have behave when the PWM signal suddenly disappears.
Well, what if?
We don't live in the AMD Athlon era[0] anymore. Modern CPUs are designed to boost until they hit a thermal limit, improper cooling is just going to result in a lower clock speed.
[0]: https://youtu.be/UoXRHexGIok?t=55
What a blast from the past. I still remember seeing it for the first time on my Socket A Athlon 1900+ pc.
Damn, that video took me waaay back.
Ironic, the day after the launch of Artemis II that people are using microcontrollers far more powerful than the original Apollo 11 navigation computer to control a single fan in their PCs now.
One could go farther and complain that it's a waste of a microcontroller at all to control a fan when an analog circuit for fan speed vs temperature would work fine.
True, a very simple analog circuit would be enough.
However the bane of analog circuits was that they age, so a control circuit that works perfectly today will drift and no longer work as intended after some years.
The second problem is that analog circuits need adjustments to set them at the exact desired parameters.
Adjustments can be done either by using an adjustable element in the circuit, e.g. an adjustable resistor or capacitor or inductor, or by measuring many resistors and/or capacitors and/or inductors and selecting the ones with the right values to be used by your device.
Redoing periodically the adjustments also solves the aging problem. However, both the initial adjustment and any periodic readjustments need a lot of work, so they are no longer acceptable in the industry.
When doing something for yourself, you may make an analog controller and the initial adjustment would not be a problem, but even in this case it would be annoying to keep track and remember something like having to readjust a fan controller every 6 months, to be sure that it still works as intended.
You're over thinking it. If the application is very simple and needs to do one thing, an analog system works fine. Once you start needing sequencing, multiple adjustments, and maybe a little smarts then a CPU can get involved.
I worked at a shop that had an old closed loop water-air chiller for a laser. The water temperature controller was a small PCB with an op-amp chip with some passives and the temperature was set by a potentiometer. That thing ran fine until the compressor died and it sent to scrap.
My analog fan control comment was a bit tongue-in-cheek, but turning a knob on a potentiometer to adjust fan speed has some personal appeal - no digging around for a sw utility, no poking interfaces to see if the motherboard mfr bios exposed the control, of if it exposed it but doesn't actually hook the right plug, no adjusting to see if the right temp input is reading correctly. Fewer layers of things to go wrong can be so nice.
Analog control circuitry is also really hard to patch in production, or to adjust to different behavior during design.
Oh, you need a quadratic fan curve instead of a linear one? Have fun starting from scratch!
You can definitely make a PID controller just with opamps and potentiometers.
I bet you can. But you can't turn a simple single linear amplifier into a PID controller with zero physical changes, can you?
My point was that, if you want additional behavior, you need to bake that in from the start. With an MCU you can trivially switch it in-the-field to literally anything you can imagine.
Nah, it's a much lower part count and much simpler to put a microcontroller in. If you're concerned about cost cheaper parts are available.
Yup. You could use a quad opamp to build a PWM controller with closed loop control but then you need all the passives to setup the oscillator and so on.
I went through this years ago making a fan driver for my vehicles HVAC blower. The analog setup was fun to make but you use more board space, higher BOM count, and really, higher BOM cost vs a micro-controller.
It's crazy how far technology has advanced. A μc with RAM and a bunch of input and output ports and some code is cheaper today than a pile of analog components.
I am not controlling a single fan though. It's wired to a fan hub, so the PWM signal is sent to all the fans in the system. I also wrote a companion windows application that reads CPU temps using PawnIO or HWiNFO which follow a curve that the user sets, and it sends the proper duty cycle to the arduino.
It's not just a dumb fan controller that I could've bought off aliexpress.
>This board has a Fintek F71878AD, a perfectly capable Super IO controller that can read temperatures, control fan PWM, and monitor fan speeds, but MSI just didn't connect it to the board.
is not true. There is a diagram available for this mobo and U32 (F71889AD) is connected over LPC (modern serial ISA version). Its a full Super IO and it cant be _not connected_ as it also provides keyboard/mouse, serial and printer ports.
The problem must lie elsewhere, most likely bad BIOS.
>Here's what I knew:
> Windows can read CPU temperature directly from the CPU's internal thermal diode, completely bypassing the useless Super IO chip.
why not read temperature directly from Fintek using HwInfo?
https://www.hwinfo.com/forum/threads/faulty-sensor-readings-... and yes it also works on 970 https://forum-en.msi.com/index.php?threads/msi-970-cpu-temps...
not to mention MSI Command Center can read those sensors AND set FAN speeds/curves, and most likely also SpeedFan.
> asked LLMs
LLM failed this person :(
Yeah I was going to say that the presence of a PS/2 port almost certainly means it has a SuperI/O chip wired up. You wouldn't be able to shutdown the PC without the LPC bus talking to the SuperI/O. MSI just didn't write code to talk to the fan controller or just didn't bother with displaying it in the BIOS config page.
There are multiple pictures of msi 970 master bios displaying temps and fans just fine so it did work at some point in time. Author either updated to some poorly validated bugfix only/beta bios, or maybe wrong bios for the board.
There's only one page for my board: https://www.msi.com/Motherboard/970-GAMING/support
And I've tried a couple of versions available there. I was even able to find some beta/unreleased bioses that I've also tested. Unfortunately, none of them enable fan control or fix temp & fan speed monitoring.
> Its a full Super IO and it cant be _not connected_ as it also provides keyboard/mouse, serial and printer ports.
Maybe the ps/2 port and serial/parallel ports also don't work? Lots of people use USB for human inputs, and few people use serial/parallel ports, so I wouldn't expect OP to have tested those ports.
They probably work on most boards, just like the PWM probably works on most boards. But his board seems to have a broken trace or a faulty chip.
Your hunch is correct, I did not test the PS/2, serial or parallel ports, and I'm only using USB.
Might be worth trying the ps/2 port, if you've got something that fits it.
Or loopback on the serial port; just have to enable it in BIOS, don't need a connector or a serial device.
Will do. Might be worth to look into it a little deeper.
Bios would error out after not being able to initialize PS2 controller.
Not sure how LLMs failed me, please elaborate.
Also not sure how you found that model number, it's literally an F71878AD, here's proof: https://www.modders-inc.com/wp-content/uploads/image/2015/02... Taken from here: https://www.modders-inc.com/msi-970-gaming-mobo/2/
I can show you a HWiNFO screenshot of it not reading anything off the SuperIO except Chassis Intrusion: https://imgur.com/a/dYPETWz
The only way I can get a temperature reading is off the CPU probe directly, which I am already making use of. As the article covers in later parts, I'm using HWiNFO and/or PawnIO to do exactly what you say (reading off the CPU probe sensor) and feed it into a fan curve, which then sends the appropriate duty cycle to the arduino.
In the BIOS there's no temperature reading, no fan speed display, and no PWM control whatsoever.
So maybe MSI did wire up the SuperIO, I can't say for sure, but they definitely didn't wire up something, otherwise the BIOS could at least control the fans or see their RPM.
And I've also tried with multiple BIOS versions, so it can't be BIOS related.
Some people online had working sensors on their MSI 970 boards, some didn't, leading me to believe it must've been a defective batch where they forgot something.
Image of an MSI 970 Gaming bios where temp and fans work properly: https://forum-en.msi.com/index.php?attachments/msi_snapshot_...
>how LLMs failed me
I assumed LLM gave you or validate the idea one of the biggest mobo manufacturers on the planet didnt wire temp/fan control on their flagship Gaming board?
>not sure how you found that model number
manufacturer diagram of MSI MS-7693 rev 2.0 (970 Gaming) https://www.elvikom.pl/viewtopic.php?lang=en&t=54275&p=21060...
> it's literally an F71878AD
rev 2 specifies F71889AD but Im pretty sure all Fintek F71868/869/870/878/882/889 are more or less compatible https://docs.kernel.org/hwmon/f71882fg.html https://www.linuxquestions.org/questions/linux-hardware-18/f...
rev 4.0 and up do list F71878AD https://www.scribd.com/document/961738196/MS-7693-Rev4-2 https://html.scribdassets.com/5xds0sz8hsgb4iux/images/27-e6d... diagram has all the fans and temp stuff wired up.
Only one pin comes to mind that would break all temp sensors, fans and Voltage monitoring but not ps2/serial/lpt, that pin is 88 analog ground.
>HWiNFO screenshot of it not reading anything
HWiNFO has this "feature" that makes it hide sensors reporting maximum/minimum possible values. HWiNFO considers such readings sign of a missing/broken sensor. Broken analog ground pin on your motherboard would make all those sensors return bad value.
Video of someone running hwinfo successfully on 970 gaming rev 4.x (F71878AD) https://www.youtube.com/watch?v=Wq50OuGC1ys
I see, I see. That's an impressive amount of digging you did. Thanks for that. Think I could wire pin 88 to ground and basically fix it?
Even if I do get it fully fixed, I think my project could be useful for motherboards that have thermal probes but no PWM.
Real talk though, I'd love to see this MSI board fully operational.
> Think I could wire pin 88 to ground and basically fix it?
I think you could check if the pin is reliably connected to ground.
Did you buy this board already broken? Its also possible someone connecting Fans shorted 12V to Fintek FAN tacho input (two middle pins on 4 pin connector) frying all ADC inputs, in that case only replacement chip would work.
>Did you buy this board already broken?
Honestly I have no idea what this board has been through before getting to me. It had the PWM/Temp/RPM issue from the moment I got it. Maybe someone did break the chip. I'm gonna look up that diagram and try to see if the pin is connected to ground
... but he had fun doing it!
Glad you shared this. I ran into something similar when I tried using a Pico W as a USB HID device, hardware was up to the task, but the firmware just wouldn’t let me get where I wanted..
Using Arduino and serial is a smart way to go here. Still, it’s worth remembering: the Pico W has built-in WiFi, so you don’t have to lean on serial if you don’t want to. You could have your temp-reading app send control signals over HTTP instead. No need to tie up the USB port, and the connection isn’t killed if someone yanks the cable.
And yes, big agreement on the watchdog or failsafe. Any fan controller that doesn’t ramp up to 100% if it loses connection is just waiting for trouble. Fire risk is real.
I've built 4 different fan controllers for my companies' embedded board so far.
We work in very hot greenhouses, so fans (and peltiers) are essential. And proper thermal sensors. I check 4 different ones. Esp. needed is also a humidity sensor, because we don't want it to cool down below the dew point.
It's PWM, controlled via mraa. mraa_pwm_write()
> peltiers) are essential
Peltiers have a lifetime measured in cycles, cycling from active (maximum delta Temp) to inactive (both sides ambient). After 1-2k cycles, Peltiers gradually lose efficiency and transition from a heat pump to a hot plate. For this reason I've avoided them in my own permanent installations. Have you encountered this?
Yes, peltiers only help a bit. And don't last long. Most of the heavy work is done by huge fans.
> peltiers
First time I've come across this technology. A solid-state heat pump? Magic!
https://en.wikipedia.org/wiki/Thermoelectric_heat_pump
This looks really good! I am trying to do the same thing for cooling 11th gen Intel laptop motherboards with micro RP2050 board but came to the conclusion that I should just do it with ESP32 as mine has some limitations.
Would you mind sharing more technical review of what you created?
RP2050 would work, as it also has the necessary built-in peripherals. ESP32 would add wifi and better ESPHome support. I suggest you stay away from the ESP8266, as it needs to do PWM in software and struggles with the 25kHz output frequency.
From my experience: ESP32/RP2040 work without additional circuitry which works with most fans, but for protection, you want to add level shifters. Not all fans pull up the PWM pin to 3.3V, the spec allows for 5V.
Shameless plug, hopefully this is allowed here.
I built something like that, that allows fan control via WiFi. First I built it only for myself, but since the spare boards from PCBA quickly sold, I decided to keep it stocked.
Short gist: 12V Input, ESP32S2, ESPHome-based. Has 4 PWM-fan outputs, onboard temperature & humidity sensor and Qwiic expansion port.
The ESPHome code & schematic is on Github: https://github.com/zeroflow/wifi-fancontroller
If you want one, it's available on Elecrow for $35,99: https://www.elecrow.com/wifi-fancontroller1.html
If you want to build it by yourself, the schematic is in the hardware folder. And if you don't want to use ESPHome - there is no firmware lock, you find the pin assignment on the product page and can write your own firmware if you so desire.