Hardware to build a rather advanced fan controller


I was hoping to get some help building a rather advanced fan controller for an acoustics project. This controller will set the speed for 4 different fans (independant speed control) by sending a PWM signal at 90 Hz to the fans (each fan has an internal controller that controls the speed base on duty cycle). this means i will have to mess with the timers (something I have never done before) by using the pwm frequency library.

The controller also needs to communicate with a CAN chip as the fan speed values will be sent to the controller through a CAN bus. This CAN controller will communicate with other Microcontrollers through SPI.

In addition to this the controller will feature 4 encoders and a small OLED display in case the users prefers to manually control the fans.

The problem is I don´t know that hardware setup to use. I would prefer to stay with an arduino mega and/or multiple arduino UNOs to ensure compatibility with the pwm frequency library. My concerns are that there might not be enough ports and timers for one UNO to handle all of this, and I wonder if the best setup would be to get a mega or to use one arduino UNO for the encoders, display and CAN and have another UNO just handling the PWM output while recieving the values from the first UNO over I2C.

Any advise would be greatly appreciated!

90Hz is quite slow for an MCU. At the most basic, you could easily create your own PWM in the loop() for all 4 fans without using a timer. For example, 5.5 mS on and 5.5 mS off is a duty cycle of 50% at (approx.) 90Hz.
I'd consider though using a single timer say running at 900Hz (or more depending on the required control granularity) and manage the on/off periods for the individual fans in the timer interrupt service routine (ISR) to achieve the necessary duty cycle.

I don't think that an Uno has more than three timers. On the other hand, at 90 Hz you could do this yourself using software. However, if you really meant 90 KHz, then it gets harder.

Thanks for the advise 6v6gt, making a manual PWM signal is definately doable, but it feels like this would compromise on the programs precision (these fans are really picky about frequency) and I also want to be able to use the controller for other pwm application where a greater frequency would be required, so maybe it would be better to go with an Arduino Mega, that has more timers. My plan is to use the mega to drive the PWM outputs using timers 1,3,4 and 5, while sending the values over I2C to the mega. What I dont understant is what timer I2C uses on the mega, as I don´t want the timer used for the pwm to interfere with the I2C bus.

It would be good to make a rough schematic of the components and protocols for this entire system.
I guess you could use the Mega for everything including the 4 PWM channels, reading the 4 rotary encoders and driving the oled display. The mega would be an SPI slave of the device with the canbus interface. If you choose to offload the rotary encoders to the to a Uno as you have suggested, then the Mega would also be an I2C slave of the Uno. The serial communications peripherals (SPI, I2C etc ) have their own dedicated hardware so do not consume a timer. Usually, it is timer0 which is used for millis() etc. so is more complicated to use for other purposes.