Maker Pro
Maker Pro

Hysteresis needed in 741 Op-Amp circuit

C

CF

Jan 1, 1970
0
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

I've posted the circuit and details at the following link. Any input, either
via the web interface or this group would be much appreciated.

CF

Please see:
www.copperleife.com/craig/tech/thermo
 
R

Robert C Monsen

Jan 1, 1970
0
CF said:
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

I've posted the circuit and details at the following link. Any input, either
via the web interface or this group would be much appreciated.

CF

Please see:
www.copperleife.com/craig/tech/thermo

Nice problem description!

The way hysteresis works for these kinds of circuits is that you
influence the + input by tying it to the output through a resistor,
and use another resistor from that node to the reference. Thus, the +
input is basically set by a voltage divider which goes from the output
to the comparison input.

Say your input is set at 5V, and your output swings from 0 to 10V. If
the resistor from output to + and from + to 5V are equal, then its
clear that when the output is high, the + input will be at 7.5V. Thus,
the - input will have to get up to 7.5V to cause the output to go low.

When the output is low, the + input is at 2.5V. Thus, the - input will
have to go down to 2.5V to cause the output to go high.

Because of this, you have a 5V 'guard' region. When the output swings
from low to high because the - input has gone below 2.5V, the trigger
voltage will immediately go up to 7.5V, meaning that fluctuations
around 2.5 won't cause it to turn on and off repeatedly.

Now, for your heater circuit, you are varying the + input using the
thermistor, rather than the -. Thus, by putting a resistor from 6 to
3, and another one from 3 to where the old 3 was connected, at the
node connecting the 10k and the thermistor, you'll add some
hysteresis.

Adding it to 2 won't be good, because that means that when the output
goes low, the negative input will go lower, meaning the + will have to
go down even further, thus turning it back on, etc... Not good. Also,
you really want your opamp acting like a comparator, not an opamp, so
negative feedback is not a good thing.

I'd use a 330k potentiometer between pin 6 and the junction of the 10k
and the thermistor in your diagram (the node that used to be attached
to pin 3). Then, attach pin 3 to the wiper of the pot, and set it for
the proper hysteresis.

12V
+------------------------------+
| |
| |
.-. |
10k | | |
| | |
'-' 330k |
| ___ |
+----|___|--------+ |
| A | |
| | | |
| | |\ | 3.3k |
| +----|+\ | ___ |<
| | >--+--|___|---|
.--------+--. Vref-|-/ |\
| | |/ |
| Sensor | .--------.
| 10k | | |
| | | Relay |
'--------+--' | Etc |
| | |
=== | |
GND '--------'
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de


Regarding the value of that resistor from the opamp to the PNP
transistor, its value should be such that the current through it is
about 1/10 of the current you want through the relay when its on. If
you want 30mA, then with about a 10V drop, you want 10V/3mA = 3.3k.
That should fully saturate it. If not (if the collector isn't near
Vcc), then use a smaller resistor.

Regards,
Bob Monsen
 
C

CF

Jan 1, 1970
0
Oh wow Bob! What a fantastically helpful, educational and thorough reply. Even
a circuit diagram no less.

Unless anyone raises an objection in the meantime, I'll give your suggestions
a try either tomorrow or on the weekend, and post a follow-up.

Very gratefully,

Craig
 
R

Rheilly Phoull

Jan 1, 1970
0
CF said:
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

I've posted the circuit and details at the following link. Any input, either
via the web interface or this group would be much appreciated.

CF

Please see:
www.copperleife.com/craig/tech/thermo

Unless there is some reason to use the 741 why not consider a voltage
comparator like the LM311 ?? (Thats the sort of thing they are made for)
You could get more accurate levels of hysteresis with such, particularly if
you need a small differential of temp.
 
T

Terry Pinnell

Jan 1, 1970
0
Now, for your heater circuit, you are varying the + input using the
thermistor, rather than the -. Thus, by putting a resistor from 6 to
3, and another one from 3 to where the old 3 was connected, at the
node connecting the 10k and the thermistor, you'll add some
hysteresis.

Adding it to 2 won't be good, because that means that when the output
goes low, the negative input will go lower, meaning the + will have to
go down even further, thus turning it back on, etc... Not good. Also,
you really want your opamp acting like a comparator, not an opamp, so
negative feedback is not a good thing.

