Compare resistance to a setpoint and trigger a relay

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?

-
I've updated the question to indicate the type of thermistor and actual temperatures and resistances. – David Pfeffer Apr 17 '12 at 16:51
Do you have a part number for the thermistor ? – Rocketmagnet Apr 17 '12 at 16:55
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. – David Pfeffer Apr 17 '12 at 16:58
OK, never mind. I've updated my answer. – Rocketmagnet Apr 17 '12 at 17:11

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.

edit
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.

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.

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

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

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

-
You really need to add some hysteresis to this circuit, else it will bounce the relay. – Madmanguruman Apr 16 '12 at 14:02
@Madmanguruman Don't comparators normally have hysteresis ? – Rocketmagnet Apr 16 '12 at 14:10
I already upvoted, but it would be great if you could explain where the 200k value for the hysteresis resistor comes from. Calculation! :-) – stevenvh Apr 16 '12 at 14:37
Note that the schematic is for a comparator with push-pull output. Comparator outputs are often open collector. – stevenvh Apr 16 '12 at 14:41
I would increase the pot to at least 10 kohm, and add a 10 nF capacitor between pin 2 of the comparator and ground, to filter out glitches due to bad contact at the wiper. – Telaclavo Apr 16 '12 at 15:47