PC Fans: Difference between revisions
| 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) | 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). | ||