LM358 as a comparator output problem

comparatoroperational-amplifier

I've got an LM358 based ground fault detector circuit that I've recently revised, and the revision broke it, so far as I can tell.

To make a long story short(er), what it amounts to is using one of the LM358 stages as a comparator has whacky output levels. There's a 5 volt supply, and the inverting input has a 20k/100k voltage divider, for a fixed .833 volt comparison level. When the non-inverting input is 0 volts, I would expect the output to be 0. In fact, it's 4.32 volts. If I make the non-inverting input rise up above the threshold, it goes up to around 4.5 volts.

Now, the old version of the circuit had a 1N4148 diode on the output with a pull-down resistor to ground after that.

What is the diode and pull-down supposed to achieve? Why isn't an LM358 acting as I expect without it?

Best Answer

Not every op amp is perfect, nor is an op amp a good substitute for a comparitor. Please consider replacing it with an actual comparitor. As for why you should, that op amp must be pulled down with a 2KOhm resistor or higher in order to meet TTL logic specs (Vcc-1.5 = 3.5V in this case). It's in the datasheet. The Diode is there to prevent the op amp from sinking current and even out the H->L and L->H transition time.

As for why your output is not working. I'd have to see a diagram. From what you describe it should be working.