Electronic – LM358 (as comparator) output voltage less than supply voltage

comparatoroperational-amplifier

I've setup a simple circuit with an LM358 configured as a comparator (the ground rail and supply connections are off screen).

Schematic:
enter image description here

Breadboard: (in case I wired something wrong)
enter image description here

Measured values:

V+ = 4.97V (expected)
GND = 0V (expected)
In(-) = 2.47V (expected, via voltage divider)
In(+) = 4.97V (expected)
Output = 3.63V (???)

Here's the pin mapping for your convenience:
enter image description here

Since 4.97V is greater than 2.47V I was expecting the output to be 4.97V. Why is it 3.63V? Is this normal for this particular op-amp or am I doing something wrong?

I've tried looking through the datasheet but I'm new to this stuff so I'm not sure what to look for.

Best Answer

LM358 is not a rail-to-rail output op-amp, so you should not expect it to produce an output near the positive supply voltage.

Unfortunately, the datasheet doesn't go out of its way to make this obvious. The main clues are:

  • Nowhere on the front page does it claim to have rail-to-rail outputs.

  • Figure 10 on page 10: enter image description here

    This shows that if only modest currents are sourced from the output, the maximum output voltage is about 1 V below the upper supply voltage.

Edit: You might also have some issues from not hooking up the second op-amp. It could potentially oscillate and affect the behavior of the op-amp you are using. The typical way to deal with this is simply hook it up as a follower with nothing connected to its output.