I'm looking for a bit of advice on a 741-based thermostat circuit that
needs some hysteresis, or lag between "on" and "off".
http://www.copperleife.com/craig/tech/thermo/
Let me preface - I'm not an expert.
I've just recently done something similar. What you want in this case is
a bit of positive feedback around the comparator. As a quick aside, I
would use an LM311 or similar actual comparator here, instead of the
op-amp, though the op-amp is probably fine if it is rail-to-rail enough
(I do not know if the 741 is). If you do switch, make sure you note that
the output of the LM311 is open collector.
Let's take a starting state of Vni > Vi. Since your thermistor has a
negative time coefficient, its resistance gets smaller as the
temperature gets higher. So, in the context of your divider, Vni
approaches ground as the temperature approaches infinity. Thus, Vni > Vi
(Vo = +Rail) means that the temperature is lower then the preset
(transistor does not conduct). Vni < Vi (Vo = -Rail) means the
temperature is higher then the preset (transistor conducts). This you
know already, I say it for my own benefit.
I suppose that sampling some of Vo for Vi (as suggested on your web
page) would work if the feedback resistor was a lot higher then the Z
looking into the inverting pin. In my limited experience though, I've
only applied positive feedback, that is to say feedback to Vni, around
comparators for the purpose of hysteresis. Feedback to Vi will have the
op-amp behaving like an inverting amplifier, with gain set as usual,
Rf/Ri. This will, at least over a small range, have the output slew
instead of step.
If it was me, I'd retool this circuit. Replace the PNP with an NPN, and
put the preset on Vni and the thermistor on Vi. This would invert the
output of the comparator (high when the temperature is too hot (Vi <
Vni), low when too cold (Vi > Vni)). Replacing the PNP with an NPN
compensates for this from the transistors perspective. Then, if you were
to sample some of Vo (call it Vsamp) and apply it to Vni, you'd get
hysteresis as I would expect it.
Imagine Vo positive, that is to say, Vi < Vni, or too hot. This would
cause Vni to be modified by Vsamp such that the Vni voltage would be
driven higher, effectively decreasing the preset temperature by forcing
the thermistor to cool past the turn on point. When Vo is off, Vni is
normal, the hysteresis is removed.
As to picking the value of the positive feedback resistor. Envision the
applied feedback as a voltage divider made up of the feedback resistor
and the preset voltage network, use superposition and sum the voltage
from that divider with the preset divider. With the above configuration,
you will probably end up with something like:
V2*R2*R1 + V1*R2*(R3+R4)
Vni = ------------------------
R2*R1 + (R4+R3)(R2+R1)
In the above, R1 and R2 make up the divider programming Vni, R3 is the
positive feedback resistor, and R4 is (since this came from my project)
the resistor pulling the LM311's open collector up. V1 is the supply
voltage, V2 is the output voltage of the comparator (Generally V1 or 0).
For the 311, R4 should be zero when V2 is zero, because R4 acts as a
pull-up and isn't 'in the circuit' when the output of the LM311 is low.
Note that the value of the hysteresis depends on the divider programming
Vi. That means, that with an adjustable temperature threshold, the
hysteresis will change with the temperature threshold, but not by much,
since generally R3 will be >> then R1 || R2 (note your R1 and R2 is a
bit more complicated with how you have your pot setup, but the point
holds).
Since thermistors are non-linear, the hysteresis will not be measurable
in degrees, per se, and will not represent a constant temperature
difference for different presets. If that's important, you may want to
switch to a linear temperature sensor, like an LM335. That would give a
more constant hysteresis in degrees over a larger temperature range.
You'll need to work that out based on your project parameters.
With hysteresis, I would consider the capacitor unnecessary. All it's
doing is, as you note, smoothing out some of the comparator jitter, in a
not very sophisticated way.
At 12 volts and 1 Kohm, you're driving about 12 mA into the base of the
transistor. With a minimum beta of say, oh, 50, that's more then
necessary, yes. You could probably replace it with 10k or so to bring
the drive closer to a milliamp, which should be plenty to run your 40mA
load.
Oh, if you replace the PNP with an NPN, make sure to put the relay
between the supply and the collector, not the emitter and ground.
Again... I'm not an expert.