Thermistor Comparator Circuit

Thread Starter


Joined Jan 21, 2012
I recently put together a simple comparator circuit to turn on some computer cooling fans when the temperature rises. However, I'm having difficulties determining what resister values I should use for some of the resistors. I chose some based on what I saw in some schematics (and some recommended calculations on various websites), but what I found is that it works for some transistors and not for others. I bought a TIP31AG at raido shack that works great. However, the TIP31A's that I got from Mouser aren't as forgiving.

Here is the circuit:

I'm looking specifically at the values for R2 and R6. I'm about ready to go back to Radio Shack and buy some more of their transistors, but at this point I have only one of theirs and 10 from Mouser, so I'd much rather get the Mouser transistors working.

The fans were taken out of a couple of old computer cases. Both are 12V, one is 0.12A and the other is 0.18A, they are connected in parallel. The power supply runs at about 14.5V. The potentiometer is set at about 2.5KΩ and the thermistor is at about 2.1kΩ. When I have the right values for R2 and R6 and I heat the thermistor up with a hairdrier and I use the TIP31AG from Radio Shack, the fans turn on and I get a nice constant flow of air. However, I can't seem to get the same results with the TIP31A's from Mouser.

Here is what I have tried and the results:
R2R6TIP31AGTIP31A15k10kone fannothing15k2.2kbothnothing10k2.2kbothone fan4.7k2.2knothingnothing10k1.0knothingnothing2.2k1.0knothingnothing4.7k1.0knothingnothing
**I pasted a table from Excel, but it doesn't seem to be working right, so if you can't see it, try this link instead to the file itself:

Rather than continuing to guess, what do I need to do to actually caculate the right resistance values? Or am I missing something else that is fundamental to the problem?

Here is the TIP31A data sheet:

Here is the comparator data sheet:

Here is the current state of the project:

I would appreciate any adivice,




Joined Jan 10, 2012
My guess is you need to replace the transistor with a darlington pair, or else just connect a small transistor along with the existing transistor in a darlington configuration. The values for the resistors are too high to get any reasonable current, but lowering them might affect the trun off of the transistor. Using a darlington might get you the margin you need.

Thread Starter


Joined Jan 21, 2012
I could do that, but I still don't know what values I should actually have for the resistors. What I found is that, as I lowered the resistor values, the circuit didn't work at all, note the excel spreadsheet. So, I'm not sure that is the issue. What I'd like to know, is how to calculate the particular values that I need, rather than the trial and error process I've been going through.


Joined Nov 20, 2008
In order to ensure the transistor is fully saturated when turned on, you must assume a gain of 10 for the TIP31A. Therefore the base current (Ib)needs to be 300mA / 10 = 30mA mimimum. The base bias resistor R2 needs to be; (Vc - Vbe) / Ib. So 14.5-.8 /.03 = 457Ω.

The LM393 has an open collector output so R6 is not needed, just use R2 at 470Ω. To turn the TIP31A off the LM393 needs to sink 30mA, but its spec'd for much less than that, typically 18mA.

A good design should be able to work with any part off the shelf... your current selection cannot work well together.

However, it may by chance work if the TIP31A gain is high enough, and the LM393 drive is strong enough, and the value of R2 is just low enough to turn on the TIP31A, but not too low that the LM393 can't turn it off. Try R2 at 1KΩ and no R6.

I see you have a few extra TIP31As. Try the configuration in the attached schematic using two transistors that will multiply the gain and allow everything to work more reliablely.



Ron H

Joined Apr 14, 2005
Actually, LM393 typical output sink current is only about 10mA, but worst case is only 4mA.

A MOSFET would be a simple replacement for the TIP31.


Joined Mar 14, 2008
Try removing R6 and connect the transistor base directly to the LM393 output.

Change R2 to 2k ohm.

That will increase the transistor base drive.

Thread Starter


Joined Jan 21, 2012
Thanks for all the input. I'll try some of these suggetions out and let you know how they work... that is, once I find some more time to work on it.
Thanks again,

Thread Starter


Joined Jan 21, 2012
Again thanks for all the input. I had an opportunity to work on it again today. I did try the resistor straight to the comparator, but as mentioned, it only burned out the comparator because it couldn't sink that much current... What did work is the dalington pair mentioned by brownout but explicitly depicted by ifixit. The configuration illustrated by ifixit it is what I used and it works great.

Thanks much,

Last edited:


Joined Apr 5, 2008

You could add a resistor from the output of the comparator to the + input of the comparator to have a hysteresys.
Then there will be a little temperature difference for switching the fan on and off.
A resistor of 100K (large difference) to 1M (smaller difference) will do.
See this page of the eBook for more info: