# I am facing a problem while designing a Schmitt trigger circuit

I am applying a Schmitt-trigger to the waveform given in the figure below.

.

This is a 3.5 volt signal and I want to perform thresholding so I use 1.58 volts as upper threshold and 1.17 volts as lower threshold for my Schmitt-trigger circuit. My designed Schmitt trigger is given in the image below.

After applying Schmitt-trigger I was expecting a square waveform and it should be. But I got a signal that was not a pure square wave it was rounded from the top. the resulting waveform is as follows:

My question is why it is happening? Why I am not getting a square waveform as an output?

• Could you clarify the schematic? the values are those in red or in blue? Are you sure you mounted an LM339? it shouldn't be able to make such a waveform since it has an ouput only stage. Is seems the output from an opamp and not a comparator Mar 31, 2021 at 7:08
• Have you probed VDD at R6? I am guessing that it is not always 5V. The 5V may be sagging when the output is high, but the sagging wouldn't be caused by this circuit, but another circuit not shown. Do you have decoupling caps on your 5V? Mar 31, 2021 at 7:21
• What frequency is the signal and have you considered the RC effect of the scope probe. Mar 31, 2021 at 7:43
• red are the actual values and i have used lm339 ic. Apr 2, 2021 at 6:01

The LM339 has an open-collector output stage, which makes it's high state output value dependent on many things - none of which are the LM339 itself.

When the output is supposed to be high, the voltage level is dependent on VDD5B, R6, R7, R8, R9, the input voltage OUTB and its source impedance, and whatever OUT2 is connected to, its bias point voltage, and its impedance. As long as all of those details are secret, so is the reason the waveform top is not flat.

For example, if the waveform peak value is 4.5 V, then 167 uA of current is going somewhere. It cannot be going through R7, because that would create a 50 V voltage crop across the resistor. However, if whatever OUT2 goes to is held at approx. 2.8 V with a zero ohm source impedance, that would explain the output not being the full 5.0 V.

Disconnect R9 and see what the pin 1 waveform looks like.

Note - your schematic does not show the power supply rails for U1 or any power supply decoupling. These are important for proper operation.

Your 2nd figure shows that your output levels are of 4.5V. But according to datasheet lm339A is not rail to rail. So your max output should be of 3.4V. By changing the resistor R6 from 3K to 10K will solve the problem.

• The strange thing is that the LM339 is a pull-down only output comparator so the output should be much more than 4.5V. From the input side the 3.5V signal is on the limit of the VCC-1.5 limit but the 339 works fine if even one input is in the common mode range (it's specified) Mar 31, 2021 at 7:11
• Why do you think the max output should be 3.5 V? Have you read this in the datasheet? Apr 1, 2021 at 4:57