I'd use a 330k potentiometer between pin 6 and the junction of the 10k
and the thermistor in your diagram (the node that used to be attached
to pin 3). Then, attach pin 3 to the wiper of the pot, and set it for
the proper hysteresis.

12V
+------------------------------+
| |
| |
.-. |
10k | | |
| | |
'-' 330k |
| ___ |
+----|___|--------+ |
| A | |
| | | |
| | |\ | 3.3k |
| +----|+\ | ___ |<
| | >--+--|___|---|
.--------+--. Vref-|-/ |\
| | |/ |
| Sensor | .--------.
| 10k | | |
| | | Relay |
'--------+--' | Etc |
| | |
=== | |
GND '--------'
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

I think you need to reverse the +ve and -ve input connections for that
to work in CF's single polarity supply, as shown here:

http://www.terrypin.dial.pipex.com/Images/741Hysteresis.gif
 
M

Michael Ballbach

Jan 1, 1970
0
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.
 
R

Rob Paisley

Jan 1, 1970
0
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

I've posted the circuit and details at the following link. Any input, either
via the web interface or this group would be much appreciated.

CF

Please see:
www.copperleife.com/craig/tech/thermo

As others have mentioned, a comparator would be a good choice for
this application.

Please refer to the 'Input Offset Voltage And Hysterysis' section of
this page - http://home.cogeco.ca/~rpaisley4/Comparators.html - for
further information.

Rob.
 
C

CF

Jan 1, 1970
0
Wow again! This is great stuff Michael. I've pored over what you've written,
which is excellent, and I'm with you 100% on the need to retool the whole
circuit (ideally). I wish I'd started with a better basis. I don't know what
the designer was thinking, but perhaps he modified it from a heating circuit
where the comparator output would be low when the heater was inactive -- or
something like that.

I've attempted to draw my take on your suggestions and posted this at:
www.copperleife.com/craig/tech/thermo/mb.htm

The small changes in hysteresis you mention are not an issue at all, nor is
the non-linear nature of the thermistor seeing as I will be using it within a
very narrow band.

Being a rank novice, I have no idea what resistor to use to pull up the 311's
open collector. Also, my mathematically-challenged brain is hurting too much
to apply your formula to everything and work out a value for the hysteresis
resistor, but I'm thinking that I can whack a trimpot in there and experiment!
This is shameful, I know.

Please let me know if I've got it right or wrong otherwise, and any idea you
might have on the R4 value.

Thanks heaps,

CF
 
C

CF

Jan 1, 1970
0
A couple of replies rolled into one:
I think you need to reverse the +ve and -ve input connections for that
to work in CF's single polarity supply, as shown here:
http://www.terrypin.dial.pipex.com/Images/741Hysteresis.gif

Argh!! Don't say things like that Terry! That would contradict what Michael
and Robert have written, and jeopardize my flimsy understanding.
As others have mentioned, a comparator would be a good choice for
this application.

Yes, you and Michael are right about this Rob. I suspected as much when I
started wading (out of my depth) into library textbooks and web pages to try
to understand the circuit I'd built. I would like to revise it using a 311 or
similar chip in the future... (see
www.copperleife.com/craig/tech/thermo/mb.htm)
... but I wouldn't mind getting this version working as a stop-gap (which
seems possible, if not elegant).

Nice link you provided too, thanks.
..
 
T

Terry Pinnell

Jan 1, 1970
0
[email protected] (CF) wrote:

Being a rank novice, I have no idea what resistor to use to pull up the 311's
open collector. Also, my mathematically-challenged brain is hurting too much
to apply your formula to everything and work out a value for the hysteresis
resistor, but I'm thinking that I can whack a trimpot in there and experiment!
This is shameful, I know.

Please let me know if I've got it right or wrong otherwise, and any idea you
might have on the R4 value.

Did you try the slightly modified version of Bob's circuit I posted?
Choosing appropriate hysteresis in practice is easy by varying the R13
trimpot as I described in
http://www.terrypin.dial.pipex.com/Images/741Hysteresis.gif ?

There are formulae that can be used, but trial and error is usually a
superior approach in this sort of application.

A further revision which I found gave greater control is shown here:
http://www.terrypin.dial.pipex.com/Images/741Hysteresis2.gif

