I built the following circuit using an LM393 as part of a noise gate for audio applications. It's a voltage comparator with hysteresis.

I originally connected a 10 kΩ pull-up resistor and then added a 5 mm UV LED to serve as a visual reference. The circuit worked fine like this, however, if I remove the LED and connect the 10 kΩ pull-up resistor directly to the supply, the output doesn't swing low and gets stuck on its high state.

I've tried adding 1N4148 diodes in anti-parallel to the pull-up resistor, in reverse from the output node to ground, and I also tried substituting the LED with a 1N4148, but neither worked.

Schematics (hand drawn)

Here's a picture of my protoboard with the UV LED:

Picture of the protoboard

Here are two oscilloscope captures of the input and output signals:

Input signal: Square wave with fast rising edge and slow falling edge

Output signal: constant high voltage(?)

  • \$\begingroup\$ Show us what you actually built. \$\endgroup\$
    – brhans
    Sep 27, 2019 at 1:27
  • \$\begingroup\$ Try building it the way it works: with the LED in series with the resistor. Ensure that it works correctly. Then, and only then, just put a short across the LED. Don't move any wires, don't pull anything. Just a solder blob or jumper wire across the LED. Then see what happens. \$\endgroup\$ Sep 27, 2019 at 1:36
  • \$\begingroup\$ A scope is an extremely useful tool for troubleshooting these kinds of problem. If you have a scope available, try to capture pictures of some of the circuit nodes with the circuit working as well as not working. Add those pictures to your original question. Good luck! \$\endgroup\$ Sep 27, 2019 at 1:38
  • \$\begingroup\$ What voltage levels does the input signal "w" swing between? Try varying your 12V supply with the circuit both working and not working. I'm thinking that the nominal 2V to 3V voltage drop caused by the LED may be affecting the comparitor thresholds (feedback via the 470K resistor back to the (+) input). \$\endgroup\$ Sep 27, 2019 at 1:41
  • \$\begingroup\$ @brhans There it is :) \$\endgroup\$
    – Raz
    Sep 27, 2019 at 1:41

3 Answers 3


Without the UV LED dropping about 3V, the voltage at your non-inverting input will never drop below your reference at the inverting input unless your input drops below about -1.1V - so as a result the output will never swing low.

With no LED there and the input grounded, simple voltage divider calculations show that the non-inverting input voltage will be 4.89V (greater than your 4.24V reference).
With an LED dropping 3V and the input grounded, the non-inverting input voltage will be 3.67V.

You either need a much larger value pullup resistor, or much smaller Ri and Rf resistors for your circuit to work as intended.

  • \$\begingroup\$ Yes, the trick is the diode drop, I posted my own answer :) \$\endgroup\$
    – Raz
    Sep 27, 2019 at 2:33
  • \$\begingroup\$ I didn't make Rf and Ri smaller because I previously had made them small and that caused weird rises and drops in voltage at the input whenever the comp changed states, for example, I would use a pot as a divider from B+ to control the input signal, and let's say that the comp triggered at 1V and 5V, whenever the input reached 1V and the comp triggered to low, the input suddenly jumped to say 0.8V, then when I turned the pot to increase the input, when it reached 5V an the comp triggered to high, the input suddenly jumped to say 5.5V \$\endgroup\$
    – Raz
    Sep 27, 2019 at 2:39
  • \$\begingroup\$ And I don't think that making the pull-up resistor larger would solve the problem because the problem arises when the output is high meaning the collector inside the LM393 would be open, meaning no current would flow to drop any voltage across it, right? Perhaps there is a small leakage current, but it would be so small that the resistor would need way to large to drop the necessary amount, which could cause other problems like slower switching times due to stray capacitance or more mains hum being picked up \$\endgroup\$
    – Raz
    Sep 27, 2019 at 2:50
  • 1
    \$\begingroup\$ @Raz - you're forgetting that the output resistor forms one piece of a 3-stage a voltage-divider between your supply and input with Rf and Ri when the comparator output is open. \$\endgroup\$
    – brhans
    Sep 27, 2019 at 2:53
  • \$\begingroup\$ Aaahh you are right! \$\endgroup\$
    – Raz
    Sep 27, 2019 at 2:56

Let's analyze the circuit with the output "high" (open circuit for the output transistor).

We have 12V through 10K in series with 470K to the non-inverting input and some voltage W connected through 330K. At the instant of switching, the non-inverting input will be at 4.27V. So the current through the 480K is 12V/480K = 25uA. That means the input W must be at 4.27V - 25uA * 330K or about -4V for it to switch.

The situation when the output is pulled up through the LED (forward drop maybe 3~4V) will be 7~8V/480K or >16.7uA through the 480K so the input W must be at 4.27-16.7uA * 330K or about -1.2 for it to switch.

In no case should it switch with input W in the range 0-12V once it's in the low state, but it will be a lot closer with the "UV" LED in there. If you stick your fingers onto the resistors at the inputs, there likely be enough mains pickup to get it to switch, especially in the second case.

Once it switches, the output will be low, say 0V for simplicity, an input of about about 7.3V will switch it on (just a voltage divider yielding 4.27V).

So the prediction is (with LED shorted or an additional resistor 10K from output to +12)

on at +7.3V

off at -4V


As hinted originally by Dwayne Reid and further explained by brhans and Spehro Pefhany, the problem was that with out the LED, the voltage fed back to the input was high (11.94V), the diode drop lowered this to 9.64V which was enough to make the comparator trigger properly. One of brhans' solution was to make Rf and Ri smaller, however, before this problem I had another one where the input voltage increased and decreased suddenly whenever the comparator changed states, and not just by the input signal alone, which was solved by using larger Rf and Ri values. Another solution proposed by him was to make the pull-up resistor larger to drop more voltage in the voltage divider formed with Rf and Ri, however, this resistor will dictate the charge and discharge times of parts that will follow after this circuit's output and that have already been calculated, so I would need to adjust all of that too.

My solution was to simply connect a resistor from the output to ground to divide the output voltage to a lower value, after adjusting a pot as a variable resistor I found that a 47k would be perfect, the working circuit below with high and low voltages:

enter image description here


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.