Comparing two comparators

MrAl

Joined Jun 17, 2014
11,474
This is my second version of the circuit, in which everything is exactly the same, except for the specific comparator being used. The first circuit is working perfectly alright, and the second one is the only one showing the symptoms. What's more, there are two identical circuits in each PCB, and the two present in the first version are behaving "as they should" whilst the other two at the second version are both oscillating.

What I think is happening is that my design is not perfect, and it definitely needs a feedback resistor so as to add hysteresis to it, But somehow the LM193 has been put in a borderline situation and somehow it manages to work the way I want it to.

So, yes, I will be adding a feedback resistor to my next build, and I'll also be changing the pot from 50k to 5k to minimize the possibility of oscillations.
Hi,

Wow that's truly amazing. Could anything else have changed without realizing it? Even wiring, capacitor type, resistor type, power supply, power supply filtering.

You know what is even more amazing aside from the comparative analysis is the analysis for first circuit. It is amazing that the first generation did not oscillate even without considering the second gen. I would have recommended hysteresis from the start of the design regardless which comparator was to be used. In fact, i find it almost impossible that the first circuit does not oscillate EVER.
I've worked with the LM339 (same type with 4 units inside) extensively and have never seen a design that did not oscillate at least for a short time without hysteresis.

What this leads me to ask is what is the means by which these circuits are being measured. How is it determined that either circuit is either oscillating or not. That could be the key to this mystery.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Hi,

Wow that's truly amazing. Could anything else have changed without realizing it? Even wiring, capacitor type, resistor type, power supply, power supply filtering.

You know what is even more amazing aside from the comparative analysis is the analysis for first circuit. It is amazing that the first generation did not oscillate even without considering the second gen. I would have recommended hysteresis from the start of the design regardless which comparator was to be used. In fact, i find it almost impossible that the first circuit does not oscillate EVER.
I've worked with the LM339 (same type with 4 units inside) extensively and have never seen a design that did not oscillate at least for a short time without hysteresis.

What this leads me to ask is what is the means by which these circuits are being measured. How is it determined that either circuit is either oscillating or not. That could be the key to this mystery.
Perhaps the first circuit does oscillate, but with a smaller amplitude. Either way, I'll be replacing the 2903's with a couple of 193 that I found laying around, and then I'll have a more complete picture of what's really going on.

But right now I'm out of town, and won't be getting back to my shop sooner than Thursday. I'll come back with a report as soon as I'm able to.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,502
I've just acquired 100 LM293P comparators (which have not yet been declared obsolete) for 12 dlls at Newark. They seem to have the same properties as the LM193, but with a narrower temperature working span, which my design will never exceed anyway.

I have not ignored the possibility of adding an hysteresis resistor, Bill. It's just that for now I don't want to dive into modifying the PCB I've already built, if I can avoid it.
OK on the purchase, it has worked that way before. I was thinking that the added resistor could simply be tacked onto the board. It might even work with just making the two holes bigger. But since I know nothing about who uses the system or just what it does those might not be acceptable options. But a surface mount resistor on the solder side of a circuit board, under an IC, could be both solidly anchored and almost invisible. Two useful properties in many instances.
 

MrAl

Joined Jun 17, 2014
11,474
Perhaps the first circuit does oscillate, but with a smaller amplitude. Either way, I'll be replacing then 2903 with a couple of 193 that I found laying around, and then I'll have a more complete picture of what's really going on.

But right now I'm out of town, and won't be getting back to my shop sooner than Thursday. I'll come back with a report as soon as I'm able to.
Oh that should be very interesting i would like to hear about that.

Just so you know, the military even in Israel allowed the use of parts on the back of single sided copper trace PC boards. The requirement was that jumpers had to be a minimum of #22 AWG and covered with teflon wire sleeving (spaghetti tubing) of the appropriate diameter, and small parts like 1/4 watt resistors were OK as long as the exposed leads were covered with same tubing, although for parts not on PC boards 1/2 watt resistors were preferred even if the power was much lower because of better mechanical stability.
 

ci139

Joined Jul 11, 2016
1,898
if i tested the LM139 oscillators etc. then sometimes the small capacitor (≥100pF but sometimes down to 15pF) to reference input - as your pot - solved some issues , while on other occasions the inputs didn't want to see any capacitance - you must test this out for your circuit

another thing is that - when the speed is not required - you can freely attenuate both inputs through 2kΩ up to 33kΩ in cases up to 100kΩ (if there is input cascade e.g. external diff.amp)
-- if the input compares the ramping signal . . . and there is supply noise it may help
-- if the ramp is in seconds . . . then a different method has to be used either the external hysterresis (kills precision) or something i have to seek up (that does not kill the precision . . .)

as for the LMx39 the input transistors are PNP -- then in the 1-st tests (at the beginning) i used 3 resistor inputs :
signal R1 : R2 GND and from the dividing point R3 to Vcc and divide point to the input of the LMx39
so it accepted wider (though attenuated) range towards Vcc

10 to 100Ω before +sup pin and 10n to 10u ? greater down from there (a supply filter -- if the output pulldown causes supply pulldown)

basically you need to play around with external feedback elements to seek out most stable configuration

