RPM reading for 4 computer fans at Leonardo

Hello, I am working at project of digital speed fan controller with LM2596 power switching converters. I would like to control and measure 4 computer fans channels.

In this project I would like to use 4 pwm outputs (Timer 1 and Timer 3) with 8 bit Fast PWM Mode at prescaller equal 1 ~62kHz (or something lower but not basic 1kHz or 490Hz, maybe about 25kHz to use this signal to control 4 wire fans - I don't know exactly yet). Also I would like to measure RPM of this fan channel. I found informations about Interrupt channels at Leonardo. I could have external interrupts at pins: 3, 2, 0, 1, 7. I've decided to use pins 2,0,1,7. In future I would like to use pin 3 maybe as PWM output if it is possible.

I am looking for some explanation how to do this in proper way. When I am using external interrupts could I change PWM frequency without harm for reading interrupts? Could somebody propose a way of reading this RPM in code or explain how to count RPM? I have little problem with understand it how it works.

Cheers!

F5,

I think I catch it but I don't have answer for my other questions.

I would like count rpm of 4 fans. Fans can speed up to about 4k rpm. So I could have 32k interrupts per minute. (2 interrupts per rotate)

Please answer my questions: 1. 32k interrupts per minute in my program could make problems? In my program I have serial communication and reading of analog thermistors. 2. What timers and interrupts have in common? 3. Interrupt made by one fan could make problem with in speed count of another fan? 4. Could I use pin 3 in PWM mode when other four pins are external interrupts? 5. What happens when 2 or more interrupts occur in the same moment? 6. Should I stop all interrupts when calculating rpm speed of one channel or only channel which speed I count in this moment?

Cheers!

Hi, the fans are 4wire I understand, they are two power supply wires and a tacho feedback wire and a speed input wire.

Check the spec of the fans and see what is needed to control the speed via the input wire.

You cannot control the speed of these fans by PWM control of the power supply.

What is the part number of the fan.

Tom.... :)

Nope, topic is about interrupts and rpm reading. In my project I will control speed of fans by voltage - not by PWM signal.