Making a Comparator Rail to Rail

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
Specifically a LM393 Dual Comparator, I tackled this once before but was uncomfortable that both comparators had to switch at exactly the same points, now there is only one comparator switching. The other is a slave.This is useful for driving MOSFETs, including logic level models, It would be useful for SMPSs for example.The triangle is any stable voltage between Vcc and ground.
LM393 Railto Rail.gif
 
Last edited:

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
This is a concept circuit, Just like the pinouts diagram on the side the use for the inputs are up to the end use.
 

ebeowulf17

Joined Aug 12, 2014
3,307
U2b inputs floating??
Took me a minute, but l think l get it. Connect whatever two signals you want compared to pins 5 & 6, and pin 7 would normally be an open collector output, capable only of sinking current.

The addition of Q1 inverts the original logic and also provides a current sourcing ability. The addition of U2A sinks current when U2B isn't.

Basically U2B is the master, and depending upon its output, the overall circuit's output either sinks current through U2A, or sources current through Q1.
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
yup, you got it. My next project is to show how something like this may be used based on a 1A constant current source @SgtWookie gave me for a 1W LED driver.
 

MrAl

Joined Jun 17, 2014
11,389
Specifically a LM393 Dual Comparator, I tackled this once before but was uncomfortable that both comparators had to switch at exactly the sane points, now there is only one comparator switching. The other is a slave.This is useful for driving MOSFETs, including logic level models, It would be useful for SMPSs for example.The triangle is any stable voltage between Vcc and ground.
View attachment 155032
Hello there,

I did something like this with an open collector TTL gate which had enough sink current but the normal pullup resistor could not be sized small enough to provide enough source current. It was also very fast.

The only problem i see with the circuit shown is that the second comparator has it's non inverting terminal connected to ground. That might work in a dual polarity supply system but in a single supply (like just +5v) i dont think it will work too well because the inverting input signal will never be able to go below ground.
Biasing the non inverting input to maybe 1/2 of Vcc would do the trick however.
Also, Q1 might need a resistor from base to +Vcc to make sure it turns off completely and also fast enough.
One more small point is that the comparator logic function is inverted. That can be fixed too.

The TTL version did not need such biasing because the input already had a greater than zero voltage switch point threshold.
It might also be possible to replace the second comparator section with something else too, like a transistor or logic gate.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,389
That triangle isn't meant to represent ground. See the comment in the original post:
Hi,

Thank you very much for pointing that out. My eyes are not as good as they used to be and that is a small drawing. However, i will still quote the original post for clarity:
"The triangle is any stable voltage between Vcc and ground."
That implies that ground is an acceptable voltage there, or if we want to get really strict in our spec then Vcc and ground are not inclusive, but that still means that 1uv is an acceptable voltage, which of course is not good. It also implies that Vcc minus 1uv is ok too, but it's not. I suggest looking up the input voltage range for the device being used, which could be as low as 3.5v with a single 5v supply for some devices.

So my original post is still somewhat valid but more clarity was a good idea :)

I also see another problem now too though. That is the shoot through problem that occurs sometimes with active pullups. When the lower comp section changes state, the second comp section takes some finite time to follow it which is going to be longer than the time it takes the transistor to switch states. That means at some point the transistor is 'on' while the second comp output is still low. This will result in a large shoot through current from +Vcc to ground where that current goes through the output transistor of the second comp section. It will be a short time (maybe a few microseconds) but it could be enough to cause damage because it will be a large current. It would be good to check the durability of the comp or op amp being used as to how it handles an output short to +Vcc, or else implement some limiting mechanism. Some devices may be able to handle this current.
 
Last edited:

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
Since Q1 is dependent on U1a and U2b switches after U2a as the signal propagates through both comparators I do not think shoot through will be an issue, I had thought of that. The timing is in the nanosecond range, but it is in my favor. Just don't put any capacitors in the path.

Generally the triangle is 1/2 Vcc but I didn't feel the need to define it at this point, It will have to be defined in any design that uses this idea.A resistor and diode would work just fine.

I've said this many times in the past but I love concept circuits This one may be useful. So I shared it, It is what I do.
 
Last edited:

dendad

Joined Feb 20, 2016
4,452
Would it help limit shoot through if you use the 2 comparators driven from the input, not one driving the other, but have their refs offset a little, as in a window comparator?
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
I am also trying for minimum parts count, and as I stated in my previous post I do not feel that shoot through is going to be an issue. Like I also said I don't want two comparators who may be subtly different each making a comparison. One comparator rules them all.
 
Last edited:

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
Or two I want pseudo ground firmly between Vcc and ground. An internal spec of mine I use regularly. Feel free to draw your version and post it. There is usually a fixed setpoint in any circuit, that can be used, just my thought.
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
Good enough, you must be in Oz. I have said this many times, I love concept circuits. They go into my library in my blog. I don't mind stealing ideas( er borrowing?) a bit. One way to learn new things.
 

