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
1632257534757.png
 

dl324

Joined Mar 30, 2015
16,845
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
21,159
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
10,153
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.
 

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
 

dl324

Joined Mar 30, 2015
16,845
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.
1632323609075.png
1632323638078.png
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.
1632323571289.png
1632323584107.png

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
18,766
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
 

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

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
18,766
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,986
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
 
Top