I have been wondering about this project and how to control my 4 pin PWM fans. I had 5 laying around and thought mine as well give it a shot. The frequency values can be adjusted between 125 HZ -- 8 MHZ as well as a variable duty cycle. The circuit utilizes the mode 10 PWM phase-correct on timer 1 OCR1A (Pin 9) and ICR1 (Pin 10). Some debugging was needed to figure out this and I do own a handheld oscilloscope. It makes seeing the frequencies and duty cycles much easier and no guessing is involved. Here's the link: The Oscilloscope.
I do strongly advise you look up the datasheet for your fan as the control pin in my case was yellow (Which is normally referred as tach wire). Be sure to also find the acceptable frequency range (OR "CENTERING FREQUENCY") for your chosen fan. You may need to change the code frequency to adjust to your needs. Finally you will need a good power supply (Mine is a converted ATX PSU from an old PC).
NOTE: I have attempted using another timer and controlling 2 fans independently. It doesn't work. The reason for this is the resolution of the 2nd timer is lower (16 bit vs 8 bit). This means steps in frequency and duty adjustments are noisy and the waveforms are more and more deformed. This also is not as straightforward when entering values.
Code can be found below and here:
- https://github.com/T-622/25KHz-Arduino-Fan-PWM-Control
Clone with:
- https://github.com/T-622/25KHz-Arduino-Fan-PWM-Control.git
Comments