I wanted to replicate a comparator circuit to PCB and I later noticed that I mistakenly swapped the inverting and non-inverting inputs. The comparator used is LM2903. Surprisingly the board was still outputting normal besides with a lot of noise in rising and falling edges. The complete initial working circuit on a euroboard is as shown in below schematics:

enter image description here

To make the question more clear I simplified the original board as following:

enter image description here

And here its plots you can see hysteresis as well: enter image description here

So after that I replicated the board on a PCB but unfortunately swapped the inputs pin numbers 2 and 3. So below when the board is on PCB with swapped inputs: enter image description here

And here its plots:

enter image description here

The thing is the above LTspice simulations do not show big differences. But for the PCB version(inputs swapped version) when I check the rising and falling edges with a scope I see something like in below hand drawn plot:

enter image description here

It is like some oscillation is superimposed only during rising and falling edges.

Should I definitely swap back the inputs? Can the nosiy rising and falling edges be the result of such swapped inputs?


I swapped back to the original one and the issue disparaged. It was not easy to do on the PCB though it look ugly:

enter image description here

  • 1
    \$\begingroup\$ The initial circuit was a Schmiit trigger (ie had positive feedback). You revised circuit is NOT a Schmitt trigger. \$\endgroup\$
    – Russell McMahon
    Commented Apr 25, 2019 at 12:20

1 Answer 1


Your original schematic has positive feedback through R1. That introduces the hysteresis which is what you want to get a stable one/zero output signal.

In the "swapped inputs" version you get negative feedback. When the output voltage is between GND and Vcc the circuit behaves as a linear amplifier. So you see an amplified version of the input signal at the output.

It is also possible that oscillations occur when the circuit behaves as a linear amplifier. When the comparator is amplifying it has some gain (roughly 22k / (3.3k ||10k) = 8.8). However comparators aren't designed to be stable with feedback, they're designed to give you a lot of gain to get a precise comparison of the input voltages.

The effects (noise) that you do see on the PCB but not in the simulator can be due to a simplified model of the comparator. The model might not contain all the poles which the real chip has. Also noise is usually not part of the type of simulation you did.

If the input signal is lower than a certain value, the output of the comparator gets stuck on the lowest voltage it can do (like 0.5 V above GND)

If the input signal is higher than a certain value, the output of the comparator gets stuck on the highest voltage it can do (like 0.5 V below Vcc).

I think you should restore the original situation as that gives much better behavior.

Indeed the unexpected effects you see are the result of swapping the inputs.

  • \$\begingroup\$ You are right, I swapped back to the correct pin configuration on PCB and tried and it works without oscillation now. Had to cut traces and use wires for that i.sstatic.net/7GdwG.jpg \$\endgroup\$
    – user16307
    Commented Apr 25, 2019 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.