element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Test & Tools
  • Technologies
  • More
Test & Tools
Blog OpAmp as Schmitt-trigger
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Test & Tools to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 25 Jan 2025 6:29 PM Date Created
  • Views 4444 views
  • Likes 16 likes
  • Comments 23 comments
  • art of electronics
  • opamp
  • schmitt-trigger
Related
Recommended

OpAmp as Schmitt-trigger

Jan Cumps
Jan Cumps
25 Jan 2025

A Schmitt-trigger is a circuit that turns a non-perfect digital signal into a clean one. It has 2 main functions:

  • recreate a good fast ramp for signals that have lost their oomph (or never had clean fast edges). 
  • provide a bit of hysteresis, so that signals with significant noise can be restored to proper high and low

There was a recent design of shabaz that uses Schmitt-triggers:  Brush and Large-Area Multi-Meter Probes for PCB Reverse-Engineering: A DIY Approach! . The Art of Electronics (AOE) happens to explain that very circuit. A good excuse to check it out.

image
image source: The Art of Electronics 3rd edition p. 237 - fair use

Schmitt-triggers have a set level where they consider a signal high or low. The main difference with a comparator circuit, is that they also introduce hysteresis. Output will switch when the input reaches a particular level, but it will not switch again until the input has dropped below a different, lower, input level. An engineer will define the two levels so, that the noise on the input will never cause a state flip.

image

image source: TI Application Brief Understanding Schmitt Triggers - fair use

