Site icon Microcontroller Based Projects

PWM Fan Controller

PWM Fan Controller Featured Image

Pulse Width Modulation (PWM) is very common technique for controlling cooling fan speed in Desktop PC. In this project PIC16F877A based Pulse Width Modulation  controller was built and tested with 2 fans. 80 mm Coolink SWiF2-80P PWM Fan and Arctic Cooling F12 PWM 120 mm. These are 4 wire fans and their pinouts are shown in the diagram below.

A standard PWM Fan connector has 4 wires: +12V, Gnd, Control and Sense. Control input should be connected to 25 KHz PWM signal. By changing the Duty Cycle of control signal you can adjust the fan speed. Sense wire is used for monitoring the actual fan speed. Sense output will send 2 pulses per revolution. By counting the number of these pulses in a minute you can calculate fan RPM.  PIC16F877A was used again as default MCU for current design, however the code can be modified to work with any similar PICs like PIC16F876A or PIC16F88 and support most of PWM 12V computer fans.More on the next page.

The schematic includes an LCD display for monitoring fan RPM however if you need a basic controller the LCD can be omitted thus reducing the size of the board. In this case only 2 components are needed, microcontroller and simple push button. If this post  will generate enough interest I’ll try to  fit the design into 8 pin MCU like PIC12F675,I have a few available ICs. Currently only one fan can be controlled and monitored by PIC , however this limitation can be removed by implementing software PWM instead of using CCP module.

Fan RPM is shown on the LCD , update rate is 1 sec. Pressing SW1 (see schematic) will change the Fan speed. As with all other projects assembly source code is available at the bottom of the page. I’ve tried to add clear comments explaining each function. Basically 4 subroutines are used. One for calculating the Sense wire  frequency, second function  to translate from revolution per second  to RPM. The third function converts the result to Unpacked BCD, and the last one to send the data to LCD display. Assembly/hex files available here. Here is a short video demonstrating PWM Fan controller operation.

Exit mobile version