# Over 0V Comparator With Unipolar Power Supply?

Joined Oct 26, 2012
254
Great! So i can just connect Vref to ground to get over 0 detection, correct?
Is this inverting? Can i simply switch the inputs for non-inverting?
Can you help me understand the role of each R?
RL just means impedence of whatever i'm connecting to externally, and not necessarily an explicit R in this circuit, correct?
thx!

#### dl324

Joined Mar 30, 2015
10,525
Can i simply switch the inputs for non-inverting?
If I understand you correctly, yes.
Can you help me understand the role of each R?
R2 feeds back a portion of the output to prevent oscillations at the trip point.

Joined Oct 26, 2012
254
Thx! So i trim R2 to adjust the amount of oscillation?

i'm guessing Vth1 is amount of hysteresis on the upswing, and Vth2 is amount of hysteresis on the downswing, correct?

#### Alec_t

Joined Sep 17, 2013
11,146
So i can just connect Vref to ground to get over 0 detection, correct?
Not necessarily. It depends whether the input offset happens to be positive or negative. In one case the trip point would be slightly above ground, whereas in the other case the trip point would be slightly below ground.

Joined Oct 26, 2012
254
It depends whether the input offset happens to be positive or negative.
Is that a characteristic of the chip? Or the circuit?

#### dl324

Joined Mar 30, 2015
10,525
Is that a characteristic of the chip? Or the circuit?
The chip. If you want the manufacturer to screen parts, you're getting into the military grade testing and price. That $0.25 comparator is going to cost more than 10 times more. Thread Starter #### johnyradio Joined Oct 26, 2012 254 The chip. If you want the manufacturer to screen parts, you're getting into the military grade price testing. That$0.25 comparator is going to cost more than 10 times more.
The specs indicate the offset tolerances, as discussed.
If we assume 20 mV, then i just need to ensure my trip point is more than 20 mV above ground, and then i can switch the inputs. Correct?

#### dl324

Joined Mar 30, 2015
10,525
If we assume 20 mV, then i just need to ensure my trip point is more than 20 mV above ground, and then i can switch the inputs. Correct?
Not quite. The spec said +/- 9mV. You could get one where the offset is in the direction that makes your 20mV above ground need to be 29mV.

If you require very tight observation of parameters, you should consult the datasheet for the specific manufacturer. Not all "direct replacements" would have exactly the same specifications. We normally design circuits to be tolerant of variations. When we need tighter control, we either pay the manufacturer to do extra testing or we do 100% testing ourselves (or cherry pick parts).

Joined Oct 26, 2012
254
Not quite. The spec said +/- 9mV. You could get one where the offset is in the direction that makes your 20mV above ground need to be 29mV.
Thx for that!

If you require very tight observation of parameters, you should consult the datasheet for the specific manufacturer. When we need tighter control, we either pay the manufacturer to do extra testing or we do 100% testing ourselves (or cherry pick parts).
As mentioned, OTS tolerances are acceptable for my application. I just need to compensate by my choice of R's, correct?

Now that we have a passable solution using the LM393, i must say i'm surprised there isn't a simple way to get tighter over-0V tolerances. Only because 0V seems different than other V's, because, well, it's 0. And because in this case it's the supply limit. So it seems a special case. But i understand that in the analog world, 0 doesn't always equal 0
Is there a common part other than a comparator which can detect over-0V?
thx

#### dl324

Joined Mar 30, 2015
10,525
Is there a common part other than a comparator which can detect over-0V?
Not likely. You're using a jelly bean part; nothing special and good for general purpose applications. If you have more demanding applications, you start looking for parts with parameters for which you have specific requiements.

LM395 LM393 are perfectly good zero detectors. You may be having unreasonable expectations or are asking for something you don't need. For zero crossing, we usually don't specify zero crossing to mean within 10's of mV (1uV is unrealistic for most circuits). In general, zero crossing circuits are trying to minimize surge currents, but they don't expect them to be exactly zero. It's all about expectations. Some are important/reasonable, some aren't. The key is to spec for things that matter.

EDIT: corrected typo.

Last edited:

Joined Oct 26, 2012
254
LM395 are perfectly good zero detectors.
Did you mean LM393? The LM395 is a power transistor.

You may be having unreasonable expectations or are asking for something you don't need.
As mentioned, OTS tolerances are acceptable for my application.

zero crossing circuits are trying to minimize surge currents
That's to do with load, correct?

#### dl324

Joined Mar 30, 2015
10,525
Did you mean LM393? The LM395 is a power transistor.
Sorry, typing too fast and didn't proofread. Yes, LM393.
That's to do with load, correct?
Usually. Some applications that send signals over power lines (like X10) choose to send data at the zero crossing.

Joined Oct 26, 2012
254
Some applications that send signals over power lines (like X10) choose to send data at the zero crossing.
i'm unclear how that would affect this circuit.

#### dl324

Joined Mar 30, 2015
10,525
i'm unclear how that would affect this circuit.
It doesn't. I just gave you an example where the zero cross detection didn't have anything to do with a load.

Joined Oct 26, 2012
254
It doesn't. I just gave you an example where the zero cross detection didn't have anything to do with a load.
ok, i thought it was an example of current surge affecting the circuit. That's what i don't understand.

Joined Oct 26, 2012
254
This works. Great! Switches at 10mV.
The output isn't inverting, but it is offset by -5V. That is, LOW = -5V, HIGH = 0V, which isn't desired.
How to make the outputs 0 and 5V?

Update: Someone on Stack noticed the sim part has no power pins, and is thus assumed to have -5V and +5V power. That may explain why output is offset by -5V.

Last edited:

Joined Oct 26, 2012
254
(I can move this question to a new post, if that better.)

This is the same circuit, but with an oscillator sweep on the input. It's not triggering the comparator, even though it goes to 0V, same as the previous circuit.

Why won't this trigger?

http://tinyurl.com/qrvgdrz

Last edited:

#### Alec_t

Joined Sep 17, 2013
11,146
Give the triangle generator a DC offset of less than 2.5V, so that its output goes below 0V. Perhaps the generator sim model allows for non-ideal behaviour.
That simulator is weird. The comparator output voltage is always negative, yet the feedback voltage to its V+ input is always positive!