Triggering a comparator with a very slow RC circuit but needed fast slew on the output

Ian0

Joined Aug 7, 2020
13,243
Hi there Ian,

This problem comes up now and then and is related to the input(s) changing very slowly as that plays with the finite internal gain of the op amp or comparator.

For example, for a 1 volt input change it is likely that the comparator slew rate is the only limiting factor in how fast the output changes, but for a 1 picovolt input change the internal gain becomes a big factor because the output follows the input times the internal gain. In theory, the internal gain is often taken to be approaching infinity, and that means that even a 1 picovolt input changes causes the output to slew up (or down) at the maximum rate. If the slew rate was 1v/us then it would reach 5v in 5us. In a real device though, the gain may only be 100000, and 1pv times 100000 is only 100nv, which means the output is not going to change much yet. As the input rises to 2pv, the output rises to 200nv fairly quickly, but because the input is changing so slowly, there is still no significant output change. In fact, to get the output to slew up to 5v we would have to see an input change of at least 5/100000 or 50uv. This is why we usually see tests that provide a given input step change when taking about some aspects of the response.
In theory, but an LM139 is a decompensated LM358, which has an unspecified voltage noise estimated to be about 50nV/√Hz above 200Hz (increase below 200Hz due to 1/f noise) and probably at least 1pA/√Hz current noise. It has a gain of 200,000 which means it needs 25uV p/p for a 5V output. It won't take much additional noise from resistors, zeners, power supply etc. to generate 25uV at the inputs.
 

WBahn

Joined Mar 31, 2012
33,089
Not as of yet.

I am looking for an example but all i can find is schmitt trigger examples
I have a reference voltage threshold where as the schmitt trigger examples all seem to have the ref tied to ground.
As I said before, what you want is a Schmitt trigger!

You aren't giving us enough information to provide more details suggestions.

What is the circuit that you are currently working with that is not working like you think it should?

What is it that you need the circuit to do? How must it behave in response to your slowing changing input signal?

Why won't you provide this information?
 

MrAl

Joined Jun 17, 2014
13,777
In theory, but an LM139 is a decompensated LM358, which has an unspecified voltage noise estimated to be about 50nV/√Hz above 200Hz (increase below 200Hz due to 1/f noise) and probably at least 1pA/√Hz current noise. It has a gain of 200,000 which means it needs 25uV p/p for a 5V output. It won't take much additional noise from resistors, zeners, power supply etc. to generate 25uV at the inputs.
Hi,

That doesn't change the fact that a slow changing input will always cause a more or less linear operation. There's also the frequency response to consider, and the fact that noise average is going to be zero even though the noise peaks may be larger. If one noise peak cancels another before the frequency response allows the internal amplifier to respond, it's going to be the same deal.
I've actually seen this happen in real life. In simulation it should be easy to see.
Granted there could be other things happening here too though, I don't have the circuit right in front of me, and we don't even have a schematic yet (ha ha).
 

Ian0

Joined Aug 7, 2020
13,243
Hi,

That doesn't change the fact that a slow changing input will always cause a more or less linear operation. There's also the frequency response to consider, and the fact that noise average is going to be zero even though the noise peaks may be larger. If one noise peak cancels another before the frequency response allows the internal amplifier to respond, it's going to be the same deal.
I've actually seen this happen in real life. In simulation it should be easy to see.
Granted there could be other things happening here too though, I don't have the circuit right in front of me, and we don't even have a schematic yet (ha ha).
My experience of comparators is that jitter is always more of a problem than poor slew-rate, and that hysteresis cures both problems!
 

MrAl

Joined Jun 17, 2014
13,777
My experience of comparators is that jitter is always more of a problem than poor slew-rate, and that hysteresis cures both problems!
Hi,

I agree hysteresis is the universal fix. The only thing to consider then are the new trip points and how it affects the application.

By the way, in the past I have learned several times not to rely on noise as part of the solution.
In one application that I was handed, I had to find out why a solar max power tracker could not track the power sometimes but other times would work ok. It turned out that the original designer (who was no dummy though) used a synchronous counter which depended on noise to get the clock going. That was a mistake because sometimes the noise just was too low or really just wasn't there at all. Using an asynchronous counter solved the problem because it did not have to depend on any noise to work properly.
There are also issues with oversampling with ADC circuits because they rely on noise, but that gets a bit more involved. In short it is related to the noise shape.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
28,113
If the TS is unable to provide a circuit drawing, then at least a circuit description is called for.
Demanding "positive feedback" without any explanation is rather useless here because it seems that the TS has not implemented an actual comparator function. OR, it might be that the comparator is entering an oscillation mode, which is easy to do with an LM139 device if the wiring is not done right. By that I mean adequate bypass capacitors and low enough resistance connections. Consider that an LM339 will oscillate at several megahertz very easily.
And the comparator has an open NPN collector output, rather not like an opamp.

And unless I missed it there is no description of the circuit provided by the TS, only guesses by others. And really,knowing what the actual circuit consists of is needed in order to be sure of what the actual problem is.
 
Last edited:

MrAl

Joined Jun 17, 2014
13,777
If the TS is unable to provide a circuit drawing, then at least a circuit description is called for.
Demanding "positive feedback" without any explanation is rather useless here because it seems that the TS has not implemented an actual comparator function. OR, it might be that the comparator is entering an oscillation mode, which is easy to do with an LM139 device if the wiring is not done right. By that I mean adequate bypass capacitors and low enough resistance connections. Consider that an LM339 will oscillate at several megahertz very easily.
And the comparator has an open NPN collector output, rather not like an opamp.

And unless I missed it there is no description of the circuit provided by the TS, only guesses by others. And really,knowing what the actual circuit consists of is needed in order to be sure of what the actual problem is.
Hi,

Just to note, the problem described in the first post here in this thread is a known issue and so a known solution was suggested.
Slow changing inputs to comparators play with the trip points and can cause indeterminate output states. Because of this data sheets usually specify what step change they used to test.
BTW, I was not "demanding" I was merely "suggesting", but because this is a known issue it's the most likely solution. It could also be the Easter Bunny laid an egg on the IC package, but I figured without more information it was more likely the lack of hysteresis :D
 

MisterBill2

Joined Jan 23, 2018
28,113
"Positive feedback" on the comparator being triggered would consist of a resistor connected between the comparator output and the positive input . This resistor should be a much greater resistance than whatever other resistance is connected to that terminal.
In addition, the power supply connection to the comparator should be shunted by an adequate capacitance , usually 0.47mFD.
 

MisterBill2

Joined Jan 23, 2018
28,113
A text description of the comparator circuit would be adequate and easier to follow than some of the drawings I have seen. Like those that have every IC shown separately, with brief descriptions of the signal on each connection, all in a small font. A simple comparator circuit is easy to visualize from a description. Of course, knowing what it looks like does help.
 

MisterBill2

Joined Jan 23, 2018
28,113
Occasionally I lose track of which threads are from new-bees and which ones are from those with some experience who just need a bit of help.
 
Top