PC Fans: Difference between revisions

No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
* Noctua's [https://noctua.at/pub/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf PWM Specification White Paper] (unknown date, but it references 1.3 <i>ibid</i>)
* Noctua's [https://noctua.at/pub/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf PWM Specification White Paper] (unknown date, but it references 1.3 <i>ibid</i>)
Almost all available fans are either 5V, 12V, or 24V, with 12V dominating personal computers:
Almost all available fans are either 5V, 12V, or 24V, with 12V dominating personal computers:
* there is no readily-available 24V source from an [[ATX]] power supply, but you'll see 24V in e.g. [[3D printers]]
* there is no readily available 24V source from an [[ATX]] power supply, but you'll see 24V in e.g. [[3D printers]]
* 5V fans are seen in conjunction with MCUs such as [[Raspberry Pi]]
* 5V fans are seen in conjunction with MCUs such as [[Raspberry Pi]]
Fans operating at higher voltages will require less current for the same work. Two-pin fans offer neither feedback nor dedicated PWM control. Three-pin fans typically offer a tachometer signal on the third wire. Four-pin fans add a PWM control on the fourth wire. PWM is a <b>5V logical control</b> that does not modify supplied power. In the absence of PWM support, some control can be effected by varying voltage (voltage ought be held constant for a PWM fan), but since a minimum voltage is necessary to avoid stalling, only the higher-speed range is available. "Low-frequency PWM" applies PWM to the power wire itself, but suffers from audible commutation noise, and must apply pulse stretching to the tachometer.
Fans operating at higher voltages will require less current for the same work. Two-pin fans offer neither feedback nor dedicated PWM control. Three-pin fans typically offer a tachometer signal on the third wire. Four-pin fans add a PWM control on the fourth wire. PWM is a <b>5V logical control</b> that does not modify supplied power. In the absence of PWM support, some control can be effected by varying voltage (voltage ought be held constant for a PWM fan), but since a minimum voltage is necessary to avoid stalling, only the higher-speed range is available. "Low-frequency PWM" applies PWM to the power wire itself, but suffers from audible commutation noise, and must apply pulse stretching to the tachometer.
Line 130: Line 130:
** or, fed 3.3V: 680Ω (4.9mA)
** or, fed 3.3V: 680Ω (4.9mA)
* 24V: 3KΩ (6V, 2mA)
* 24V: 3KΩ (6V, 2mA)
Arduino 5V internal pullup resistors are several tens of thousands of ohms, so they can be used to simplify the circuit (on a 3.3V MCU, you'll need hook up the tachometers to at least a 5V V<sub>CC</sub>, so this won't help you there). You'll then want an RC circuit going to ground, yielding a [https://en.wikipedia.org/wiki/Low-pass_filter#RC_filter low-pass filter]. Given a time constant RC, a low-pass filter blocks signals over 1/2πRC. Pick something a fair amount above your expected frequency. Let's say your fan maxes out at 3000 RPM. That's 3000 / 60 = 50 RPS. The Hall sensor triggers twice per revolution so you're expecting 100 transitions per second. If you're using a 680Ω resistor on input, and want to pass signals below 500 Hz, a 470 nF capacitor will do the trick: 1/2πRC == 1/2π(.0003196) == 497.98 Hz. The tach will pull the signal low. It's best to detect this via hardware interrupts:
Arduino 5V internal pullup resistors are several tens of thousands of ohms, so they can be used to simplify the circuit (on a 3.3V MCU, you'll need hook up the tachometers to at least a 5V V<sub>CC</sub>, so this won't help you there). The tach will pull the signal low. It's best to detect this via hardware interrupts:
<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
static _Atomic(uint32_t) LowerFanPulses, UpperFanPulses;
static _Atomic(uint32_t) LowerFanPulses, UpperFanPulses;
Line 177: Line 177:
</syntaxhighlight>
</syntaxhighlight>
<tt>up</tt> and <tt>lp</tt> can then be used to calculate RPM. Remember to divide by 2 due to two pulses per revolution. The pin must be associated with some hardware interrupt.
<tt>up</tt> and <tt>lp</tt> can then be used to calculate RPM. Remember to divide by 2 due to two pulses per revolution. The pin must be associated with some hardware interrupt.
If there's noise contaminating the tachometer circuit, you might need to establish an RC circuit going to ground, yielding a [https://en.wikipedia.org/wiki/Low-pass_filter#RC_filter low-pass filter]. Given a time constant RC, a low-pass filter blocks signals over 1/2πRC. Pick something a fair amount above your expected frequency. Let's say your fan maxes out at 3000 RPM. That's 3000 / 60 = 50 RPS. The Hall sensor triggers twice per revolution so you're expecting 100 transitions per second. If you're using a 680Ω resistor on input, and want to pass signals below 500 Hz, a 470 nF capacitor will do the trick: 1/2πRC == 1/2π(.0003196) == 497.98 Hz. Note that this will make your transitions less sharp on the rising side, and only serves to reduce the voltage drastically when the frequency increases substantially. It's best to avoid their use.


A junction must propagate only one tachometer signal, i.e. if three fans are connected to a splitter, only one tach value is reported. Whether this is a maximum, or an average, or something else is undefined, but every junction I've ever seen, from passive splitters to active controllers, simply connects only one tachometer to the wire (controllers using a side channel in addition to the fan connector might of course report multiple tach signals, as does the [https://shop.aquacomputer.de/product_info.php?products_id=3832&language=en Aquacomputer OCTO] via USB).
A junction must propagate only one tachometer signal, i.e. if three fans are connected to a splitter, only one tach value is reported. Whether this is a maximum, or an average, or something else is undefined, but every junction I've ever seen, from passive splitters to active controllers, simply connects only one tachometer to the wire (controllers using a side channel in addition to the fan connector might of course report multiple tach signals, as does the [https://shop.aquacomputer.de/product_info.php?products_id=3832&language=en Aquacomputer OCTO] via USB).