For this post, I'm recreating the AOE design based on an OpAmp (identical to Shabaz', just with different levels and operating voltage), The only change I made is the desired voltage level. I brought that down from  5 V to approx. 3.3 V, because that's in the range of my signal generator. I use the very common UA741 in this design, because I have a through-hole one. In a real design, you'd probably use a more modern one that can work on lower voltages, and can drive its output to the rails. And is faster (see jc2048 ' comment).

This is an inverting design. The output drives low when the input is high.

The circuit

It's virtually the same as the AOE design. But R1 is 20K instead of 10K, OpAmp voltage 10 V. 

image


image
images: the actual circuit that I set up on a breadboard.

Results

Test with an input that is noisy, and migrates to both upper and lower levels multiple times:

image
image source: the design successfully cleans up a noisy test signal from my waveform generator

The yellow trace is the input. I have chosen a signal that is noisy on both low and high level. I've set it so that it has glitches on both sides of the hysteresis range. The magenta trace is the output. It's a nice "digital" signal, with fast edges and little noise. Because I used the imperfect UA741, signal does not reach ground or VCC. The Blue trace is the set point. You can clearly see that the output level influences the comparison point.

Operation: this is an OpAmp with positive feedback. R3 feeds the output back to the + input. That "escalates" the OpAmp. When the input crosses the set point, it immediately goes to the rail voltage (or as close as it can get to it).

R3 also has another effect: It influences the set point, because it is either connected to the positive or ground rail. When output is low, R3 will pull the set point down a little. When output is high, it will pull it up somewhat. That's what generates the hysteresis. Set point and hysteresis width are function of the 3 resistors values (and by how close the OpAmps can drive to the rails).

  • Sign in to reply
Parents
  • jc2048
    jc2048 7 months ago

    I've never owned a copy of tAoE. Perhaps e14 could offer one or two as a prize in a P14 competition.

    Good blog, but...

    "it immediately goes to the rail voltage"

    not with a 741 it doesn't. The slew rate is less than a volt per microsecond, and that's slower than the recommended input transition rate even for a slow logic like HCT. In practice it would probably happily work anyway (for a personal project), but there's a danger the input might oscillate during the transition.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 7 months ago in reply to jc2048

    Yes, it's too slow for real world applications:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 7 months ago in reply to Jan Cumps

    The situation is worse than that because, if the output is driven to saturation, there's a recovery time before it will do anything again: op amps like that weren't designed to slam the outputs into the rails - the presumption was that you had it operating linearly.

    Another problem was output inversion - some of these old bipolar op amps had the unfortunate tendency to invert the output if one of the inputs went slightly below the negative supply rail - that's something to do with a path that opens up between the collectors of the input transistors in the differential pair (can't remember the details).

    The final thing I can think of is that something like a 741 won't operate sensibly off a low logic supply voltage, so you'd have to find a way to level convert the output (though with CMOS logic you could probably arrange something safe with resistors and a few switching diodes).

    The slew rate problem is still there to some extent even with modern op amp parts, because it comes from having the internal compensation, though they'd be fast enough for HC logic.

    BTW I'm not saying don't use an op amp as a comparator. With the circuit you and Shabaz are exploring it's fine. In an analogue context, an audio synthesizer maybe, it's fine. And for showing how you achieve some hysteresis, as you're doing here, it's great. But if you're running into logic think carefully whether it's really the best solution to what you're trying to do - you may find that a purpose-designed part is a better option (no internal compensation to slow things down, and has an output stage designed as a switch for speed).

    Do Horowitz and Hill cover all this (the pros and cons of using op amps as comparators) in their book?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • jc2048
    jc2048 7 months ago in reply to Jan Cumps

    The situation is worse than that because, if the output is driven to saturation, there's a recovery time before it will do anything again: op amps like that weren't designed to slam the outputs into the rails - the presumption was that you had it operating linearly.

    Another problem was output inversion - some of these old bipolar op amps had the unfortunate tendency to invert the output if one of the inputs went slightly below the negative supply rail - that's something to do with a path that opens up between the collectors of the input transistors in the differential pair (can't remember the details).

    The final thing I can think of is that something like a 741 won't operate sensibly off a low logic supply voltage, so you'd have to find a way to level convert the output (though with CMOS logic you could probably arrange something safe with resistors and a few switching diodes).

    The slew rate problem is still there to some extent even with modern op amp parts, because it comes from having the internal compensation, though they'd be fast enough for HC logic.

    BTW I'm not saying don't use an op amp as a comparator. With the circuit you and Shabaz are exploring it's fine. In an analogue context, an audio synthesizer maybe, it's fine. And for showing how you achieve some hysteresis, as you're doing here, it's great. But if you're running into logic think carefully whether it's really the best solution to what you're trying to do - you may find that a purpose-designed part is a better option (no internal compensation to slow things down, and has an output stage designed as a switch for speed).

    Do Horowitz and Hill cover all this (the pros and cons of using op amps as comparators) in their book?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • Jan Cumps
    Jan Cumps 7 months ago in reply to jc2048

    I may set up the circuit with a more reasonable opamp I have, and try to find the timing parameters. I have an LM324n through-hole.

    I won't set up the 741 circuit anymore to get at the timings. that one was used in the blog because I had a set of them readily available (and because 741 topics draw attentionSlight smile). Maybe one of our fellow community members can try that out.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 7 months ago in reply to jc2048
    • Do Horowitz and Hill cover all this (the pros and cons of using op amps as comparators) in their book?

    From memory: yes. I'll re-check that section.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz 7 months ago in reply to jc2048

    I thought this was interesting: I tried to reverse-engineer an old circuit (1980's) and noticed an unusual application of op-amp comparators: being used for RS-232! As you say, this was HC logic interfacing era. 

    I didn't fully trace out the circuit since I didn't need the full detail, so not sure if they had added hysteresis. Plus I'm not too sure about that chain of diodes and resistors, I could have made a mistake. I only reverse-engineered just enough to realize that they were using them for digital level conversion for the RS-232 outputs. I was thinking why, but then realized chips like MAX202 were probably way too new back then. Plus, the particular customers would have wanted second-sourced parts to be available, which would have been easier with these op-amps.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 7 months ago in reply to shabaz

    Not seen that before. MC1488 and MC1489 were the standard IC parts for RS232 line driver/receiver back then, until Maxim came up with the one with the switched-capacitor converters to derive the line voltages on-chip from the +5V.

    The 4049 input is using the static protection as a clamp to each rail, which isn't really good practice, but would work ok with a 10k current-limiting resistor.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz 7 months ago in reply to jc2048

    Hehe I think the MAX202 in PDIP package was amongst the first ICs I ever used (well, amongst the first dozen perhaps; 741 or 555 must have been the actual first IC I used). I made myself a 68HC11 dev-board, and used MAX202 for the comms. 

    Regarding the 4049, I believe the circuit is doing things like wake-on-RS-232-activity and needed to conserve power (this is portable equipment) so that may have driven them to using it on the input side.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube