I have designed a schmitt trigger circuit using an op-amp where the output switches from 0 - 5V based off an input hysteresis from 2.2 to 2.8V.

My circuit correctly switches at the correct voltages however the output magnitude is 3.6V instead of 5V. What would be the best way to resolve this, I have tried using a non-inverting amplifier after the output stage, but still get around the same output voltage of 3.6V.

enter image description here

  • 2
    \$\begingroup\$ tl;dr rail to rail op amp is needed \$\endgroup\$
    – user20088
    Sep 26, 2016 at 12:15
  • \$\begingroup\$ You can create a Schmitt trigger tailored to your exact requirements using two transistors and a few resistors. The math is not hard - I did it when I was a kid. Instructions here and probably in a lot of other places on the web. \$\endgroup\$
    – Mick
    Sep 26, 2016 at 15:08

4 Answers 4


The LM358 op-amp will not swing it's output to the positive supply rail. The top "transistor" in the package is configured as a Darlington-pair and this is your problem: -

enter image description here

Even if the base of Q5 could reach +5V, its emitter would be 0.7V below 5V and therefore Q6's base would be also 0.7 volts below 5V and, in turn, Q6's emitter would be 1.4 volts below 5V = 3.6 volts.

Next, you say that the schmitt trigger works off an input hysteresis from 2.2 to 2.8 V. I have to disagree.

If the comparator were able to reach 5 V on the output (as you appear to have assumed originally) then the upper threshold would be: -

5V x \$\dfrac{R3}{R3+(R2||R4)}\$ = 2.705 volts

The lower threshold would be 5V x \$\dfrac{R3||R4}{R2+(R3||R4)}\$ = 2.295 volts.

Clearly, at a lower output voltage this shifts the range down but you were never ever going to see a top threshold of 2.8 volts. How did you calculate it?


LM324 op-amp internals, with output transistors circled

Figure 1. The internals of an LM324 op-amp. The output transistors are circled.

An op-amp is usually not a good choice for a comparator. Figure 1 shows part of the problem. When the output is pulled high by Q6 turning on the maximum voltage it can reach is V+ less the voltage drop across Q6. Since Q6 is arranged as a voltage follower of Q5 which is itself driven by the current source the total voltage drop could be two or three volts. Modern op-amps can be a lot better but the pull-up and pull-down can be quite weak as you get close to the supply rails.

The other problem is that op-amps usually aren't designed to run in this configuration. If driven to the supply rails they can latch up and take a short while to get back out of saturation. This would affect the frequency response of the unit and introduce a switching delay.

enter image description here

Figure 2. Inside of the LM193 comparator.

Comparators on the other hand are designed specifically for comparator applications (obviously) but don't suffer the latch-up problems of op-amps and, since the output requirement is usually a logic interface the output stage is designed accordingly.

Many comparators use an open-collector output which has a very strong pull-down and the pull-up strength can be determined by the user by selection of resistor value.

The main reason for using open-collector is so that several comparators can have their output connected together in a wired OR gate. All the open collectors can be tied together to a single resistor without any conflicts between comparators. This would not have been easy to do when your comparator has also the capability to source current at its output.

This wired OR gate is useful for detecting ranges of voltage, for example, when you want your output to be low when the signal is below a value or above another value. Credit: Why do they usually make comparators open collector?.


Have you tried using an amplifier that goes to 5v?

In the bad old days, most amplifiers would only go to within a volt or two of the positive rail, LM324 for instance.

These days, you can get amplifiers that swing rail to rail (R2R) on the output.

Post a schematic of your circuit (the 'diode/resistor/capacitor/pencil' button next to the 'mountains and sun' picture button), and then we can all stop guessing.


Replace the part with an inexpensive LMV358 and the output swing will be much more like 0-5V. Note that the maximum supply voltage is 5.5V for the LMV358.

You may be able to get partway there with a 4.7K pullup resistor on the LM358 you have. Simulations in LTSpice don't show it working, but they are not always accurate (because this mode takes the upper transistors into reverse bias which is not a normal operating mode). It will no longer go as close to the negative rail, however, more like +600mV. Again, simulation does not accurately reflect reality, but anything much more than the fixed 50uA sink will cause the output to rise a diode drop or so.

As far as the hysteresis goes- the R2/R3 divider looks like a 2.5V source with 5K (10K||10K) in series. You want 0.3V drop with the output at 0V so the current is 60uA (0.3V/5K) and the resistor R4 must be ~36K (36.666.. = 2.2V/0.06A).


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.