Author Topic: Read more FAN  (Read 589 times)

0 Members and 1 Guest are viewing this topic.

Offline KKKTopic starter

  • Newbie
  • Posts: 5
  • Country: it
Read more FAN
« on: April 08, 2024, 11:23:42 am »
I am carrying out a project involving the reading of 16 fans by exploiting the interrupts of an MCU, which unfortunately, are never enough.  |O |O
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?
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12871
Re: Read more FAN
« Reply #1 on: April 08, 2024, 12:22:11 pm »
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 4x EMC2305, 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.
« Last Edit: April 11, 2024, 01:23:39 am by Ian.M »
 
The following users thanked this post: KKK

Online BennoG

  • Regular Contributor
  • *
  • Posts: 72
  • Country: nl
Re: Read more FAN
« Reply #2 on: April 08, 2024, 12:35:23 pm »
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

 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5039
  • Country: ro
  • .
Re: Read more FAN
« Reply #3 on: April 08, 2024, 12:44:49 pm »
I am carrying out a project involving the reading of 16 fans by exploiting the interrupts of an MCU, which unfortunately, are never enough.  |O |O
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?

The 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.
 
The following users thanked this post: KKK

Offline KKKTopic starter

  • Newbie
  • Posts: 5
  • Country: it
Re: Read more FAN
« Reply #4 on: April 08, 2024, 01:09:25 pm »
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

I 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.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12871
Re: Read more FAN
« Reply #5 on: April 08, 2024, 01:38:26 pm »
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. 
 

Online BennoG

  • Regular Contributor
  • *
  • Posts: 72
  • Country: nl
Re: Read more FAN
« Reply #6 on: April 08, 2024, 02:43:21 pm »
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
 

Online CaptDon

  • Super Contributor
  • ***
  • Posts: 1752
  • Country: is
Re: Read more FAN
« Reply #7 on: April 08, 2024, 02:57:41 pm »
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.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5941
  • Country: es
Re: Read more FAN
« Reply #8 on: April 08, 2024, 03:00:23 pm »
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).
« Last Edit: April 08, 2024, 03:02:37 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline xvr

  • Regular Contributor
  • *
  • Posts: 183
  • Country: ie
    • LinkedIn
Re: Read more FAN
« Reply #9 on: April 08, 2024, 04:58:19 pm »
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.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5941
  • Country: es
Re: Read more FAN
« Reply #10 on: April 08, 2024, 07:19:54 pm »
I'd use port change interrupt for this.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6281
  • Country: fi
    • My home page and email address
Re: Read more FAN
« Reply #11 on: April 09, 2024, 04:42:11 am »
I'd use a Teensy 4.0 with NXP NX138AKR N-channel MOSFETs:
 

Offline MarkT

  • Frequent Contributor
  • **
  • Posts: 375
  • Country: gb
Re: Read more FAN
« Reply #12 on: April 09, 2024, 10:09:56 pm »

The 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...


16 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 8), so on that architecture you'd be able to do it, even at a lowly 16MHz clock speed.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf