Op-amp comparator thresholds

Thread Starter


Joined Oct 7, 2011
Hi guys,

I am having trouble with what I assume to be a very simple problem. I am using an op-amp (LM348N) as a comparator. The chip is powered from a 50Hz, 12V source.

When the input voltage is higher than the reference, I expect close to 12V out, and otherwise, close to 0V. This is all fine except that instead of ~0V I get 3.5V. I realise that in practice the output will never reach the supply rails, but surely it can get closer than this.

Supply: 12V, 0V
Op-amp +: 1.5V
Op-amp -: 6V
Vout: 3.5V

When the threshold is met, Vout = 11.2V.

The 1.5V comes from a computer serial port - I have no idea what the waveform looks like. Grounding the input instead gives Vout = 2.0V. Is this as good as I'm going to get? I've tried various resistors around the place but I lack the experience to make any real educated guess.

Is the op-amp perhaps not cut out for this kind of use or are there any other issues or solutions you can see?

Thank you for your time!


Last edited:


Joined Nov 28, 2008
You have certainly selected the wrong Opamp. My Databook indicates that the LM348 is four 741 in a single package, so each Opamp follows the characteristic of the 741. Output of the 741 will not goes to zero or anywhere near it.

For a start the input lowest voltage of 741 is 3V higher than the negative rail, so that's 3V or more if the rail is at 0V. The highest input voltage is 3V less than the positive rail, so it will be 9V if the opamp is powered by 12V. Your input signal of 1.5V fails to meet the input requirement.

You would have much less problem if you use instead the LM358, which can accept 0V as its lowest voltage, but definitely not negative voltage, so makes sure that the input voltage from the serial port does not go negative.

If the signal might become negative, then a series resistor of 2K2 and a simple diode to 0V will take care of it.




Joined Nov 28, 2008
Won't that still allow the input to be -0.7 V? Is that a Bad Thing? I see on the LM358 data sheet Absolute Maximum Ratings that Input Voltage minimum is -0.3 V.
Yes, it is slightly out of spec but overall it is better than not doing anything.

You can use a 1N34 diode or some Schottky diodes instead to get it down to about -0.3V. To have true zero you will probably need to use a suitably biased transistor to work as a voltage clamp.