I am trying to build a fan controller for my pc, the problem is that the example code(http://playground.arduino.cc/Main/ReadingRPM) im using utilizes interrupts. On my uno I can then only read the rpm of one fan. I want to also control the rpm (via pwm) and monitor temperatures (via thermistors) Anyone know how I coud do it differently? I. E. Without interrupts. I would also like it to be as close to real time as possible
-
1It may help to add some more detail. Do you just want to monitor the fans, or control them also? What is your desired outcome? How many fans? What RPM range? The more detail the better, as it makes the question more interesting and useful.– jlbnjmnCommented Jun 12, 2014 at 23:48
-
1@jlbnjmn I want to monitor and control them and temperatures from thermistors– NathanJCommented Jun 13, 2014 at 0:43
2 Answers
If temperature regulation is what you seek, why bother with the Tachometer signal at all?
Thermistors don't require interrupts. Why do you need fully closed loop fan control? A simple proportional control of each fan and each hot item would likely suffice in keeping your system cool. Noise concerns, perhaps?
A brief article on proportional temperature control
A data sheet on a TI chip that may have some inspiration for you
-
I'm wanting to use this on my pc so it's got to be quiet. And with monitoring rpm I can set up a fan failure alarm and other things.– NathanJCommented Jun 14, 2014 at 15:34
-
Looking at that chip, it looks like it'll do exactly what I'm wanting. Am I mistaken or does it also have an i2c interface? Does that mean I could just read the values off of it?– NathanJCommented Jun 16, 2014 at 20:18
If you only want 2 fans, the uno has 2 external interrupts, so you can use the same strategy as your example, just make another interrupt function for fan 2 and attach it on interrupt 1 instead of 0. the fan should be plugged in to pin 3 in this case. On a leonardo, you could have 5 fans on interrupts, and a mega has 6 external interrupts. See http://arduino.cc/en/Reference/attachInterrupt
If you need more than what your hardware can support, I would look into using a timed interrupt to check all the fans. If you find the minimum amount of time in-between reads to read your fans at max RPM and then use a timer interrupt to check some pins at that interval, you can probably read as many as you need, provided the interrupt routine stays fast enough. the function
attachInterrupt(function, period);
from the libraries on this page : http://playground.arduino.cc/Code/Timer1 should help you out with this.