Monitoring 4 wire fans
2011-10-11 by Philippe Habib
I have a bunch of 4 wire fans to monitor. These are fans that take a PWM input for speed, and have a tach output in the form of a square wave with a frequency proportional to speed. A stopped fan puts out a constant low. At low speed, the period is about 80ms, at full speed, about 9ms. The tachs are connected to general purpose I/O so I can't just set a counter going to determine frequency and check up every so often. To monitor them my first thought was going to wait until the signal level changed (or 50ms) and then wait for the signal level to change again (or 50ms) and figure if it changed twice the fan is turning. Worst case that would take me about 40ms, with an average wait of 20ms. Next idea was to read the input and figure any high means the fan is turning, then if the fan is low, wait up to 50ms for a high before declaring the fan dead. Worst case is still 40ms, but the average wait drops because I only need the first wait 1/2 the time. I don't need to monitor them very often. Once a minute is plenty. What are some other ways I can monitor these things with minimal overhead?