1
\$\begingroup\$

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!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Add a schematic, that would help people help you. \$\endgroup\$ May 17, 2015 at 21:07
  • \$\begingroup\$ Will you please stop being coy? Why say "2.The resistors I used have relatively small values." and then not tell us what those values are? \$\endgroup\$ May 17, 2015 at 21:19
  • \$\begingroup\$ The sentence I wrote after the sentence you quoted contained the resistor values I used. \$\endgroup\$
    – Phil
    May 17, 2015 at 21:20

2 Answers 2

2
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you a lot for your response! This was extremely helpful. Although I know that I am never technically crossing the two thresholds, shouldn't I still observe a change when I input a voltage of 5V and a voltage of say, 3.3V for example? As in, shouldn't the 5V input give me a logic low and the 3V inputs gives me a logic high? Or is this all irrelevant because the above 3.5V inputs completely screw up my op-amp behavior? \$\endgroup\$
    – Phil
    May 17, 2015 at 21:25
  • \$\begingroup\$ Going outside the recommended limits may screw things up. It is well known that some op-amps will invert their outputs when inputs are taken beyond the recommended limits. See this tutorial analog.com/media/en/training-seminars/tutorials/MT-036.pdf - I'm not saying the LM358 is susceptible to this but it's worth getting input levels right to rule that out. \$\endgroup\$
    – Andy aka
    May 17, 2015 at 21:32
  • \$\begingroup\$ @Andyaka The LM358 will invert output if you bring the non-inverting input below ground by a diode drop (output goes high). \$\endgroup\$ May 17, 2015 at 21:52
0
\$\begingroup\$

If, as you describe, you see sensible behaviour when you run the amp open-look, then you can stop worrying about rail-to-rail stuff and different types of op-amp.

Work up in steps - you've done the first one, which is just to do +>- and ->+.

Next arrange a voltage divider (two resistors) to supply the + input, and verify that the output does what you expect as you move the - input up and down past the voltage on the input.

Finally start to add a little bit of feedback: start with a high resistor and check things still work properly - what you should see is that the + input voltage changes slightly when the output changes between high and low.

All that's happening with a Schmitt trigger is that you're arranging the output to bend the threshold voltage (the + input) up and down slightly as the output changes - it's the feedback resistor which does the bending. The feedback resistor is commonly quite a lot larger than the potential divider resistors, because you're usually only trying to have a small influence on the divider's centre-point voltage.

Something like 10k for each divider resistor and 100k for the feedback should give you some kind of easy-to-interpret results. Very roughly-speaking, this would give you the following behaviour:

  • Without the feedback resistor, you'd have 2.5V at the centre of your divider, so the output would switch as the -ve input moved across 2.5V.

  • With the feedback resistor fitted and the output high (-ve input low), you'd have about 2.6V threshold voltage - that's because you've got 100K and 10K in parallel at the top of the divider, so it looks like roughly 9K over 10K.

  • With the feedback resistor fitted and the output low (-ve input high), you'd have about 2.4V threshold voltage (because the divider looks like 10K over 9K).

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the response! I forgot to mention that when I use a multimeter to directly measure the positive and negative terminals, the positive terminal can be at a value such as 5V, and the negative terminal will be at 4.6V or something of the sort, and the output voltage will only be at something like 680 mV when it should be outputting a logic high. \$\endgroup\$
    – Phil
    May 17, 2015 at 21:19
  • \$\begingroup\$ You need to be driving the -ve input with something (bench supply or pot perhaps) - that's the input to the circuit and you mustn't let it float. \$\endgroup\$
    – user1844
    May 17, 2015 at 21:20

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.