And here is a typical actual result from that breadboarded circuit
(using a triangle wave as input):
http://www.terrypin.dial.pipex.com/Images/741HysteresisWave.gif
 
M

Michael Ballbach

Jan 1, 1970
0
Wow again! This is great stuff Michael. I've pored over what you've
written, which is excellent, and I'm with you 100% on the need to
retool the whole circuit (ideally). I wish I'd started with a better
basis. I don't know what the designer was thinking, but perhaps he
modified it from a heating circuit where the comparator output would
be low when the heater was inactive -- or something like that.

Happy to help.
I've attempted to draw my take on your suggestions and posted this at:
www.copperleife.com/craig/tech/thermo/mb.htm

This is mostly right, though the feeedback I suugested is to the
non-inverting pin, not the inverting pin, as you have shown (i.e., it
would affect the preset temperature).
Being a rank novice, I have no idea what resistor to use to pull up
the 311's open collector. Also, my mathematically-challenged brain is
hurting too much to apply your formula to everything and work out a
value for the hysteresis resistor, but I'm thinking that I can whack a
trimpot in there and experiment! This is shameful, I know.

I don't think it is critical, depending on what you're driving from the
output. The comparator will either try to pull its output to ground, or
will do nothing, leaving it at the voltage its tied to. So, whatever it
is, you want to keep in mind that it is in series with the transistor
base resistor when the comparator output is 'high'. Maybe 1k, and drop
the base resistor to 8.2k or whatever a standard value is. You don't
want the pullup to be too low in value because the op-amp has to sink
whatever current you're putting through it to bring the output to
ground. You don't want it to be too high because you don't want it to
affect the hysteresis resistance, R3.

As for the math, surely, experimenting is good. Note though, that at its
simplest, the hysteresis you are adding is purely the voltage from a
divider formed by R3 and the preset resistors.

R3 + (((27k || 10k (variable)) + 6.8k) || 10k)
Vhyst = Vo * ----------------------------------------------
R3*(((27k || 10k (variable)) + 6.8k) || 10k)

Or:

R3 + (Rp1 || Rp2)
Vhyst = Vo * -----------------
R3*(Rp1 || Rp2)

If you think of Rp1 and Rp2 as the preset resistors. Maybe that is a bit
easier to visualize. This holds, at least, as long as R3, when seen in
parallel with Rp2 (the bottom half of the preset divider), is pretty
close to the original Rp2. (i.e., R3 is quite a bit bigger).

I don't know the output curves for the thermistor (or more correctly,
the output curve of the voltage from the divider the thermistor will be
in), but you should be able to tell how it varies with time around the
area you're interested in. Use a few degrees worth of the dV/dT as
Vhyst, plug in your known values for Rp1 || Rp2 (10k || 38k at its
simplest) and solve for R3.

As you say though, you've no real need to calculate this when you can
experiment. I find it interesting, none the less.
Please let me know if I've got it right or wrong otherwise, and any
idea you might have on the R4 value.

This seems fine but please do not pass over other posters' advice. I am
not nearly experienced enough at all this for that. :) Of course, only
the breadboard can tell, and I hope to not have steered you too far in
the wrong direction.

You may want to look at a spice program too, something like SuperSpice,
which I think has a free trial. After I have mocked something up on
paper, I find it very convenient to model it in something like spice. I
do not see spice as a design tool, I think you have to go to spice with
your design, and use it to refine it and tell you whether it is feasible
or not, and to do testing with varying parameter values. I think Terry's
nice plots may have come from a spice program.

They can be a bit overwhelming, what with all the analysis options and
such. I'm really only acquainted with a small portion of what it is
capable of. Worth trying to get familiar with though.

Good luck, I'd be interested in how it all turns out.
 
J

JeB

Jan 1, 1970
0
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

The "IC Op Amp Cookbook" is a good reference for this sort of problem.
 
C

CF

Jan 1, 1970
0
Late Saturday night here, so a quick thanks again. Along with the stupid
error you mentioned, I think I might have thought of one myself, namely the
output of the 311 and the input of the transistor being all wrong. From what I
can tell, it's a different kettle of fish compared to the other chip. I've
redrawn the circuit slightly and posted it at the same address:
www.copperleife.com/craig/tech/thermo/mb.htm

