LM339 rail-to-rail output

ian field

Joined Oct 27, 2012
6,536
One of the input resistors needs a ground connection for the LM339's input bias current.

You don't need the 10k output resistor.
The current is already limited by the 10k resistor to +5V.
Not the last time I looked - unless you want to compare the input signal to 0V.

Its usual to provide one of the inputs with a Vref that can be obtained by various means. But I'm pretty sure I've seen examples of that input configuration in a few applications.
 

ebp

Joined Feb 8, 2018
2,332
RMS voltage is not necessarily related to peak voltage by any specific factor for variable reluctance sensors. The waveform depends on the physical shape of the things being sensed. A fine toothed gear will produce an output that is reasonably sinusoidal. Something like a sprocket will produce a much different waveform which dwells at zero for some significant part of the cycle.

ap note
http://www.ti.com/lit/pdf/snoa654
 

crutschow

Joined Mar 14, 2008
38,573
Anything with rail to rail common mode doesn't care where its inputs are - some don't like them to be too far apart though.
True, they don't care where the inputs are within the rail voltages under normal operating conditions.
But if they don't have a path for the input bias currents, then the inputs will go to one of the rails (depending upon the direction of the bias current) and the circuit will be saturated and not work.
If you don't believe give it a try with a real circuit.
 

ian field

Joined Oct 27, 2012
6,536
True, they don't care where the inputs are within the rail voltages under normal operating conditions.
But if they don't have a path for the input bias currents, then the inputs will go to one of the rails (depending upon the direction of the bias current) and the circuit will be saturated and not work.
If you don't believe give it a try with a real circuit.
Don't need to - seen a few commercial applications that already did it.
 

ian field

Joined Oct 27, 2012
6,536
I was pretty certain I saw 5V is 8.5V peak to peak. That is why I asked!
If your comparator is working correctly - the output is a square wave and the mean of the waveform is an entirely different equation.

A 50:50 square wave can be filtered to produce 1/2 Vcc - you can make PWM with 2 comparators, one generates a sawtooth, the other compares that sawtooth with the input level.
 

AnalogKid

Joined Aug 1, 2013
12,174
This is about as simple as the input can get. R2 prevents overdriving the input. The LM393 is a dual version of the 339. Just like it, its input common mode range extends below its negative rail, so GND can be use as a comparator trip point. The part has clamping diodes on the inputs, but National recommends an external diode to keep the input within 0.6 V of the rail, but some of National's app circuits do not show the diode. I show an external diode for completeness. If you change to an LM358/324, you no longer need R3.

ak
Comparator-Input-1-c.gif
 

wayneh

Joined Sep 9, 2010
18,127
Just like it, its input common mode range extends below its negative rail, so GND can be use as a comparator trip point.
Huh. I have not found that to be true in practice. I recall having to raise my reference point a few mV above ground. Rereading datasheet now...
 

AnalogKid

Joined Aug 1, 2013
12,174
Vee - 0.3 V (from memory). In practice, both the 393 and 358 have essentially identical PNP input stages, so it makes sense that things fall apart at Vee - 0.6 - ish. A common circuit to monitor a negative voltage with a positive-voltage-only monitoring system is to create a voltage divider from the positive reference voltage to the negative input, with 0 V as the trip point for the comparator. Been doing it for decades.

ak
 

wayneh

Joined Sep 9, 2010
18,127
Vee - 0.3 V (from memory). In practice, both the 393 and 358 have essentially identical PNP input stages, so it makes sense that things fall apart at Vee - 0.6 - ish. A common circuit to monitor a negative voltage with a positive-voltage-only monitoring system is to create a voltage divider from the positive reference voltage to the negative input, with 0 V as the trip point for the comparator. Been doing it for decades.

ak
Thinking more about the problem I had to solve, I think it was simply that I wanted to switch at 0V as you said. The switching was unreliable until I raised the other pin a few millivolts above ground.
 
Top