Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

OpAmp circuit for temp sensing using diodes

Status
Not open for further replies.

Elerion

Member
Hello everyone.

This circuit is used to detect a certain temperature level.
Honestyl I don't fully understand it. I know how it works, and how to use it, but I'd like to go deeper.
It is not a Schmitt trigger comparator (no positive feedback), nor a regular comparator ( why R3 / R2? ), nor a regular amplifier, but it seems a mixture of them.

I suppose it is based on the diodes' forward voltage decreasing with temperature (~2 mV per degree or so, I think).
As soon as the inverting input goes below non-inverting input, the output goes low, and triggers and external transistor driven circuitry.
In simulation, I tried removing the feedback, and it works, and also if attaching diode cathodes to ground (omitting the effect of R3). Of course, the response varies, but the basic function of voltage level detection/comparator is still there.

How should I face the analisys of this op amp topology?

Thanks!
 

Attachments

  • opamp_diode_temp.png
    opamp_diode_temp.png
    2.8 KB · Views: 145
74.png

Using a modern rail-to-rail opamp instead of the piece-of-crap 741, here is a plot of V(d) as a function of temperature for various values of VR1. Trying to do the analysis with a '741 is much harder, because its output pin cannot pull very close 0V or 10V.

Note that the gain is fixed. All adjusting VR1 does is to offset the temperature at which V(d) begins moving downward. Green is VR1=20K, Yellow is VR1=30K, and so on.
 
Last edited:
Yes. What I'm having some trouble is to understand the design process thought, and how to face the analisys of this circuit, not just by simulating, which very soon shows what's happening.

For example, the feedback resistor. What is doing is to slow down the transition (requires a larger temp variation). If removed, the transition is abrupt.

Also, why R3 and R4 ?
R4 places both inputs at a higher voltage, from ground.
Making R4 lower, slows the transition further.
R3 seems add some voltage gap between inputs. If made 2k, VR has to be increased to achive a similar thrigger temperature, and again the transition is much slower.

Ok, this seem to be facts, and I see that all those components and values play very well together. But I honestly wouldn't have known how to design it from scratch. And I think that fully understand how a circuit works (without simulations) is a very good way to reach there.

Any help or advice in this regard?
 
Start with opamp theory.
Anything that has negative feedback, will operate in linear fashion.
Rf is R3, and Ri is the theavenin equivalent of VR1, R2 and R3.

R1 is only there to set up the diode bias.

The circuit is lacking way to limit VR1 going to zero ohms. The simplest would be a 1K (or similar) resistor in series.
 
Rf is R3, and Ri is the theavenin equivalent of VR1, R2 and R3.

Isn't R4 the feedback resistor (output to non-inverting input) ?
For the Ri I get R2 || (R3+VR). Is it? But R4 also affects input impedance. Lowering its value, should decrease the input impedance.
 
For analysis, perhaps it helps to think of the circuit as a Wheatstone bridge which is kept balanced by the op-amp?
Bridge.png
 
Hello everyone.

This circuit is used to detect a certain temperature level.
Honestyl I don't fully understand it. I know how it works, and how to use it, but I'd like to go deeper.
It is not a Schmitt trigger comparator (no positive feedback), nor a regular comparator ( why R3 / R2? ), nor a regular amplifier, but it seems a mixture of them.

I suppose it is based on the diodes' forward voltage decreasing with temperature (~2 mV per degree or so, I think).
As soon as the inverting input goes below non-inverting input, the output goes low, and triggers and external transistor driven circuitry.
In simulation, I tried removing the feedback, and it works, and also if attaching diode cathodes to ground (omitting the effect of R3). Of course, the response varies, but the basic function of voltage level detection/comparator is still there.

How should I face the analisys of this op amp topology?

Thanks!

Hello,

Do you know how to do Nodal Analysis?
If you do that you get (R9 here is the pot, E1 the diode voltage, E2 the positive power supply voltage):
Vo=(E1*R2*R4*R9+E1*R1*R4*R9+E2*R2*R3*R9+E1*R1*R3*R9+E1*R1*R2*R9-E2*R1*R3*R4+E1*R1*R3*R4+E1*R1*R2*R4)/((R2+R1)*R3*R9)