random osc. biasing example (quite exact transistor model of LMx39)
LM293 - OCVC - TEST - S-0100s.png
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,043
adding one resistor is not a redesign of the whole circuit.
Based on the circuit in post #3, adding one resistor is not enough.

In a simple comparator-with-hysteresis circuit, hysteresis is created with positive feedback, feedback from the output to the non-inverting input. In the #3 circuit, the non-inverting input is connected directly to the wiper of a 50K pot that sets the circuit's trip point. This means that as the pot is rotated from one end to the other, the impedance seen by the non-inverting input goes from 0 ohms up to a max of 12.5K ohms at 50% rotation, then back down to 0 ohms at 100% rotation.

Hysteresis can be added to the circuit by adding "one resistor" from the output to the non-inverting input. The amount of hysteresis is a function of the ratio of this added series resistor to the shunt resistance that is the impedance of the pot. As above, this impedance changes as the trip point voltage is adjusted. This means that the amount of hysteresis will change as the trip point is changed. Since hysteresis added in this manner shifts the trip point(s) anyway, predicting the trip point at any particular pot setting is a more complex series of calculations.

This may or may not be acceptable to the circuit designer. I submit that a hysteresis circuit that is independent of any existing circuit adjustments is a better solution. Such a circuit needs more than "one resistor".

ak

Edit: corrected equivalent pot resistance at 50% rotation, per OBW.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,474
Based on the circuit in post #3, adding one resistor is not enough.

In a simple comparator-with-hysteresis circuit, hysteresis is created with positive feedback, feedback from the output to the non-inverting input. In the #3 circuit, the non-inverting input is connected directly to the wiper of a 50K pot that sets the circuit's trip point. This means that as the pot is rotated from one end to the other, the impedance seen by the non-inverting input goes from 0 ohms up to a max of 25K ohms at 50% rotation, then back down to 0 ohms at 100% rotation.

Hysteresis can be added to the circuit by adding "one resistor" from the output to the non-inverting input. The amount of hysteresis is a function of the ratio of this added series resistor to the shunt resistance that is the impedance of the pot. As above, this impedance changes as the trip point voltage is adjusted. This means that the amount of hysteresis will change as the trip point is changed. Since hysteresis added in this manner shifts the trip point(s) anyway, predicting the trip point at any particular pot setting is a more complex series of calculations.

This may or may not be acceptable to the circuit designer. I submit that a hysteresis circuit that is independent of any existing circuit adjustments is a better solution. Such a circuit needs more than "one resistor".

ak
Yes a second resistor is often used to create some impedance for the hysteresis resistor to work into. For example a second resistor from arm to non inverting input.
There is always some change when done this way. To avoid that completely the non inverting input can not be the adjusting input it has to be only used for the hysteresis and the inverting input used for the input itself. This may or may not be possible.
Sometimes the input adjustment range is small anyway though, so the hysteresis doesnt change that much.
 

OBW0549

Joined Mar 2, 2015
3,566
This means that as the pot is rotated from one end to the other, the impedance seen by the non-inverting input goes from 0 ohms up to a max of 25K ohms at 50% rotation, then back down to 0 ohms at 100% rotation.
A minor nit: I think that's actually 12.5K, the Thevenin equivalent impedance of a voltage divider with two 25K resistors.
 

MisterBill2

Joined Jan 23, 2018
18,502
Yes a second resistor is often used to create some impedance for the hysteresis resistor to work into. For example a second resistor from arm to non inverting input.
There is always some change when done this way. To avoid that completely the non inverting input can not be the adjusting input it has to be only used for the hysteresis and the inverting input used for the input itself. This may or may not be possible.
Sometimes the input adjustment range is small anyway though, so the hysteresis doesnt change that much.
I did not state that adding just the one resistor from the output to the positive input was an ultimate fix, just that it should work to stop the oscillation. Yes, without that second resistor the hysteresis will change some as the setpoint is varied, but that may not be a problem, especially since the system, I think, is usually run at one particular set-point.
 

ci139

Joined Jul 11, 2016
1,898
i tried to get the slow ramp ringing effect , but failed (i don't remember the exact circuit it strongly showed up 1-st)
but the sim. shows threats to watch out (this is the LMx39 simulation though not the LM2903)
LM293 - OCVC - TEST - S-0105s.png
 

MrAl

Joined Jun 17, 2014
11,474
did so ±200mV square wave to supply - nothing !? . . . ok i must have tested it somehow in the wrong sequence
View attachment 197457
Unfortunately if the particular spice model does not model power supply rejection ratio, then that test will not show anything.
What i meant was inject some noise into one of the input terminals. It can be very low level too but try a few different levels.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Update.

Just to inform all, I changed the LM2903P chips to the old LM193N that I finally found in a long forgotten box I had in my shop, and the oscillations are gone!. And not just that, I did notice that the LM2903P tends to drift over time (they eventually stabilize after a couple of hours), whilst the LM193N don't behave like that (at least in a noticeable way).

I haven't yet tested the LM293 that I bought from Newark because the circuit in question is no longer with me. But hopefully I'll be building another one in a few months.
 
Top