Read more FAN - Page 1
Forum section: electronics / beginners

author: Darlington
author_rank: Contributor
timestamp: April 08, 2024, 11:23:42 am
content: I am carrying out a project involving the reading of 16 fans by exploiting the interrupts of an MCU, which unfortunately, are never enough.I am seriously considering converting the digital tach output of each fan to analogue to eliminate all the processing that MCU has to do to handle all those interrupts.Is this a viable option in your opinion? My idea would be to exploit a single LM2907 as an IC combined with an analogue multiplexer to read all 16 inputs in one second.Is this possible?

author: Ian.M
author_rank: Super Contributor
timestamp: April 08, 2024, 12:22:11 pm
content: An intel compatible fan tacho signal is two pulses per rev. Given one second to read the fans, you have max. 1/16 of a second per fan. It can take up to half a rev to get the first pulse edge, then you need to time to the matching edge of the next pulse, so another half rev. Therefore the min fan speed you can measure digitally with a single multiplexed CCP input is 960 RPM (given 16 fans and a 1 Hz update rate). If your MCU has two CCP modules and you put an 8:1 mux in front of both, this reduces to 480 RPM.Your idea of using a single multiplexed LM2907 is not practical as it will certainly require far more than two pulses to settle to the new speed voltage so given the same 16 channels and 1 Hz update rate constraints, the min. fan speed it can read with any accuracy will be much higher.If you also need to control the fans, consider offloading the whole task to 4xEMC2305, Microchip's SMBUS/I2C five channel Intel 4 wire fan controller. See my comments here:https://www.eevblog.com/forum/projects/pc-fan-control-and-pwm/Edit:If instead of waiting for a particular edge, one uses the initial signal level to determine whether to wait for a rising or a falling edge, the first pulse edge may be acquired up to 50% faster, allowing up to 25% lower min. RPM to be measured in the available sampling time. This is dependent on the duty cycle of the tacho signal, 50% being the most advantageous.

author: BennoG
author_rank: Frequent Contributor
timestamp: April 08, 2024, 12:35:23 pm
content: You did not specify what kind of MCU, and what RPM the fans rotate.But using a single timer interrupt at 20kHz and in that interrupt read the inputs polling base the MCU can do this without any problems.I have done this in a $2 MCU at 100kHz for a encoder signal.So no interrupt per fan pulse but 1 timer interrupt to poll the IO.This will work without problems.Benno

author: mariush
author_rank: Super Contributor
timestamp: April 08, 2024, 12:44:49 pm
content: Quote from: KKK on April 08, 2024, 11:23:42 amThe tach signal from regular computer fans are 2 pulses per rotation, and if a fan spins at 1000 - 1500 rpm, you get 2000-3000 pulses a minute or 50 pulses a second or so ... with 16 fans, you probably don't have enough time to get into an interrupt , do something with the information, come out the interrupt and so on...Some other tricks you could do ... look at binary counters... let the tach signal just increase a counter in a chip, read the chip periodically, reset it ... repeat .. if you read every 50ms or so, your pulse count will be unlikely to be above 1000 pulses or so (5000 rpm x 2 pulses per rotation = 10k per minute or 166 pulses per second or 16 every 100 ms, or 8 every 50 ms or so ... even a 8 bit counter would be plenty.you could use parallel to serial shift registers and pull the values in one shot into your microcontroller, if you don't want to use analogue switches to switch between binary counter chips.EMC2305 is a solution indeed, but a bit expensive... considering you'd need 4 of them.

author: Darlington
author_rank: Contributor
timestamp: April 08, 2024, 01:09:25 pm
content: Quote from: BennoG on April 08, 2024, 12:35:23 pmI don't clear what you mean can you leave me some material or explain better what you mean?I'm using an AVR Atmega328 family MCU.

author: Ian.M
author_rank: Super Contributor
timestamp: April 08, 2024, 01:38:26 pm
content: Unfortunately the ATmega328P only has one input capture unit (see full datasheet section 20.9. Input Capture Unit). Therefore to see if my multiplexed capture input suggestion is viable, we need to know your min. fan speed. The max. fan speed would also be useful, and also the precision with which you need to read the RPM. Also please confirm your fans tacho output are two pulses per rev.If considering BennoG's suggestion, note that you loose port pins to stuff like the crystal, and if using an Arduino, to the UART RX and TX pins for comms to the host, so it isn't as simple as sampling two 8 bit ports and processing the result.

author: BennoG
author_rank: Frequent Contributor
timestamp: April 08, 2024, 02:43:21 pm
content: Yes you probably need to read 3 8bit ports and pick the correct bits from them and then increase the counters when the input changes

author: CaptDon
author_rank: Super Contributor
timestamp: April 08, 2024, 02:57:41 pm
content: You certainly can use the output pulses from the tach to generate an integrated analog voltage. A single diode feeding a capacitor and a bleeder resistor that can provide a sensible analog level at normal fan speed across the capacitor and then follow through with your 16 channel analog mux driving an analog A.D.C. pin of your MCU would work great. You can poll it whenever you want, no interrupts needed. The integrators will always be ready with a representative RPM vs. voltage output. You could even monitor the trends of fan spin-up time and variation trends among the fans possibly predicting the oncoming failure of a fan. Although it would require more parts, I would indeed use 1 stand alone integrator circuit with each fan, 16 total, as opposed to bringing the tach signal through a mux driving a single integrator. How often do you really need to know fan heath?? Wouldn't one to four times per minute be sufficient? With 16 individual integrators you could test as quickly as you could fully scan the mux but include the settling time also. With a single integrator you would probably need about .5 to 1 second per fan.

author: DavidAlfa
author_rank: Super Contributor
timestamp: April 08, 2024, 03:00:23 pm
content: 16 fans * 10K rpm (Pretty fast) is just 2600 IRQs per second, nothing crazy for a modern 48Mhz+ MCU like stm32 (Not a stinky 2001 Atmega).

author: xvr
author_rank: Frequent Contributor
timestamp: April 08, 2024, 04:58:19 pm
content: You can process ALL fans at once. Just attach them to input port (8 pcs per port for Atmega, or up to 32 for ARM) and read in timer interrupt. All further processing could be done in parallel on states of all 8/32 fan, just use whole word, not single bits.

author: DavidAlfa
author_rank: Super Contributor
timestamp: April 08, 2024, 07:19:54 pm
content: I'd use port change interrupt for this.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 09, 2024, 04:42:11 am
content: I'd use aTeensy 4.0with NXP NX138AKR N-channel MOSFETs:

author: MarkT
author_rank: Frequent Contributor
timestamp: April 09, 2024, 10:09:56 pm
content: Quote from: mariush on April 08, 2024, 12:44:49 pm16 fans times 50 pulses a second is only 800Hz, well within the capabilities of interrupts. On the ATmega328 you have pin-change interrupts that handle all 22 pins (in groups of, so on that architecture you'd be able to do it, even at a lowly 16MHz clock speed.