So start with that:
Vo=(E1*R2*R4*R9+E1*R1*R4*R9+E2*R2*R3*R9+E1*R1*R3*R9+E1*R1*R2*R9-E2*R1*R3*R4+E1*R1*R3*R4+E1*R1*R2*R4)/((R2+R1)*R3*R9)

Substitute known values (for a ua741 E2 should be at least 10v and that is the positive power supply):
R1=100e3,R2=10e3,R3=1e3,R4=100e3,E2=10

we get:
Vo=(1000000.0*E1)/R9-909090.9090909091/R9+110.0*E1+0.90909090909091

Set the nominal diode voltage E1=0.6:
Vo=66.90909090909091-309090.9090909091/R9

Set Vo=0 and solve for R9:
R9=106250/23

insert that back into
Vo=(1000000.0*E1)/R9-909090.9090909091/R9+110.0*E1+0.90909090909091

and get:
Vo=326.4705882352941*E1-195.8823529411765

Now if you want you can set E1=0.6+dt where dt is the change in voltage for each change in degree C temperature.
The result for Vo is approximately -0.72v per degree C.

Note the typical positive power supply for a ua741 was either 10v or 15v but if you use a different op amp you can lower that if the op amp is known to work at the lower voltage.


Oh BTW the ua741 is not a good choice at all here since the minus power lead connects to ground. Look for a better op amp like at least the LM358.
 
Last edited:
Hello again,

Actually here is the entire solution when the output is zeroed for a given temperature:
Vo=((E1-Vd)*E2*(R4+R3+R2))/(E2*R3-Vd*R3-Vd*R2)

where E2 is the positive supply voltage, and
Vd is the zero temperature set point diode voltage,
E1 is the actual diode voltage.

Vd is the diode voltage where the pot is adjusted to provide a zero volt output.

This would be equivalent to holding the circuit at say room temperature, then adjusting the output for 0v output. Then as the diode is allowed to change temperature the output follows that law.

If you adjust for some output other than zero then it gets a little more complicated:
Vo=
(E2*R3*V1-E1*R3*V1-E1*R2*V1+E1*E2*R4-Vd*E2*R4+E1*E2*R3-
Vd*E2*R3+E1*E2*R2-Vd*E2*R2)/(E2*R3-Vd*R3-Vd*R2)

where V1 is the adjusted output voltage for some given reference temperature.

In both Vd is the voltage of the diode when the output is adjusted for some voltage and might typically be around 0.6v or so.
E1 is then the original voltage Vd plus the rise/drop in voltage typically -2.2mv per degree C.
 
I repeat the simulation with VR1 set to a mid-range at 50K, and plot all of the relevent nodes.

Look at the lowest plot pane. This is where the analysis has to start. Note that for a forward biased Si diode used as a temperature sensor, the voltage across the diodes is quite independent of the current through the diodes (Voltage is dependent only on the temperature) so the circuit responds to the forward diode voltage.

Analysis of this circuit has to account for its three regions of operation; where the opamp is railed high, where it is in its linear range, and where it is railed low. Only in the linear region can the opamp enforce the condition that the two inputs of the opamp V(a) and V(c) are equal. The opamp is railed high for temperatures less than 106degC, is railed low for temperatures greater than 140degC, and acts as a linear thermometer between those temperatures. You can see how difficult the analysis of this circuit if using a non-rail-to-rail opamp. The amplifier used in the sim is rail-to-rail in and rail-to-rail out.

The top plot pane clearly shows that the plots of V(a) and V(c) are equal only in the linear range. V(a) is connected to the non-inverting input of the opamp; V(c) to the inverting...

There was a time when I could write nodal equations, but here is a case where 10min with LTSpice will show you much more than hours with pencil and paper...


74b.png
 
Hi there,

Circuit simulators show us WHAT is happening at a given node, circuit theory tells us WHY that is happening.

For example in this circuit it may be hard to see why the diode appears to have a response that is not so much dependent on current as it is on temperature, but in theory there is a very very simple answer.
 
Not exactly in the focus of the OP but from my own experience anyway.

Many years ago I did test (maybe 30?) 1N4148 diodes, supposed to be from the same batch, measuring Vf drop, fed with a low constant current, the same for all of them, below 1 mA, controlled with a LM34. They were immersed in water (isolated, of course) going successively from 0º to 100ºC.

