# DC Fan PWM/Speed Sense

#### dmarciano84

Joined Oct 1, 2023
36
I am working on a project (based on the PIC16F18877) to which I am planning on adding a PWM DC brushless fan. However, I have never had to work with PWM before (or even DC fans) so there are a few things I am not clear on that I am hoping to get clarification on. I just want to make sure I understand everything correctly before I buy any parts/start the circuit design.

To begin, I started by looking up some data sheets on DigiKey to see what kind of information is provided and what I need to do. I came across this data sheet which seemed good to use as a reference. The following points are what I am not 100% clear on and am hoping someone can confirm my understanding is correct, or correct me where I am misunderstanding.

1: The PWM Frequency is listed as 18 - 30 KHz. I am assuming that means I can create a signal with a period of anywhere in this range and just ensure that my duty cycle is the correct percentage for the air flow I want (which will be adjustable via the PIC MCU).

2) Note 2 under the table at the top of the page states When 20% duty cycle the starting voltage must be same as rated voltage. I am not sure what this means. The High Level is 3.3V to 6V and the Low Level is 0V to 0.4V, the rated voltage is 12V (Page 6), and the starting voltage is 8V (Page 2). If the fan is always connected to a 12V source though, is this something that I even need to worry about; it seems not.

3) This specific fan (and a lot I was looking at with PWM) has a Speed Sensor/Tachometer wire, but doesn't give much information on it; all the information is on Page 4. It shows that to use it I would need to provide 12V (it says 13.2V max, but since it is a 12V fan, I am assuming that is sufficient) and then after the series resistor I take the output waveform. How do I actually calculate the RPM based on this signal? Would I need to have a loop that runs for a specific amount of time (e.g., 0.5 seconds), count the number of pulses during this time, and then figure out the RPM based on the fact that it says 2 pulses/rotation?

Thank you in advance for any assistance/clarification. It is greatly appreciated. Also, if there is anything I am missing, or need to take into account when connecting it to the PIC MCU, please let me know; I am open to any suggestions to make this project go smoother.

Joined Jul 18, 2013
28,475
The RPM sensor states 2 pulses/rev.
The motor appears to be capable of PWM control between 2krpm to 4300 rpm, IOW, 2000rpm is the lowest you can go.

#### BobTPH

Joined Jun 5, 2013
8,642
You can get the time the interval from one pulse to the next, or you can count how many pulses are seen in a longer interval. At 4K RPM, that is 66.6 revs per second. Two pulses per rev gives you 133 pulses per second or 7.5 msec between pulse. Set the timer for 500usec and you will get 15 counts for full speed 7 for lowest speed, If that is not precise enough count for more ticks.

#### dmarciano84

Joined Oct 1, 2023
36
You can get the time the interval from one pulse to the next, or you can count how many pulses are seen in a longer interval. At 4K RPM, that is 66.6 revs per second. Two pulses per rev gives you 133 pulses per second or 7.5 msec between pulse. Set the timer for 500usec and you will get 15 counts for full speed 7 for lowest speed, If that is not precise enough count for more ticks.
True, I didn't even think of that; I just saw the 2p/rev and went with that in my head. Can you confirm if my understand of Point 1 & 2 are correct as well?

#### BobTPH

Joined Jun 5, 2013
8,642
True, I didn't even think of that; I just saw the 2p/rev and went with that in my head. Can you confirm if my understand of Point 1 & 2 are correct as well?
Yes, both correct.

#### dmarciano84

Joined Oct 1, 2023
36

Joined Jan 15, 2015
7,445
On another note looking at the linked to fan and most fans of this type is on page 4 of the data sheet they show a drawing of the pulse out. The pulse out is an open collector design. That requires an external pullup resistor.

Ron

#### dmarciano84

Joined Oct 1, 2023
36
On another note looking at the linked to fan and most fans of this type is on page 4 of the data sheet they show a drawing of the pulse out. The pulse out is an open collector design. That requires an external pullup resistor.

Ron
Yes, I did notice that. I was planning on using 4K8 resistor on the MCU input pin (to get around 2.5mA)