comparater HIGH state output not equal to supply voltage

So i am trying to use an op amp as a comparator. I tested it with a simple 5V circuit. I have an LM324N op amp IC with a potetiometer as a voltage divider on the non-inverting input side, and 2 1K resistors for a voltage divider set at 2.5V on the inverting input.

When I turn the pot below the 2.5V of the resistors, the output of the comparator is 0V exactly as it should be, but when i turn the pot above 2.5V, setting the comparator in the HIGH state, the output voltage doesn't equal the supply voltage but instead drops to 3.65V. I measured the supply to be exactly 4.96V.

Is there supposed to be a small voltage drop like this in a comparator or am I missing something?

any help would be awesome! :slight_smile:

Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components. Posting images:

From the headline specs of the datasheet:

Large Output Voltage Swing 0 V to V+ − 1.5 V

5v - 1.5v = 3.5v, so you're doing better than spec to get 3.65v...

You thought you had a rail-to-rail opamp? You don't. They exist, but that isn't one (the '324 is an ancient part).

But if you just want a comparator, why not use an LM339 (or LM393, the 2-channel version)? It's an open collector output, not push-pull, so you'd need a pullup resistor on the output, of course.

o ok i didnt even know that output voltage swing was a thing with opamps and comparators, im trying a 339n that i have right now.

If you want a comparator stick with a comparator.

The 339 is old but very good.

The 258 is similar to the 324 operational amplifier.

OpAmps like LM358 / 324 can only come up to 2 junction drops (about 0.65V each depending on temperature) below supply voltage, so 5V - 1.3 = 3.7 (about).

that makes sense because i just tried it on the 258 and the voltage was right around 3.7

this makes quite a bit more sense now

what would be the best comparator ic to use then 339 or is there a better one?

The 339 is excellent and there are 4 in one I.C.