The file with the data is lost but I still recall this: the curve Vf wrt Temp was not precisely linear with the greater separation from the straight line between 0 and 100º occurring at around 60ºC.

Sorry but I do not remember any numerical values.
 
...Circuit simulators show us WHAT is happening at a given node, circuit theory tells us WHY that is happening...

Let us expand that a bit... Circuit simulators (just like measurements of the actual circuit) show us WHAT is happening at a given node.
It is only after you see how a relatively-complex existing circuit behaves, is it appropriate to apply theory in order to explain its behavior.

Now if someone walks up to you and asks you to design a circuit that meets certain specifications, I would start with circuit theory, design something, simulate it if I could, then bread-board it, and the measure its performance.
 
This is the sensible approach, Mike.

I would only add to your comprehensive list to READ the datasheets.
How many times have you seen in this forum (and others) a circuit which violates some essential component parameters, like in the example above, input common-mode range?
 
Not exactly in the focus of the OP but from my own experience anyway.

Many years ago I did test (maybe 30?) 1N4148 diodes, supposed to be from the same batch, measuring Vf drop, fed with a low constant current, the same for all of them, below 1 mA, controlled with a LM34. They were immersed in water (isolated, of course) going successively from 0º to 100ºC.

The file with the data is lost but I still recall this: the curve Vf wrt Temp was not precisely linear with the greater separation from the straight line between 0 and 100º occurring at around 60ºC.

Sorry but I do not remember any numerical values.

Hi there,

That sounds very interesting and would be nice to see the file.

There is a really good article written by the late Bob Pease one this which covers various aspects of the temperature characteristic. If you can find the link i wouldnt mind reading it again myself :)
 
Let us expand that a bit... Circuit simulators (just like measurements of the actual circuit) show us WHAT is happening at a given node.
It is only after you see how a relatively-complex existing circuit behaves, is it appropriate to apply theory in order to explain its behavior.

Now if someone walks up to you and asks you to design a circuit that meets certain specifications, I would start with circuit theory, design something, simulate it if I could, then bread-board it, and the measure its performance.

Hi,

Thanks for elaborating and i do appreciate that. I'll try to elaborate a little too here.

When i say theory helps us see WHY something is happening i mean that is because the mathematics often exposes certain characteristics of the circuit system which is not at all obvious even after many many simulations. There are various examples, but i'll hold off on that for now. One thing simulators really have a hard time helping with is optimization problems where we have three or more variables to deal with. Trying to juggle three variables around while looking for a certain response can take hours and hours and with no guarantee we got it right even after that.

An example i will quote though for now is in particular to this circuit. That is the approximate behavior of the diodes in parallel which appear to respond more to temperature than anything else. That's because of the 100k resistor, but a simulator will not tell us that unless we already know to look for that. Knowing how highish value resistors affect the circuits they are in tells us right away.
But also, theory tells us that three diodes placed in close proximity to each other behave as one single diode with a higher current rating, in theory.

So in the end, simulators are valuable but theory is even more valuable.
 
Hi there,

That sounds very interesting and would be nice to see the file.

There is a really good article written by the late Bob Pease one this which covers various aspects of the temperature characteristic. If you can find the link i wouldnt mind reading it again myself :)

File lost in a cab in Bayonne NJ. Next day, I recall buying a Time Sinclair 1000 during a fleeting visit to NY.

A new world of marvels did start that day!
 
Do you know how to do Nodal Analysis?
Now if you want you can set E1=0.6+dt where dt is the change in voltage for each change in degree C temperature.
The result for Vo is approximately -0.72v per degree C.

Using a lower resistor to bias the diodes (so the Vf is closer to 0.6) and using your value for the variable resistor, I get almost exactly half that value, -0.36V/ºC.

