Library:

PWM Frequency: https://code.google.com/archive/p/arduino-pwm-frequency-library/downloads
described here: https://forum.arduino.cc/index.php?topic=117425.0

About fans:


I started to experiment with a regular two wire fan but I was not satisfied with the results. If you insist using this type of fan you'll certainly want to change Arduino's frequency to reduce the noise of the fan. Read more here: http://playground.arduino.cc/...Cheatsheet  In this experiment I found the lowest frequency eliminating noise successfully. Of course you will need to drive your fan with a suitable transistor or MOSFET, do a minor modification in the code and modify the wiring. Keep in mind a relative high current sink.

Later I swapped to four wire PWM controlled fan which controls RPM smoothly. I used cheapest PWM fan I was able to get therefore this type of fan still spins at its minimum RPM even PWM is set to 0. I solved this using a transistor as a switch which cuts the power supply to the fan under the lowest temperature threshold. When using PWM fan changing the Arduino frequency is not needed so I left it to default.

About temperature sensors:


First, I tried with DS18B20 temperature sensor, but the RPM changes by steps because of sensor's response time (about 700ms). So I decided to use NTC sensor which causes no reading delays and therefore produces smooth RPM control.

About the code:


Regarding the  NTC sensor used, I needed some maths in my code to calculate temperature from analog values captured form NTC. I didn't bother calibrating the temperature because high accuracy is not necessary for my purpose.
Since I prefer operating with temperature values rather than analog readings from NTC I converted analog values to temperature before processing further. In next step the temperature values are mapped from desired starting temperature threshold with desired RPM to desired maximum temperature threshold with full RMP of fan. Anything between these two thresholds are the values that control the fan. At last Arduino converts these values to PWM and send them to the fan.
Maybe I should explain the wire color meaning of the PWM fan: black-GND, yellow-12V, blue-PWM.

NTC PWM Fan Controller

24.07.2017

This project describes how to control speed of a fan. In my case this kind of controller is intended for cooling down power transistor installed in my homemade power supply. I did some some researches and testings and ended up with a fan controlled by PWM signals. Arduino can do it very simply and it is very customizable with the code.

Components Required:

arduino ntc pwm fan controller
Project gallery & downloads:
Project gallery & downloads:
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
arduino ntc pwm fan controller
Any comments please leave on YouTube.

Arduino nano

Fan 12V

NTC 10k

Transistor BD235

R 10k

R 1k

Rectifier diode