MrAl

Joined Jun 17, 2014
11,389
Since Q1 is dependent on U1a and U2b switches after U2a as the signal propagates through both comparators I do not think shoot through will be an issue, I had thought of that. The timing is in the nanosecond range, but it is in my favor. Just don't put any capacitors in the path.

Generally the triangle is 1/2 Vcc but I didn't feel the need to define it at this point, It will have to be defined in any design that uses this idea.A resistor and diode would work just fine.

I've said this many times in the past but I love concept circuits This one may be useful. So I shared it, It is what I do.
Hi again,

Well i dont think it's in the nanosecond range it's more like in the microsecond range.

Here is the prospective problem time...

Pin 7 is high, pin 1 is low, Q1 base is high so Q1 collector current is near zero.
The input signals on U2b causes pin 7 to go low.
Pin 7 going low turns on the transistor almost immediately WHILE pin 1 is still low, causing a shoot through condition.
1us or more later, U2a reacts to pin 7 going low and it's internal circuitry releases pin 1 so the shoot through condition ends.

If we consider slew rate, at 0.5v/us the output of U2b STARTS to go low, and after it gets down by some 2v transistor Q1 starts to turn on, and depending on bias of U2a (as discussed before) U2a has not even begun to react yet, so it is still trying to keep the output low, thus causing the shoot through condition.
With a 10v supply that would mean Q1 starts to turn on when U2b output is 8v (probably before that) and if we bias to 1/2 Vcc we've got another 1.5us to wait before U2a even knows anything has changed. After that we have maybe 1us to react, then it's internal circuit starts to turn off the output drive, which could take a few more microseconds.
So all together we could see shoot through for 5us or more.

The key concept here is that Si transistors are MUCH faster than general purpose comparators and op amps like the LM358 for example, and the heat dissipation in U2a. With one or two switching actions, it may hold up, but with constant switching (10kHz or whatever) it may overheat due to the constant overcurrent.

Did anyone check the short circuit current of the output, or if it is allowed in the various devices?

I would suggest connecting the inputs of both op amps together anti parallel, except we'd still have to look at the slew rate issues and hope they can both switch at the same voltage difference.

Note that i understand that the original circuit was mostly conceptual and so it's a good idea to start with. I am just trying to elevate it from conceptual to the practical in order to make it actually useful.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,285
Did anyone check the short circuit current of the output, or if it is allowed in the various devices?
The TI LMx39x, LM2901xx Quad Differential Comparators data sheet states:

upload_2018-6-25_13-39-29.png

So it would appear that significant shoot-through currents should be avoided for those devices, at least at higher operating frequencies.

I agree that connecting the comparators with inputs in anti-parallel rather than series, will result in a shorter shoot-through time.

Below is the LTspice simulation of the two circuits with an LM339/LM393.
As can be seen, the shoot-through current is much higher for the series circuit.

Note that I used a high-speed saturated-switch transistor.
Using a general-purpose BJT such as a 2N3906 or 2N2905 will result in much higher and longer feed-through current pulses, due to their long saturated recovery time, as shown in the second simulation.

upload_2018-6-25_14-20-37.png

upload_2018-6-25_14-27-16.png
 

dendad

Joined Feb 20, 2016
4,452
As there is some slope to an input signal, even though it may be very little, can you try the sim again but with offset vref? This could help both outputs to not switch together.
Is it allowable to add a small R/C delay on the input to increase the delay?
The result of an offset would be a small period of high Z out, not a short across the power.
Oh, yes, I am in Oz :)
 

crutschow

Joined Mar 14, 2008
34,285
...can you try the sim again but with offset vref? This could help both outputs to not switch together.
Is it allowable to add a small R/C delay on the input to increase the delay?
Either one of those simple changes will give increase the non-overlap in one direction but add overlap in the other direction.
What you would need is a non-overlap circuit which adds a different delay to the pull-up circuit as compared to the delay on the fall. This could be done with an RC delay with a diode.

But interestingly enough, that delay does not seem to make a significant difference in the feed-through current spike, as can be seen in the simulation below, for different values of turn-on (output going low) delay for the upper comparator.
Even when there is a significant delay, the current spike is still seen.
So I suspect the spike is due to capacitive coupling through the transistor.

upload_2018-6-25_16-25-56.png
 

Thread Starter

Wendy

Joined Mar 24, 2008
23,415
OK, i really want to get away from using two comparators as comparators Nothing is ever exactly alike, even on the same die. It is very similar to the first scheme I drew and ultimately rejected. I am using the prorogation delay to prevent the shoot through issue. Your approach brings the issue back (I think). I do not use simulators, except the one between my ears.

Have you guys noticed we are up to 20 posts over this silly little circuit concept?
 
Top