I didn't try to do nodal analysis. I usually use mesh analysis. But I thought that it would be a bit messy. I reciently tried to use it with several circuits, and I got such a complex relations, that I wasn't able to reach a usable formula, without solving numerically (which wan't what I was looking form). So that tempered me :)

I repeat the simulation with VR1 set to a mid-range at 50K, and plot all of the relevent nodes.

Look at the lowest plot pane. This is where the analysis has to start. Note that for a forward biased Si diode used as a temperature sensor, the voltage across the diodes is quite independent of the current through the diodes (Voltage is dependent only on the temperature) so the circuit responds to the forward diode voltage.

Thanks for the simulation. I also played for a while with it, and got a better understanding.

I was looking to be able to understand and describe the circuit, not quantitatively, but qualitatively. A textual description.
E.g. one of my difficulties was with R3. Obviously, we cannot place the diodes right across inputs, because the circuit won't ever work in linear region. Then, R4 is needed, because if diode cathodes are grounded, then the (+) input will be close to 0.6V (Vf) and so the (-) input will be too high, and the output will always be low.

You shared good advices. For me, this textual descriptions, like what I've just said, are very helpful even before simulating or doing formal analysis.

Rf is R3, and Ri is the theavenin equivalent of VR1, R2 and R3.

I still wander about "Rf is R3". Is it? For me, it is R4.

the curve Vf wrt Temp was not precisely linear with the greater separation from the straight line between 0 and 100º occurring at around 60ºC.

Interesting. I'd be using it close to 60ºC. But precise temperature is not required. +/-5ºC is, by far, just OK for me.

Using resistive sensors is easier. For example, a simple NTC let's us do without the opamp. Just a voltage divider, a transistor, and couple of resistors. But the transition from high to low would be more abrupt. This is something I like from this circuit.
 

Attachments

  • diode_temp_sim_4.6k_vr.png
    diode_temp_sim_4.6k_vr.png
    35 KB · Views: 107
File lost in a cab in Bayonne NJ. Next day, I recall buying a Time Sinclair 1000 during a fleeting visit to NY.

A new world of marvels did start that day!

Hi,

Oh that brings back memories. I had a blast when i got my Sinclair. Tried to use it for everything but the tape backup scheme wzs very slow. Eventually i went to a, yeah now old and forgotten too, a TRS80 ha ha. The operating system was on Floppy :)
 
Using a lower resistor to bias the diodes (so the Vf is closer to 0.6) and using your value for the variable resistor, I get almost exactly half that value, -0.36V/ºC.

I didn't try to do nodal analysis. I usually use mesh analysis. But I thought that it would be a bit messy. I reciently tried to use it with several circuits, and I got such a complex relations, that I wasn't able to reach a usable formula, without solving numerically (which wan't what I was looking form). So that tempered me :)



Thanks for the simulation. I also played for a while with it, and got a better understanding.

I was looking to be able to understand and describe the circuit, not quantitatively, but qualitatively. A textual description.
E.g. one of my difficulties was with R3. Obviously, we cannot place the diodes right across inputs, because the circuit won't ever work in linear region. Then, R4 is needed, because if diode cathodes are grounded, then the (+) input will be close to 0.6V (Vf) and so the (-) input will be too high, and the output will always be low.

You shared good advices. For me, this textual descriptions, like what I've just said, are very helpful even before simulating or doing formal analysis.



I still wander about "Rf is R3". Is it? For me, it is R4.



Interesting. I'd be using it close to 60ºC. But precise temperature is not required. +/-5ºC is, by far, just OK for me.

Using resistive sensors is easier. For example, a simple NTC let's us do without the opamp. Just a voltage divider, a transistor, and couple of resistors. But the transition from high to low would be more abrupt. This is something I like from this circuit.


Hi,

Yes it takes a bit of math to get to a simple solution. I should have mentioned that. But you see my solutions are not that complicated so it is possible. Sometimes it is harder than other times, and that makes simulators better for people who dont really like doing much math.

But what you could start with is an ordinary inverting op amp stage, with just two resistors. See if you can develop the formula we all know and love:
Vout=-Vin*R2/R1
where
R1 is the input resistor, and
R2 is the feedback resistor.

If you can get that formula, you are on your way to doing these circuits mathematically. One trick is to allow the gain to go to infinity, which gives you the theoretical result that is that above. If you dont do that, you end up with the op amp internal gain always in the equation which makes it more complicated and after all we are often after the theoretical result.

Nodal is very easy to understand and apply but it takes good organization of thought and writing of the equations. I could probably show you a method that you could pick up in a few minutes.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top