LM393 comparator issue

Thread Starter


Joined Mar 6, 2009
Bill_Marsden: The trigger is a signal from a cam-sensor, I have watched the sensor signal from a oscilloscope and its a sinuswave, its when the negative part in the wave that gives the problem :(


Joined Nov 23, 2007
Perhaps during the negative part, the input signal is going below ground?
In this case it will be outside the supply rail range of the comparator and thus give an unexpected output?

I'm not sure 100% what you want to do with the sine wave, you seem to divide it (R3 & R4) and filter it (R3 & C1). Regardless, perhaps you should consider giving it a dc offset, e.g. in theoretical terms, connect one end to a 6 volt source. There are a variety of ways to do this in practice.


Joined Feb 24, 2006
Comparators and opamps all behave strangely with inputs which are outside the common mode range. Look in the datasheet for this parameter. It is actually a good thing that the simulation is doing the same thing as the real part.


Joined Mar 24, 2008
Try adding a variable resistor between the + voltage and pin5, to raise the threashold. I'm trying to figure how to add a clamping diode, but don't see it at the moment.


Joined Jul 17, 2007
The problem you are experiencing is common with older-design opamps and comparators; it's known as "phase inversion", but commonly referred to as "latchup" and "lockup" for the effect it has on servos being driven by opamps/comparators suffering from phase inversion.

Clamp the noninverting (+) input of the comparator to ground using a diode (Schottky preferred, such as a 1N5817); anode to ground, cathode to the noninverting input.

That way, when the input tries to go more negative than the Vf of the diode, the diode shunts current to ground and resistor R3 dissipates the input signal's power.

Thread Starter


Joined Mar 6, 2009
Well now I have tried both put a bias on the input + and a Schottky from input + to ground. They both work :D .

I think I will go with the diode method SgtWookie mentioned. Seems to be less sensitive on the amplitude from the sine wave, and there will not be any current passing the sensor :rolleyes:

Thank you a lot for your help !!! :cool::cool: This is a great forum :)