LM393 comparator issue #2

Thread Starter

Arijeet

Joined Dec 27, 2019
85
In my Lm 393 comparator, my output is not coming proper square wave.picture is shown below.i have described about my circuit. practically
I am using voltage comparator LM393 for comparing two signals, one signal is my reference signal which is a triangle wave, with voltages 2.08 volt generated by 555 timers above 200kHZ giving to the input terminal of inverting side of LM393 and input signal or modulating signal which voltage is less than 2.08 giving from function generator as a sinusoidal signal in the range of 1 Hz to 20kHz in the noninverting side of LM393. My question is when I am providing two signals it should be compared and give a square wave, but LM393 only taking triangle wave, sin wave is not going? why I don't understand. please give suggestion to the above points. In this picture below, I am referring to this circuit, please tell me what 's wrong in this circuit, when I am taking triangle wave from 555 timer ad providing into the comparator and another signal providing from the generator. IMG_20200628_200618-min.jpgFMY89PKJ3EPT09W.LARGE.jpg
 

MisterBill2

Joined Jan 23, 2018
18,167
One problem with the circuit is very clear, the second is not so obvious.
The first is the RC time constant and the value of the 10K ohm pullup resistor, relative to the input impedance of that 74HC04 inverter/buffer. The only thing pulling the output towards the 5 volts level is that resistor, which at best can supply 1/2 mA. Change the resistor to perhaps 680 ohms, (a standard value), or 500 ohms in the simulation, and the wave will look much more like a square wave.
NEXT, looking at the broad trace of the output, there may be a bit of oscillation during the transition. Connecting a high value (4.7 Megohms) resistor from the output, pin1, to the positive input, pin 3, should avoid the oscillation.

And if you replaced the 74HC04 with an MC14049 cmos device you could run the entire circuit on 12 volts DC.
 

Alec_t

Joined Sep 17, 2013
14,280
If getting vertical edges on the comparator output is important for this class-D application you might want to consider using a faster comparator than the '393.
 

MisterBill2

Joined Jan 23, 2018
18,167
That's a little low.
The LM393 output saturation voltage is measure with ≤4mA sink current, so I wouldn't recommend going above that.
The published spec in the Motorola databook says a max sink current of 20mA. OK, then try 1K ohm and it should work better at 5mA. Generally the databook is right. 500 ohms will draw 10 mA. Still, that scope trace looks rather thick, so there might be some much higher frequency oscillation going on as well.
And I am guessing that so far itis only a simulation.
 

MisterBill2

Joined Jan 23, 2018
18,167
But the saturation voltage is likely fairly high at that current.
The posted picture looks like a real scope display.
If the posted picture us a real scope display then indeed there is a high frequency oscillation present. And if the frequency of the big waveform is about 226 kHz then the oscillation is a few megahertz. THAT has to be causing some problems. It might even be that the other comparator in the package is oscillating. So immediately we can see that there are at least 2 problems that need to be taken care of: The way to large pull up resistor, and the lack of any hysteresis. Also, there is a lack of power supply bypass capacitors, which certainly can also lead to problems.
 

WBahn

Joined Mar 31, 2012
29,976
It looks like the 10-90 rise time is roughly 3 us, so a time constant of roughly 1.4 us. With a 10 kΩ resistor that means that the effective capacitance is about 140 pF. TI's data sheet shows a typical input capacitance of 3 pF with a max of 10 pF. No information is given about the actual circuit, such as whether it is on a PCB or a solderless breadboard or what, but that's quite a bit of stray capacitance and a frequency of 200 kHz isn't pushing solderless breadboards too hard.

It would be nice to see the actual input signals as well as the output signal to get a sense for how much overdrive there is. The LM393 can be pretty sluggish if there isn't much overdrive.
 

MisterBill2

Joined Jan 23, 2018
18,167
It looks like the 10-90 rise time is roughly 3 us, so a time constant of roughly 1.4 us. With a 10 kΩ resistor that means that the effective capacitance is about 140 pF. TI's data sheet shows a typical input capacitance of 3 pF with a max of 10 pF. No information is given about the actual circuit, such as whether it is on a PCB or a solderless breadboard or what, but that's quite a bit of stray capacitance and a frequency of 200 kHz isn't pushing solderless breadboards too hard.

It would be nice to see the actual input signals as well as the output signal to get a sense for how much overdrive there is. The LM393 can be pretty sluggish if there isn't much overdrive.
Do you suppose that the high frequency oscillation has some part in the problem???
 

WBahn

Joined Mar 31, 2012
29,976
Do you suppose that the high frequency oscillation has some part in the problem???
I don't know. It's hard to tell how much is even actually there versus what is an artifact of the scope and the probes and noise pickup.

Trying to clean things up by proper bypassing near the chips, tying unused inputs to well-defined values, minimizing stray capacitance, and trying to make as clean a measurement set up as possible are all very good things to address up front.
 

MisterBill2

Joined Jan 23, 2018
18,167
I don't know. It's hard to tell how much is even actually there versus what is an artifact of the scope and the probes and noise pickup.

Trying to clean things up by proper bypassing near the chips, tying unused inputs to well-defined values, minimizing stray capacitance, and trying to make as clean a measurement set up as possible are all very good things to address up front.
I doubt that the noise is an artifact. It is certainly on the display. Where in the circuit is the scope input common connected?
 

WBahn

Joined Mar 31, 2012
29,976
I doubt that the noise is an artifact. It is certainly on the display. Where in the circuit is the scope input common connected?
Or is it even connected? Or is the connection causing a ground loop? Those are the things that can cause artifacts in the display that are not actually in the signal. A capture of measuring a nearby ground pin could shed some light on things.
 

MisterBill2

Joined Jan 23, 2018
18,167
I think the high frequency shown is the switching frequency of a digital oscilloscope.
It is running in the single channel mode. PLUS that does not look like switching noise. And thatsort of switching system was old in 1964.

That looks like a high frequency oscillation. Which the comparator can do very well, by the way. BUT it may be coming from someplace else in the circuit.
 

MisterBill2

Joined Jan 23, 2018
18,167
Or what you see in the picture is just an artifact of the oscilloscope. It does not look noisy to me.
I have seen this before and it is not random noise, it is a much higher frequency oscillation.
A fast comparator with high gain and high impedance circuits will often oscillate. And I do know what oscillation looks like on a scope. A comparator with a slowly changing input and no positive feedback to add a bit of hysteresis will often oscillate.
 
Top