# Op-amp comparator thresholds

#### matt9862

Joined Oct 7, 2011
2
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.

Numbers:
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?

Matt

#### Attachments

• 9.4 KB Views: 33
Last edited:

#### eblc1388

Joined Nov 28, 2008
1,542
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.

#### Attachments

• 2.1 KB Views: 78

#### matt9862

Joined Oct 7, 2011
2
eblc1388, thank you so much for your help. Serves me right for just using what I had lying around I guess.

#### colinb

Joined Jun 15, 2011
351
If the signal might become negative, then a series resistor of 2K2 and a simple diode to 0V will take care of it.
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.

#### crutschow

Joined Mar 14, 2008
34,067
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.
If you limit the current is should be ok. I would use about a 20KΩ resistor instead of a 2k2.

#### eblc1388

Joined Nov 28, 2008
1,542
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.