Show by Label

Tuesday, August 11, 2015

_HowTo: Controlling a temperature driven Fan with PWM

Because I need a fan for my power supply project, I started a little project to do that.
I don't like noise or hum, so I wanted to use a fan that would be off when not needed.

Typically, by using Pulse Width Modulation (PWM), rather than a voltage, you can precisely control the speed of the fan, and ramp it up when needed.

I was able to find some clever methods to implement this, and pieced together this design:

The building blocks are relatively simple. I use a DC-DC convertor, not a linear one, to bring the 24V DC to 5V, because a linear LM7805 would get too warm burning off the excess voltage.
I use a comparator with hysteresis to determine the starting point of the fan, based on the temperature reading (in ohms) of a thermistor that is mounted on the heat sink. I don't have the datasheet for the thermistor, but found that it gets from 10K at room temperature to about 5K when the heat sink is getting really hot.

I need 5V for the fan, because I have one that is only 10mm thick, and that is what I have room for.

The clever trick of this circuit lies in the fact that the Control Voltage (CV) input from a 555 timer is used to control the PWM.

The 555 is producing pulses, and the pulse width, and also a bit of the frequency is varied by applying a voltage to the CV input. The output of the 555 goes to a FET that drives the fan.

The whole thing works very well, although the low pulse frequency can be heard from the fan, so I needed to use C4 and C5 to remove that chirping sound.

There are two disadvantages of this design.
One is that you cannot regulate the full 100% of the pulse width. The minimum is OK at about 30%, it let's the fan spin very slowly, but the maximum is only about 70%.
The other disadvantage is that you cannot increase the frequency of the pulses above the hearing frequency of 20KHz, because then the effect of the thermistor on the PWM range is greatly reduced. 

In my application, that is not good enough, I need to be able to get to the maximum fan speed in order to keep things cool.

There are special fan/motor controllers that allow you to do that, so I have a couple of TC648VPA chips on order. Stay tuned.

The chips arrived and I made two different circuits. One for a 12V DC Fan I also ordered, and one for the 5V DC fan.  I used an Excel spreadsheet that is available on the MicroChip website to calculate the resistors (R1 and R2) to get the best starting and maximum fan speeds.

The TC648 works really well, and is a nice addition to my toolbox. Next step is to put the circuits on vero board and install them in the power supplies.

After playing and experimenting, I decided to make a few changes to the circuit. First, I implemented the VAS  pin. The explanation says to set the Auto-shutdown threshold with this pin, but it also sets the turn-on threshold. The nice thing is that the fan will be driven to full speed for a short period, making sure it turns on right away. This was a problem I noticed with the earlier circuit.

Second, I deleted the resistor that was in parallel to the NTC. I felt that with a 10K NTC, it didn't do much. I also experimented with C7, which sets the frequency to see if I could remove the audible noises at lower speeds. That only worked with a 10nF cap, but then the PWM spread is limited and therefore also the speed control. So I resorted to using the 1uF value.

BTW, after a lengthy search, I found the information about the NTC I was using, because I wanted to know the temperature curves. Unfortunately, the shop I got them from didn't mention the type or manufacturer. I have the TDK B57045K0103K000.

I also found a much more elaborate data sheet for the device here:

And here is the latest version of the schematic:

If you like what you see, please support me by buying me a coffee:


Unknown said...

I would like to use this circuit but I have a few questions since I am not EE. Q1. Datasheet says nothing about C7. What is PWM frequency for 1 uF? When did you hear noise? Q2. I need to use this in my car. Input voltage fluctuates. Would you recommend 7805? Q3. My circuit will not have MOSFET because I have a dedicated motor driver (a physically separate package). When temperature is below the threshold, what happens to Vout? Does it float or go to ground? Thank you.

paulv said...

Hi Rupert,
Lets see if I can help you a bit.
Because you are referencing VOUT, I'm assuming you want to to use the circuit with the TC648, not the 555 circuit.

Q1 Paragraph 2.2 of the TC648 datasheet mentions C7 and the frequency. You should also look at that for your Q3 answer.
When the fan is switched by PWM, the coil is protesting, resulting in a whine. A capacitor across the pins will dampen the switching, or a higher frequency will move it out of your hearing range.

Q2 If all you need to power is the TC648, a 7805 will do just fine, you can even go to the 100mA version.

James said...
This comment has been removed by a blog administrator.
Unknown said...

I really wish I understood this well enough to implement as it sounds like the perfect solution to my problem: trying to create a temperature-driven PWM signal for my graphics card fan (the card currently does not sense the fan speed and so drives at 100%). Would you be able to offer any advice regarding a compact circuit where I could implement this and attach it to the back of my graphics card to control the fan speed based on temprature of the card?

paulv said...

Hi Unknown, it is hard to give you any advise because I don't know enough of the specifics. However, you can just about completely copy the circuit I provided, without the voltage regulator because your PC already has that.

Unknown said...

Apologies for a silly question but will I be able to run my 12 DC 1A fan at full capacity, should the temperature reach that high?

Also, would a potentiometer instead of one of the resistors, be a better option or will I have great control utilising PWM? The temperature range is 40-100 degrees C.

paulv said...

Hi Unknown,
Yes you should, but to run a 1A fan, you will need to use a MOSFET that can handle that current.
You could use trimmers or potmeters for R1-R4 and also for R2 to set the trigger points. You will have to experiment a little to get it right.

Unknown said...

Could you please give me an example of the 1A MOSFET? Preferably SMD one as I can't use through-hole nor heatsinks due to space constraints.

Also, ou're saying I'd need 3 potmeters to get it right? Also the TC648 IC - do ou know if it can be programmed by conventional means (like STM8 or STM32) programmer or do I need to buy their special development board? Thank you


Unknown said...

I am currently looking at IRLZ44NSTRLPBF for the N-CH MOSFET. Will it work?

paulv said...

No I'm saying you could replace R1 and R4 with a 50K trimmer, and R2 with a 5K trimmer. You'll have do a bit more work yourself and Google the TC648 for details and also select the proper MOSFET.