I want to compare a PTC thermistor to a set point, and trigger a relay if the temperature goes below a set temperature.

In particular, my temperature to turn on the relay should be 33 degrees F (845 ohms) and turn off at 36 degrees F (860 ohms).

I could easily do this with a microcontroller, but this seems like just too simple of a project to waste one on.

How can I accomplish this with basic electronic components?

  • \$\begingroup\$ I've updated the question to indicate the type of thermistor and actual temperatures and resistances. \$\endgroup\$ Apr 17, 2012 at 16:51
  • 1
    \$\begingroup\$ Do you have a part number for the thermistor ? \$\endgroup\$ Apr 17, 2012 at 16:55
  • \$\begingroup\$ It is an entire probe assembly -- Love Controls TS-5 -- but I haven't managed to find a datasheet. I did some measurements though and found that it acts linearly. \$\endgroup\$ Apr 17, 2012 at 16:58
  • \$\begingroup\$ OK, never mind. I've updated my answer. \$\endgroup\$ Apr 17, 2012 at 17:11

3 Answers 3


While I agree with Rocketmagnet's schematic (though I would decrease R4 to 1k\$\Omega\$) I can't agree with his calculation of resistor values. Copy of the schematic:


Rocketmagnet calculates for two different voltages on pin 3 of the comparator, which should represent the hysteresis. However, at both toggle points this voltage is the same, namely the voltage set on the inverting input using the potmeter.

The confusion stems from the fact that the hysteresis feedback is added to the signal, rather than the reference voltage, which you would normally do. The consequence is that despite the hysteresis we only have one reference voltage: the voltage at the potmeter's wiper. A more common way to solve this would be to connect the potmeter with R5 to the non-inverting input and the signal to the inverting input. But we'll see that this works too.

Let's suppose the potmeter is set to 2.5V (could have been done with two resistors), and that the comparator's output swings between 0V and +5V (\$V_{CC}\$). The comparator should have a push-pull output. The comparator's output should go high when the NTC's resistance is 845\$\Omega\$. Until that moment the output is low, so that

\$ R5||R2 = 845\Omega\$

to let the non-inverting input pass the 2.5V toggle point. Likewise, the comparator's output should go low when the NTC's resistance reaches 860\$\Omega\$. Until that moment the output is high, so that

\$ R2 = 860\Omega||R5 \$

So we have the following set of simultaneous equations:

\$ \begin{cases} \dfrac{R5 \times R2}{R5 + R2} = 845\Omega \\ \dfrac{860\Omega \times R5}{860\Omega + R5} = R2 \end{cases} \$

which gives us

\$ \begin{cases} R2 = 852\Omega \\ R5 = 96.89k\Omega \end{cases} \$


It's pretty easy with a comparator.

Temperature Comparator with relay and hysteresis

As the resistance of the thermistor goes down, it increases the voltage of the comparator's positive input (pin 3). When this input goes higher than the negative input (pin 2) the output will go high.

To set the threshold, you simply adjust the potentiometer.

The output of the comparator probably won't be able to drive a relay (check the current requirement of the relay, and the output drive of the comparator). So I have added a transistor which switches current to the relay.

Relays are inductive loads which will produce a negative voltage spike when they switch off. The diode will absorb this spike.

Hysteresis: Make sure that the comparator you choose has some built in hysteresis. E.G. LTC6702 or MAX9021. Alternatively, add a resistor (R5) to force some hysteresis.


You have now specified the exact on/off temperatures. These give voltages of 2.710v and 2.688v. Which is a hysteresis of 22mv. If my calculations are correct (probably not) then I think you need to use 100k for R5.

Added 2: How to calculate R5

First, using the formula for parallel resistors, we calculate the effective resistance of RT1 and R2 as about 460 ohms.

Next, we use consider a potential divider formed by R5 on top and (RT1 & R2) at the bottom. For ease of calculation, assume that we have 2.5v at the bottom (generated by RT1 and R2).

Now, the question is, what value of R5 do we need if we want V to change by 0.022v. I.E. +-0.011v.

Calculating R5

Using the 0v case, because it's simpler:

2.489v = (R5 / (R5+460)) * 2.5v

R5 = 460 / (2.5/2.489 - 1) = 104085

So, about 100k.

  • 4
    \$\begingroup\$ You really need to add some hysteresis to this circuit, else it will bounce the relay. \$\endgroup\$ Apr 16, 2012 at 14:02
  • 1
    \$\begingroup\$ @Telaclavo, Rocketmagnet - "Hysteresis is designed into most comparators, usually with a value of 5mV to 10mV." (source). The key word is "most". Better be safe than sorry, and by adding hysteresis yourself you can control the level as well. \$\endgroup\$
    – stevenvh
    Apr 16, 2012 at 14:13
  • 1
    \$\begingroup\$ Not fundamental ones like LM393, LM339... \$\endgroup\$ Apr 16, 2012 at 14:23
  • 2
    \$\begingroup\$ I already upvoted, but it would be great if you could explain where the 200k value for the hysteresis resistor comes from. Calculation! :-) \$\endgroup\$
    – stevenvh
    Apr 16, 2012 at 14:37
  • 4
    \$\begingroup\$ Note that the schematic is for a comparator with push-pull output. Comparator outputs are often open collector. \$\endgroup\$
    – stevenvh
    Apr 16, 2012 at 14:41

By your description, you're using an NTC thermistor. (This matters for the hysteresis.)

An easy way to do this is with a comparator like an LM393 and some sort of a voltage reference.

ntc comparator with hysteresis

This circuit has a normally-low output. When the threshold is reached, the comparator changes state and the output goes high.

The inverting input has the NTC and a pull-up resistor. As the NTC heats up, its resistance drops and the voltage on on the pin will decrease. The non-inverting input has a divider acting as a voltage reference, plus an extra resistor going to the output which provides hysteresis.

  • \$\begingroup\$ I'm just curious. Why did you say "this matters for the hysteresis"? Because the NTC has a negative (instead of positive) coefficient? \$\endgroup\$
    – Telaclavo
    Apr 16, 2012 at 15:13
  • \$\begingroup\$ You need to know if the comparator is going to release when the threshold is reached, or pull down when the threshold is reached. This will impact the reference divider and hysteresis component value selections. \$\endgroup\$ Apr 16, 2012 at 18:10
  • \$\begingroup\$ Actually, looks like I'm going to end up with a PTC thermistor. How do I correct for this? \$\endgroup\$ Apr 17, 2012 at 14:54
  • \$\begingroup\$ If you use a PTC, the reference voltage should be set up so that the output is normally high. This is the opposite case of with an NTC, so you'll need to add a transistor or MOSFET to the output of the comparator to invert the logic. \$\endgroup\$ Apr 17, 2012 at 17:47
  • \$\begingroup\$ What is the capacitor for? Is it to reduce noise? \$\endgroup\$ Aug 18, 2017 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.