Schmitt Trigger Functionality Not Working, Questions

comparatoroperational-amplifierschmitt-trigger

I'm trying to build a Schmitt trigger like the one described here: http://pcbheaven.com/drcalculus/index.php?calc=st_nonsym_sp

However, it isn't working as expected, and I'm thinking it may be due to a number of reasons, only a few of which I have a suspicion of. It would be a great help if someone could advise me on how to properly build a Schmitt Trigger because I'm quite new to this and don't have much experience.

  1. I used a LM358 op-amp from TI, which I'm thinking might not work because I'm not sure if it's a two-rail op-amp. I don't know exactly why a two-rail op-amp is necessary, but a couple of videos I have watched mentioned that it was necessary.

  2. The resistors I used have relatively small values. In the PCBHeaven link I posted above, R1 = 1kOhm, R2=10kOhms, and the feedback resistor was 10kOhms as well. I don't know why this matters, but might it have something to do with saturation of the op-amp? I really don't know.

I'm more frustrated because I see certain videos floating around online such as this one: https://www.youtube.com/watch?v=-JW1fv2O73A and the circuit set up seems pretty much exactly the same as mine, save for the larger resistor values and the different op-amp.

I know that the Schmitt Trigger is supposed to output either a high or low logic level when the thresholds are passed, however I'm not observing this. For example, if I supply the op-amp with 5V and also make V+ 5 volts, I observe the following results:

When input voltage = 5V, output voltage = 2.85V
When input voltage = 0V, output voltage = 3.91V
When input voltage = 3.3V, output voltage = 3.91V

Which are extremely confusing results, especially since none of those values are near 0V as I would expect to represent a logic low. I become more confused when I directly test the functionality of the op-amp by comparing the negative and positive terminals, and the op-amp correctly produces a logic high when the positive terminal > negative terminal, and produces a logic low when negative terminal > positive terminal.

If anyone has any idea or suggestions for where I went wrong, or have general advice for building a Schmitt Trigger, please let me know!

Best Answer

Just plug those resistor values into the calculator you linked in your question and look what happens: -

enter image description here

The thresholds are switching between about 4.2 volts and 4.6 volts - that's the first thing - your input needs to be able to cross those boundaries for your circuit to switch.

Next, take a look at the LM358 data sheet and you'll see that input voltages are only valid between 0V and 3.5V (on a 5V supply) - don't expect this to do what you want when the input is above 3.5 volts.

Next take a look on the d-sheet to see what the output can do on a 5V rail, The d-sheet implies the highest output voltage that it can muster is typically 2V below the positive rail i.e. 3V.

My estimation is that your circuit is kind of working but maybe with the invalid 5V input in scenario 1, you get a weird inversion thing going on (it happens a lot on op-amps).

Welcome to the imperfect world of real op-amps!!

Try lowering thresholds to around 2V and 2.5V and see what happens when the input rises above 2.6V - I'd expect the output to swing down to 0V. When the input drops below 1.9V, I'd expect to see the output swing above 3V.