# Non zero output from LM358 even though input is zero

Thread Starter

#### Arbitrage

Joined May 3, 2021
17
Hi
I was using LM358 as voltage comparator in non inverting configuration
I gave 5V to vcc and 2.5V to inverting pin through a potentiometer
The issue is I am getting a output voltage of approx 3.8V even when the supply to the non inverting terminal is zero

I get output no matter I set the voltage of the non inverting pin zero or less than or more than that of inverting terminal
Also the ic gives the same output when non inverting is given some voltage and inverting is zero

The ic output gets zero only when both inverting and non inverting terminals are zero

Please help me to sort this

I desire to get high output only when the voltage at non inverting is greater than that at inverting i.e 2.5V

#### dl324

Joined Mar 30, 2015
15,536
I was using LM358 as voltage comparator in non inverting configuration
I gave 5V to vcc and 2.5V to inverting pin through a potentiometer
What was the voltage at the non-inverting input?
I desire to get high output only when the voltage at non inverting is greater than that at inverting i.e 2.5V
Are you expecting this high output to be VCC? Why are you using an opamp as a comparator? In addition to being slow, the output can never reach the positive rail. A comparator, such as LM393, would be a better choice.

#### Papabravo

Joined Feb 24, 2006
20,134
Nowhere is it written that ANY opamp will output 0 Volts, for a 0 volt input. There is a value in the datasheet called the "Input Offset Voltage" which tells you the approximate differential input voltage to get a 0 volt output. Consult any textbook on operational amplifiers for an in-depth discussion.

#### DickCappels

Joined Aug 21, 2008
9,867
The opamp seems to be working normally. 3.8 volts is about right for a "logic high" on the output of an LM358.

When the inverting (-) input is lower than the non-inverting(+) input the output will be the highest voltage the device can deliver (3.8V).

When the inverting (-) input is higher than the non-inverting (+) input the output will be the lowest voltage the device can deliver (0.2V)

If you need a comparator, the LM393 is a dual comparator that has the same pin-outs and the LM358 but it is designed to switch quickly between states. It also has an open collector output that can, with for example 1k load resistor going to +5V swing almost all the way to +5V provided you don't load it down too much.

#### Audioguru again

Joined Oct 21, 2019
5,819
If you bought the dual opamp from ebay, Ali or Amazon then it might be a fake (not even a dual opamp) or is defective.

#### crutschow

Joined Mar 14, 2008
32,054
What is the negative opamp power terminal connected to?

Thread Starter

#### Arbitrage

Joined May 3, 2021
17
What was the voltage at the non-inverting input?
Are you expecting this high output to be VCC? Why are you using an opamp as a comparator? In addition to being slow, the output can never reach the positive rail. A comparator, such as LM393, would be a better choice.
The signal voltage to be given at non inverting is around 4V
I was using opamp to reduce the need for pullup resistor at output

Thread Starter

#### Arbitrage

Joined May 3, 2021
17
What is the negative opamp power terminal connected to?
5V supply ,the same which is given to the vcc pin of the ic

#### ericgibbs

Joined Jan 29, 2010
17,419
hi A.
Look at this image.
E

#### ericgibbs

Joined Jan 29, 2010
17,419
hi A,
This is your circuit, please add the remainder of the circuit and repost.
E

#### crutschow

Joined Mar 14, 2008
32,054
5V supply ,the same which is given to the vcc pin of the ic
I meant where is the ground pin connected.

#### dl324

Joined Mar 30, 2015
15,536
The signal voltage to be given at non inverting is around 4V
That's outside of the allowed input voltage range. You should read the datasheet.

I was using opamp to reduce the need for pullup resistor at output
The maximum guaranteed output voltage is 3V from the positive supply, 2V in your case. Typical is 2V from the positive rail.

Saving a resistor isn't going to get you what you want.

EDIT: For a heavy load, the guaranteed high output voltage is 4V from the positive supply. 1V in your case.

Last edited:

#### ericgibbs

Joined Jan 29, 2010
17,419
hi Arb,
If you have an Hi impedance DVM , measure across the +IN and -IN pins of the LM393, post what you measure. Be sure to set the +IN to 0V .

E

#### ericgibbs

Joined Jan 29, 2010
17,419
Hi,
I assume you mean when Pin #3 of SL1 is zero volts, because Pin #4 is connected to 0v.?

Check my LTSpice drawing is correct..

You are not showing any power rail decoupling capacitors or the LM393 power pins.?

E

#### Attachments

• 55.3 KB Views: 6
• 29.3 KB Views: 7
Thread Starter

#### Arbitrage

Joined May 3, 2021
17
I replaced the opamp with LM393

The issue is when I test the comparator individually ,it works fine, i.e it will give output only when noninverting is greater than inverterting

But when I connect it in the whole circuit the same issue occurs of giving output when noninverting is zero

PLEASE HELP ME TO SORT IT

The four comparators marked in the circuit have issue

#### Attachments

• 22.4 KB Views: 6
Thread Starter

#### Arbitrage

Joined May 3, 2021
17
hi Arb,
If you have an Hi impedance DVM , measure across the +IN and -IN pins of the LM393, post what you measure. Be sure to set the +IN to 0V .

E
the in+ was reading 0.01V and in- was measuring 2.5V

Thread Starter

#### Arbitrage

Joined May 3, 2021
17
actu
Hi,
I assume you mean when Pin #3 of SL1 is zero volts, because Pin #4 is connected to 0v.?

Check my LTSpice drawing is correct..

You are not showing any power rail decoupling capacitors or the LM393 power pins.?

E
actually in eagle this was the only symbol available without power pins, I have given 5v to vcc pin

Thread Starter

#### Arbitrage

Joined May 3, 2021
17
Hi,
I assume you mean when Pin #3 of SL1 is zero volts, because Pin #4 is connected to 0v.?

Check my LTSpice drawing is correct..

You are not showing any power rail decoupling capacitors or the LM393 power pins.?

E
Pin 4 was also reading same 0.01 even after connecting to ground rail

#### ericgibbs

Joined Jan 29, 2010
17,419
hi,
You are not showing any power rail decoupling capacitors or the LM393 power pins.?
Are they on the actual circuit.

Post a photo of the project.
E

#### AnalogKid

Joined Aug 1, 2013
10,305
There is a GND symbol to the left of IC2A that probably should be connected to the bottom of pot R2, but is floating without a connection dot.

There MUST be capacitors on both the inputs and outputs of each voltage regulator. There should be decoupling capacitors close to the power pins of each IC.

Are any of the four circuits working correctly?

ak