I don't know if it would work that way at all, as I have very little idea of
how you use the output from a 311. All I know is that it's effectively an NPN
transistor, as I've drawn. I should look into that book JeB mentined, the "IC
Op Amp Cookbook".

I will have to look into that SuperSpice program you mention too.

Cheers,

CF
 
M

Michael Ballbach

Jan 1, 1970
0
Late Saturday night here, so a quick thanks again. Along with the
stupid error you mentioned, I think I might have thought of one
myself, namely the output of the 311 and the input of the transistor
being all wrong. From what I can tell, it's a different kettle of fish
compared to the other chip. I've redrawn the circuit slightly and
posted it at the same address:
www.copperleife.com/craig/tech/thermo/mb.htm

You can keep 1 grounded and take the output at 7. When the transistor in
the comparator is on, you want it to sink the current flowing through
the pullup resistor, thus bringing the base of the transistor (close) to
ground. When the transistor in the comparator is off, it sinks no
current, and the voltage at that node is whatever it would be if the
comparator wasn't in the circuit at all.

What you have looks something like a darlington though and might work,
though the 9.1k is odd to me in that configuration, since the pullup
resistor and the drive of the transistor inside the comparator would
control how much current drove the base of the external transistor. It
would also invert the output I think. I honestly don't know though.
 
C

CF

Jan 1, 1970
0
Thanks heaps again Michael. Yes, I recognized that darlington-type
arrangement when I rigged the output that way, but I'm way out of my depth
as I've said. I just came up with the 9.1K resistor to make around 10K in
total between Vcc and the discrete transistor's base (9.1K + 1K pullup
resistor = 10.1K).

Please see following note in response to Rob about what I've come up with
by looking (more closely) at the LM311 spec sheet. There is a hint in there
that you were right about my arrangement reversing the polarity.

Cheers,

CF

(latest stuff at: www.copperleife.com/craig/tech/thermo/rp.htm)
 
C

CF

Jan 1, 1970
0
Excellent Rob! Thanks for simplifying the layout of my circuit. I knew it
was getting messy. I'd just finished drawing my own new version, and then
saw yours and had to go back and improve it a bit more (still messy, and
amateurish, but oh well). I think your layout is fundamentally sound. The
only thing that worries me is a note that comes with the National
Semiconductor spec sheet -- to the effect that when driving a ground-
referred load, the inputs are reversed.

Also, looking at the spec sheet today, I had, as I said, just finished
revising my own circuit by doing away with the transistor entirely.
Apparently the LM311's output can sink up to 50mA at 50V, so why bother
with an extra transistor for a 30mA relay? See this page for what I've come
up with, and a few snippets of the spec sheet including that note I
mentioned:

www.copperleife.com/craig/tech/thermo/rp.htm

Regards,

CF


[email protected] (Rob Paisley) wrote in
 
B

Bill Bowden

Jan 1, 1970
0
I'm looking for a bit of advice on a 741-based thermostat circuit that needs
some hysteresis, or lag between "on" and "off". I imagine this is a pretty
basic problem, but it's beyond my meager abilities.

I've posted the circuit and details at the following link. Any input, either
via the web interface or this group would be much appreciated.

CF

Please see:
www.copperleife.com/craig/tech/thermo

There are a couple thermostat circuits using the LM339 quad comparator
on my website here:

http://ourworld.compuserve.com/homepages/Bill_Bowden/page2.htm#therm.gif

-Bill
 
R

Rob Paisley

Jan 1, 1970
0
A basic design question if I may; Do you want the relay to turn ON or
OFF when the temperature is HIGH (the thermistor resistance is LOW)?

Rob.

------------
 
C

CF

Jan 1, 1970
0
Terry, no, I haven't got around to this yet, being seduced by the theory of
a more elegant revision based on an LM311 comparator IC. However, I would
like to get the 741 circuit working before butchering it.

Your second mod looks good, but I'm worried: By hooking up the feedback pot
as you have it -- where you've got the non-inverting input going through
its lower portion -- won't that drastically change the calibration of my
temperature pot? You'd be changing the total resistance leading into pin 3
on the IC by large amounts whenever you adjust the hysteresis feedback. At
present I have temperature gradations marked around the circumference of a
knob mounted on a front panel.

By the way, I get a "file not found" error on your third link, the one to
the 741HysteresisWave.gif image.

Cheers,

CF
 
Top