Electronic Circuits and Diagrams-Electronic Projects and Design

Op-Amp Comparator

In this post we will be discussing about the op-amp as a comparator.We have already discussed other applications of the op-amp in rectangular wave form generator circuits like  astable (or free-running) multivibrators ,  monostable multivibrators  (or one-shot) and bistable multivibrators (or flip-flops).

To get a better understanding of operational amplifiers click here:- Operational Amplifiers (Op-amp) 

Op-amp Comparator

A comparator finds its importance in circuits where two voltage signals are to be compared and to be distinguished on which is stronger. A comparator is also an important circuit in the design of non-sinusoidal waveform generators as relaxation oscillators.

In an op-amp with an open loop configuration with a differential or single input signal has a value greater than 0, the high gain which goes to infinity drives the output of the op-amp into saturation. Thus, an op-amp operating in open loop configuration will have an output that goes to positive saturation or negative saturation level or switch between positive and negative saturation levels and thus clips the output above these levels. This principle is used in a comparator circuit with two inputs and an output. The 2 inputs, out of which one is  a reference voltage (Vref) is compared with each other.

Working of 741 IC Op-amp Comparator Circuit

Non-inverting 741 ic op-amp comparator circuit.

A non-inverting 741 IC op-amp comparator circuit is shown in the figure below. It is called a non-inverting comparator circuit as the sinusoidal input signal Vin is applied to the non-inverting terminal. The fixed reference voltage Vref is give to the inverting terminal (-) of the op-amp.

When the value of the input voltage Vin is greater than the reference voltage Vref the output voltage Vo goes to positive saturation. This is because the voltage at the non-inverting input is greater than the voltage at the inverting input.

741 IC Non-Inverting Comparator Circuit

When the value of the input voltage Vin is lesser than the reference voltage Vref, the output voltage Vo goes to negative saturation. This is because the voltage at the non-inverting input is smaller than the voltage at the inverting input. Thus, output voltage Vo changes from positive saturation point to negative saturation point whenever the difference between Vin and Vref changes. This is shown in the waveform below. The comparator can be called a voltage level detector, as for a fixed value of Vref, the voltage level of Vin can be detected.

The circuit diagram shows the diodes D1and D2. These two diodes are used to protect the op-amp from damage due to increase in input voltage. Thes diodes are called clamp diodes as they clamp the differential input voltages to either 0.7V or -0.7V. Most op-amps do not need clamp diodes as most of them already have built in protection. Resistance R1 is connected in series with input voltage Vin and R is connected between the inverting input and reference voltage Vref. R1 limits the current through the clamp diodes and R reduces the offset problem.

741 IC Op-Amp Non-Inverting Comparator Waveform

 Inverting 741 IC Op-amp Comparator Circuit

An inverting 741 IC op-amp comparator circuit is shown in the figure below. It is called a inverting comparator circuit as the sinusoidal input signal Vin is applied to the inverting terminal. The fixed reference voltage Vref is give to the non-inverting terminal (+) of the op-amp. A potentiometer is used as a voltage divider circuit to obtain the reference voltage in the non-inverting input terminal. Bothe ends of the POT are connected to the dc supply voltage +VCC and -VEE. The wiper is connected to the non-inverting input terminal. When the wiper is rotated to a value near +VCC, Vref becomes more positive, and when the wiper is rotated towards -VEE, the value of Vref becomes more negative. The waveforms are shown below.

Op-amp 741 IC Inverting Comparator Circuit

 Comparator Characteristics

1. Operation Speed – According to change of conditions in the input, a comparator circuit switches at a good speed beween the saturation levels and the response is instantaneous. 

2. Accuracy – Accuracy of the comparator circuit causes the following characteristics:-

(a) High Voltage Gain – The comparator circuit is said to have a high voltage gain characteristic that results in the requirement of smaller hysteresis voltage. As a result the comparator output voltage switches between the upper and lower saturation levels.

(b) High Common Mode Rejection Ratio (CMRR) – The common mode input voltage parameters such a noise is rejcted with the help of a high CMRR.

(c) Very Small Input Offset Current and Input Offset Voltage – A negligible amount of Input Offset Current and Input Offset Voltage causes a lesser amount of offset problems. To reduce further offset problems, offset voltage compensating networks and offset minimizing resistors can be used.

Related Posts

3 great books to learn 555 timer circuits and projects, 555 timer circuits and projects – list of 25+ simple and advanced circuits, 15w class b audio amplifier, 14 comments.

Hi I would like to build voltage amplifier as well as regulator using lm741. The input would be 50 mv to 50 volt. The input pulses per min would be 1-30000. The output pulse should be regulated 5 volt at all frequencies and voltage inputs. There would be only +12 volt source for powering the op-amp & not the -12v. i.e the pin #4 will be grounded. the output from pin#6 would go to the micro-controller as it requires 5 volt. Plz if you could build the schematics for me.

The clamp diodes D1, D2 are useless. R1, R are useless as well. There is nothing to protect about inputs. The 741 OpAmp doesn’t need this kind of input protection since its input differential voltage equals the supply voltage(30V).

IN THE NON INVERTING CIRCUIT THERE IS A ROLE FOR R1 AS IT DRIVES THE INPUT VOLTAGE SO WE CANT NEGLECT IT RIGHT

D1 and D2 are for protesting the input stage of the Comparator IC. R to take care of input impedance to take care of offset voltage R1 to set the threshold voltage for triggering the output. Please go through a good text book on operational amplifiers.

It is very useful.Thank you.

I need a ckt to compare TWO AC signals. but both signals are varying…. i dont have refrence.

Use a dual trace oscilloscope

it helps….thanks

very informative and clear description about op-amp as comparator.

It helps me to know more about the op-amp in the form of comparators ., as a result i earened good mars in my exam. 🙂

its so useful for the students like me.i want to know more about the working principle of the microcontroller AT89c51

excellent explanations….

Type above and press Enter to search. Press Esc to cancel.

  • Network Sites:
  • Technical Articles
  • Market Insights

op amp comparator experiment

  • Or sign in with
  • iHeartRadio

All About Circuits

  • Analog Lab - Voltage Comparator

Join our Engineering Community! Sign-in with:

  • DIY Electronics Projects

Analog IC Projects

  • Analog Lab - Introduction
  • Analog Lab - Precision Voltage Follower Using an Op Amp
  • Analog Lab - Non-inverting Amplifier
  • Analog Lab - High-impedance Voltmeter
  • Analog Lab - Op Amp Integrator
  • Analog Lab - 555 Oscillator (Astable Multivibrator)
  • Analog Lab - 555 Ramp Signal Generator
  • Analog Lab - PWM Power Controller
  • Analog Lab - Class B Audio Amplifier

In this hands-on electronics experiment, you will build an analog voltage comparator circuit and learn how open-loop operational amplifiers function.

Project overview.

In this project, you will build the analog comparator circuit, illustrated in Figure 1.

Schematic diagram of an analog comparator with LED indicator.

Figure 1. Schematic diagram of an analog comparator with LED indicator.

This analog comparator circuit uses an open-loop operational amplifier (op amp)  to compare two voltage signals and determine which one is greater. The result of this comparison is indicated by the output voltage, which turns on or off a light-emitting diode (LED) .

Parts and Materials

  • Operational amplifier, model 1458 or 353, recommended
  • Three 6 V batteries or an 18 V power supply
  • Two 10 kΩ potentiometers , linear taper 
  • One 330 Ω resistor
  • One 470 Ω resistor

This experiment only requires a single op amp. The models 1458 and 353 are both dual op amp units, with two complete amplifier circuits housed in the same 8-pin DIP package.

I recommend that you purchase and use dual op amps over single op amps even if a project only requires one because they are more versatile (the same op amp unit can function in projects requiring only one amplifier as well as in projects requiring two). In the interest of purchasing and stocking the least number of components for your home laboratory, this makes sense.

Learning Objectives

  • How to use an op amp as a comparator
  • Understand the open-loop operation of an op amp

Analog Comparator Theory of Operation

As illustrated in the schematic diagram of Figure 1, the two potentiometers are used to adjust the positive and negative input voltages of the op amp. The op amp compares these two input values and outputs either a high or low voltage based on the following relationships:

$$V_+ - V_- > 0 \text{ then } V_{out} = \text{ high}$$ 

$$V_+ - V_- < 0 \text{ then } V_{out} = \text{ low}$$ 

The open-loop output voltage of the op amp is given by:

$$V_{out} = Gain \cdot (V_+ - V_-)$$

Open-loop means that there is no feedback from the op amp output to either of its inputs. Op amps have very high open-loop gain, often on the order of 10,000 or more. Therefore, even a small difference in the input voltages will typically result in the op amp output saturating at either its high or low limits near the upper and lower supply voltages, respectively.

The output status of the op amp is indicated visually by the LED. When the op amp output is high, the LED will be forward-biased and turn on. When the op amp output is low, the LED will be reverse-biased and turn off.

Instructions

Step 1:  Build the op amp circuit illustrated in Figures 1 and 2. 

Breadboard implementation of the analog comparator with LED indicator.

Figure 2. Breadboard implementation of the analog comparator with LED indicator.

The resistors connected to the output of the op amp limit the current through the LED.

Step 2: Adjust the two potentiometers and observe the LED. From this, you should be able to easily confirm the function of the op amp comparator circuit as described above.

Step 3:  For greater insight into this circuit’s operation, you might want to connect a pair of voltmeters to the op amp input terminals (both voltmeters referenced to ground ), as illustrated in Figure 3.  

Measuring the operational amplifier input voltages created by the potentiometers

Figure 3. Measuring the operational amplifier input voltages created by the potentiometers.

This will allow you to numerically compare both input voltages and then compare the expected output with the LED status.

Applications of Analog Comparators

Comparator circuits are widely used to compare and monitor physical measurements, provided those physical variables can be translated into voltage signals. For instance, if a small generator were attached to an anemometer wheel to produce a voltage proportional to wind speed, as shown in Figure 4. 

Example application of an analog comparator.

Figure 4. Example application of an analog comparator.

That wind speed signal could be compared with a set-point, high-limit voltage. The output of the op amp could then drive a high wind speed alarm.  

Related Content

Learn more about the fundamentals behind this project in the resources below.

  • Operational Amplifiers
  • Open-Loop Op Amp Circuits Worksheet
  • Basic Operational Amplifiers Worksheet
  • Textbook Index

Lessons in Electric Circuits

Volumes ».

  • Direct Current (DC)
  • Alternating Current (AC)
  • Semiconductors
  • Digital Circuits
  • EE Reference

Chapters »

  • 1 Introduction to Electronics Projects
  • 2 Basic Projects and Test Equipment
  • 3 DC Circuit Projects
  • 4 AC Circuit Projects
  • 5 Discrete Semiconductor Circuit Projects

Pages »

  • 7 Digital IC Projects
  • 8 555 Timer Circuit Projects
  • 9 Contributor List
  • Advanced Textbooks Practical Guide to Radio-Frequency Analysis and Design
  • Designing Analog Chips
  • Silicon Labs Bluetooth Solutions
  • Peak Voltage Calculator
  • Innovative Bluetooth Technology with Silicon Labs
  • RMS Voltage Calculator
  • Smart Bench Essentials and Remote Lab Access
  • Powerful Voltage Regulator Circuit 2000W Working Smoothly

op amp comparator experiment

You May Also Like

op amp comparator experiment

Understanding the Role and Impact of Digitally Controlled Oscillators in Modern Electronics

In Partnership with SiTime

op amp comparator experiment

Memory Leaders Rise to Meet the Storage Challenges of AI

by Jake Hertz

op amp comparator experiment

Semidynamics Provides All-In-One AI IP to Facilitate AI Chip Design

op amp comparator experiment

Axelera AI Raises $68M for ‘World’s Most Powerful AIPU’ for the Edge

op amp comparator experiment

Ground Tests of Photovoltaically Powered Satellites Require Fast and Flexible Solar Array Simulation

by AMETEK Programmable Power

All About Circuits

Welcome Back

Don't have an AAC account? Create one now .

Forgot your password? Click here .

All About Circuits Logo

Microcontrollers & Microprocessors

  • Analog Products
  • Automotive Products
  • Clocks & Timing
  • Memory & Logic
  • Power Discretes
  • Power Management
  • Programmable Mixed-signal, ASIC & IP Products
  • RF Products
  • Sensor Products
  • Space & Harsh Environment
  • Wireless Connectivity
  • Cross-reference Search
  • RA Arm Cortex-M MCUs
  • RZ 32 & 64-Bit MPUs
  • RL78 Low Power 8 & 16-Bit MCUs
  • RX 32-Bit Performance / Efficiency MCUs
  • RISC-V 32 & 64-Bit MCUs and MPUs
  • RH850 Automotive MCUs
  • Renesas Synergy™ Platform MCUs
  • Reality AI Software
  • Other MCUs & MPUs

Applications

  • Advanced Driver Assistance Systems (ADAS)
  • Electric & Hybrid Vehicles (EV)
  • Infotainment Systems
  • Vehicle Control Systems
  • b11f1262-a873-474b-8ca0-e67d7d53dc7b
  • Cloud & Enterprise
  • Networking & Fixed Access
  • Wireless Infrastructure
  • f2aae80f-bc4f-46cf-98ca-2b335c67941f
  • Home Theater & Entertainment
  • Power Adapters & Chargers
  • a48e2c9b-ee85-4613-b198-4b2b59534e7c
  • Building Automation
  • Industrial Automation
  • Medical & Healthcare
  • Motor Drives & Robotics
  • Renewable Energy & Grid
  • Retail, Automation & Payment
  • 8bfb0695-71e8-417c-a13f-c74a35d2e627
  • Artificial Intelligence (AI)
  • Gallium Nitride (GaN) Power
  • Functional Safety
  • Motor Control
  • ff726d57-f1ef-4a8e-8670-f7d87673ad39
  • 7aec0cb6-8ed1-4a65-891a-f52a80c88432

Design Resources

  • Boards & Kits
  • Development Tools
  • Software & Drivers
  • Software & Tools
  • Gadget Renesas Maker Resources
  • 8786bf49-094e-4e2e-b1c4-4e857090a66c
  • QuickConnect Platform
  • Lab on the Cloud
  • PowerCompass Multi-Rail Design Tool
  • PowerNavigator
  • Timing Commander
  • 9e3ae1f6-f13b-4970-8d1a-bb40597d0999
  • Preferred Partner Program (Systems)
  • Renesas Ready Partner Network (Software)
  • R-Car Consortium
  • a4e810d8-c96f-4669-add4-cd2a3f129710
  • Documents & Downloads
  • Training & Tutorials
  • 35b76d3d-de79-4ff8-8fe7-80f7fbb8c712
  • e01478a2-3fb1-4b55-8b25-a0f96fb7f076
  • Microcontrollers
  • Microprocessors
  • bdd78a76-ab9a-48cd-8e37-4a709204d87c
  • Frequently Asked Questions (FAQ)
  • Support Tickets
  • ed64dc91-40ee-4aa8-8f31-adb5977395a0
  • 172ab227-40be-47fa-8612-cda2867e860f
  • Environmental Compliance
  • Packaging Information
  • Product Change Notifications
  • Product Life Cycle
  • Product Longevity Program
  • Quality & Reliability
  • 5e3bbdf7-1829-40d9-9761-eaaa7514aaf8
  • d437fed0-9142-42f2-b1c4-1d0da0059332

Sample & Buy

  • Buy Direct from Renesas Customers can now choose the convenience of buying direct from Renesas.
  • Check Product Availability
  • Request Samples
  • Orderable Part Number Guide
  • End-of-Life (EOL) Products
  • Sales & Distributor Directory
  • 37914915-9d90-45a4-a0cd-4ad98ad9b4f6
  • 66c859ad-ad1e-4a09-9a5b-e6f5fd568bc5
  • Company Information
  • Sustainability at Renesas
  • 507386ee-ea1a-41da-9822-865191d2f131
  • Company Culture
  • Search for Jobs
  • 58bd9728-2c64-4aa2-9910-b2304ad3872e
  • Sales Support
  • Technical Support
  • 4518335f-38c7-4e56-821f-2df7e5e14091
  • News Releases
  • f2222376-93e4-48ce-99ec-d83f2b7b491c
  • IR Materials
  • Financial Highlights
  • Investor Events
  • Stock Information
  • 6e178d75-b6b3-44d9-8f73-d8bdd96dddde
  • cc8139d9-2f83-4eb8-8f48-3aa8e857737d
  • Sample Request
  • Op-Amps, Comparator Circuit

Introduction to Electronic Circuits: 3 of 3

In this session we look at operational amplifiers ("op-amps") and their uses in amplifiers and comparators.

Op-Amps: Ubiquitous ICs with Multiple Applications

An op-amp operates on analog input. It can be used to amplify or attenuate this input, and to carry out mathematical operations such as addition, subtraction, integration, and differentiation. Because of their wide range of uses, op-amps are encountered in most electric circuits.

A typical op-amp, such as shown in Figure 1, is equipped with a non-inverting input (Vin (+)), an inverting input (Vin (−)), and an output (Vout). Although not shown in the diagram, an op-amp also has two power inputs (positive and negative), and may also include an offset input and other terminals.

Figure 1: Op-amp Circuit

Figure 1: Op-amp Circuit

The fundamental function of an op-amp is to greatly amplify the differential between the two inputs, and output the result. If input at V(+) is greater than at V(−), the op-amp will amplify and output a positive signal; if V(−) is greater, the op-amp will output an amplified negative signal. Two other features of a typical op-amp are: (a) the input impedance is extremely high, and (b) the output impedance is extremely low.

Because the op-amp's gain is so high, even small differences in the inputs will rapidly drive the output voltage to its maximum or minimum value. For this reason, op-amps are usually connected to a negative feedback. Let's look at an example.

Op-Amp Basics (1): An Inverting Amplifier Circuit

The circuit shown in Fig. 2 amplifies and inverts (reverses the phase of) the input signal, and outputs the result. The circuit uses negative feedback: some of the output signal is inverted and returned to the input. In this example, feedback occurs because output Vout is connected through resistor R2 to the inverting input (−).

Let's look at how this circuit works. If the output is not connected to a power voltage, then the voltages applied to the inverting (−) and non-inverting (+) inputs are equal; the two inputs act as if shorted together; we can envision an imaginary short. Since the voltage difference between this imaginary short and the non-inverting input is 0 V, point A will also be at 0 V. By Ohm's Law, then, we have I 1  = Vin/R 1 .

Figure 2: Inverting Amplifier Circuit

Figure 2: Inverting Amplifier Circuit

Because op-amps have extremely high input impedance, there is virtually no current flow into the inverting input (−). Accordingly, I 1  flows through point A and R 2 ; this means that I 1  and I 2  are virtually equal. Then, by Ohm's Law, we have Vout = −I 1  × R 2 , where I 1  is negative because I 2  flows from point A, where the voltage is 0. Looking at this in another way: any attempt to raise the input voltage at the inverting input (−) produces inverted and highly amplified output voltage that flows backward, passing through R 2  and connecting to the inverted input terminal (−), thereby suppressing the voltage rise at this terminal. The system stabilizes at the output voltage that brings the voltage at the inverting input (−) to 0 V, equivalent to the voltage at the non-inverting input.

Next, let's see how we can use the relationship between input and output to find the op-amp's gain. Specifically, Vout/Vin = (−I 1  × R 2 ) / (I 1  × R 1 ) = −R 2 /R 1 . The gain is negative because the output waveform phase is opposite that of the input waveform.

An important thing to note about the above equation is that the gain is entirely determined by the ratio of resistances R 2  and R 1 . Accordingly, you can change the gain simply by changing the resistances. So while the op-amp itself has a high gain, appropriate use of negative feedback can reduce the actual amplification to the desired level.

Op-Amp Basics (2): Non-Inverting Amplifier Circuit

In the previous section we saw how an op-amp can be used to implement an inverting amplifier. Figure 3 shows how we can use it to make a non-inverting amplifier. The non-inverting amp differs from the inverting one in two major ways: (1) the output waveform is in phase with the input waveform, and (2) the input goes into the non-inverting input terminal (+). But note that non-inverting and inverting circuits both make use of negative feedback.

So how does this circuit work? We still have the imaginary short, which means that the non-inverting (+) and inverting (−) inputs are both at voltage Vin. So point A is also at Vin. Ohm's Law tells us that the voltage at R 1  is Vin = R 1  × I 1 . And since there is essentially no current into either of the op-amp inputs, it follows that I 1  = I 2 . And as Vout is the sum of voltages at R 1  and R 2 , we know that Vout= R 2  × I 2  + R 1  × I 1 . We can rearrange these expressions to find the gain G, like this: G = Vout/Vin = (1 + R 2 /R 1 )

Figure 3: Non-inverting Amplifier Circuit

Figure 3: Non-inverting Amplifier Circuit

Because this amplifier preserves the phase, it is often found in applications where phase considerations are an issue.

Note also that if R 1  is removed from the circuit and R 2  is set to 0 ohm (or shorted), the circuit becomes a voltage follower with a gain of 1. This type of circuit is often used in buffering circuitry and impedance conversion circuits.

Comparator Circuit

A comparator circuit compares two voltages and outputs either a 1 (the voltage at the plus side; VDD in the illustration) or a 0 (the voltage at the negative side) to indicate which is larger. Comparators are often used, for example, to check whether an input has reached some predetermined value. In most cases a comparator is implemented using a dedicated comparator IC, but op-amps may be used as an alternative. Comparator diagrams and op-amp diagrams use the same symbols.

Figure 4 shows a comparator circuit. Note first that the circuit does not use feedback. The circuit amplifies the voltage difference between Vin and VREF, and outputs the result at Vout. If Vin is greater than VREF, then voltage at Vout will rise to its positive saturation level; that is, to the voltage at the positive side. If Vin is lower than VREF, then Vout, will fall to its negative saturation level, equal to the voltage at the negative side.

In practice, this circuit can be improved by incorporating a hysteresis voltage range to reduce its sensitivity to noise. The circuit shown in Fig. 5, for example, will provide stable operation even when the Vin signal is somewhat noisy.

Figure 4: Comparator Circuit

Figure 4: Comparator Circuit

Figure 5: Comparator Circuit with Hysteresis

Figure 5: Comparator Circuit with Hysteresis

Oscillator Circuit Using Positive Feedback

Feedback refers to the return of a portion of a circuit's output back to the circuit input, for the purpose of regulating the circuit in some way. With negative feedback, higher feedback drives the circuit output down. With positive feedback, as in the example here, higher output drives the output up. When positive feedback is incorporated in a circuit with a positive gain, the circuit becomes an oscillator.

There are numerous types of oscillator circuits. Figure 6 shows an example of an astable multivibrator oscillator.

Figure 6: Astable Multivibrator Circuit

Figure 6: Astable Multivibrator Circuit

This circuit is called astable because it is unstable at both maximum voltages, voltage V L  on the positive side, and −V L  on the negative side, and will oscillate between these two levels. Let's look at how this circuit works. First, note that output Vout, goes through R 2  and back into the op-amp's non-inverting terminal (+), forming a positive feedback circuit. Note also that Vout, R 3 , and C comprise an RC integrator circuit; or, to put it another way, that some of the voltage at Vout will gradually charges the capacitor.

At the beginning, the feedback circuit quickly drives Vout to its maximum positive output (equal to V L ). But the R3 integrator circuit (R 3  and C) gradually drives up the voltage on the inverting input terminal (−), until after a certain time this voltage becomes higher than the voltage at the non-inverting input terminal (+). When this occurs, a negative voltage gets input into the differential input, rapidly pushing Vout down to its negative-side maximum (−V L ).

With Vout now on the negative side, however, the R 3  integrator circuit begins to gradually drive up a negative voltage on the inverting terminal (−). And again, after a certain time, this negative voltage becomes greater than the voltage at the non-inverting terminal (+), causing the input of a positive voltage into the differential input, which rapidly pushes Vout back up to its positive side maximum (V L ). This sequence continues to repeat, causing Vout to oscillate up and down between V L  and − V L .

This has been the third and final session of our review of basic electronic circuits. We hope this review was helpful, even as we acknowledge that the scope was quite limited. Next time we begin our study of digital circuits. We look forward to your continued participation.

Module List

  • Passive Elements
  • Diodes, Transistors, and FETs

How an Op-amp Comparator Works

Published Oct 14, 2022

Please accept cookies to access this content.

Have you ever wondered how an op-amp comparator circuit works? Or how to set up an op-amp comparator circuit? Operational amplifiers can be used as comparators if necessary and their setup is straightforward, the performance is not great but usually acceptable, and generally people have op-amps lying around but not comparators.

What is a Comparator and How Would you Use it?

So, what is a comparator? As derived from the name, it is a device or circuit that compares the voltage level of two inputs and then, depending on which one is higher, will output either a high voltage or a low voltage. While crude, it could be considered a very basic analog to digital converter, taking an analog input and making it a digital output. It can also be considered a very simple decision maker that requires absolutely no coding. For example, if you have a temperature sensor with an analog voltage output. With this, you could decide that you want a heater to kick on below a certain temperature and set your comparator reference voltage at that point you want it to turn on. Ideally, you’ll want some sort of hysteresis in that circuit so you’re not toggling the heater on and off rapidly but the rough concept is sound.

Without further ado, let’s introduce the circuit and basic responsiveness of a comparator circuit.

Conceptual Overview of the Operation of an Operator Amplifier Comparator

That’s all you need to put the circuit together and get it to operate the way you’d like it to. However, to understand conceptually what’s going on, a quick review of the basic operational amplifier operation is needed.

With an op-amp, the output amplifies the difference between the two inputs. If the voltage on the non-inverting input is higher than the voltage on the inverting input, the output will create a positive voltage that amplifies the difference in input voltages. Ideally, that amplification factor is infinite, though real op-amps obviously are not infinite the amplification factor is still very large. Usually, this output is connected to one of the inputs and brings the two input voltages into balance. However, as the output is not connected to the input as feedback, the output saturates to as high of voltage as the op-amp is capable of generating. And, of course, the opposite is true. If the inverting input is a higher input than the non-inverting input, the output will saturate to as low of voltage as the op-amp is able to generate.

At this point, it may be beneficial to notice that you may not need a negative voltage to power the operational op-amp, which usually simplifies the power requirements. Your situation may be different, though, both from your circuit and also if your op-amp is rail to rail. As always, think through your own designs and requirements!

Real Life Considerations of Using an Op-amp as a Comparator:

As we were introduced to the op-amp comparator, I mentioned that their performance is usually acceptable but that they’re not great. This mainly stems from the fact that op-amps were not designed primarily for usage as a comparator, operating in the saturation region. They’re designed to give a clean, linear output in contrast with dedicated comparators, which are designed to swing from one rail to the other as quickly as possible. This change in design focus yields the following performance concerns:

  • Op-amp comparators are not as responsive as dedicated comparators.
  • Op-amp comparators tend to have a narrower bandwidth than comparators.
  • Op-amp comparators dissipate more power in their saturation operating region.
  • Op-amps tend to be more expensive than comparators.
  • Op-amps may not be able to handle a wide voltage discrepancy between the inputs, they generally have a very small differential between the input voltages.

But it’s not all bad news for the op-amps - comparators typically have a higher offset voltage and bias input than an operational amplifier. If you think about it, you can probably come up with some good reasons on your own as to why a comparator designer doesn’t stress about those parameters as much as an op-amp designer would stress about them. And if the comparator input is too low of impedance, you could always use an op-amp voltage follower to eliminate that problem.

Using an op-amp as a comparator is easy and a commonly accepted practice. While their performance is generally not as good as a dedicated comparator, for most applications, those that don’t require extreme response times or are strapped in their power requirements, they work well enough. If you need an improvement in those areas, a dedicated comparator is the way to go and, from a configuration standpoint, similar enough that these concepts still apply.

  • Op-Amp (12)
  • Comparator (10)

Authored By

Josh bishop.

Interested in embedded systems, hiking, cooking, and reading, Josh got his bachelor's degree in Electrical Engineering from Boise State University. After a few years as a CEC Officer (Seabee) in the US Navy, Josh separated and eventually started working on CircuitBread with a bunch of awesome people. Josh currently lives in southern Idaho with his wife and four kids.

Related Tutorials

  • Intermediate Electronics

Related EE FAQs

Answered by Susie Maestre

Answered by Herald Labial

Explore CircuitBread

  • 244 Tutorials
  • 9 Textbooks
  • 12 Study Guides
  • 104 EE FAQs
  • 295 Equations Library
  • 213 Reference Materials
  • 97 Glossary of Terms

Friends of CircuitBread

Free Industry Lead Time Monitor

Product Samples Upon Request

Free Aerodynamics Technical Articles

Get the latest tools and tutorials, fresh from the toaster.

What are you looking for?

Message sent.

Thanks for the message, our team will review it shortly.

Log In or Sign Up

Username should have no spaces, underscores and only use lowercase letters.

Thanks for joining CircuitBread!

Please confirm your email address by clicking the link in the email we sent you.

Didn't receive anything? Resend now.

op amp comparator experiment

Access denied under U.S. Export Administration Regulations.

electroniclab

  • Digital effects

op amp comparator experiment

  • OPAMP Comparators
  • Boris Poupet
  • bpoupet@hotmail.fr
  • 15 min
  • 5.389 Views

Share This Article

Spread the word about this Article

Share

Introduction

In most of the previous operational amplifier tutorials , the circuits had a feedback loop to the inverting input. This design is the most common because it provides indeed stability and avoids undesirable saturating effects and, it is also common to call it the linear mode .

On the other hand, when no feedback is applied to the inverting input, the op-amp is said to work in the non-linear regime , we can also say in an open-loop configuration . Comparators are specific op-amps circuits that are meant to work in a non-linear mode and can be used as simple logic gates.

A presentation of the circuit along with the basics about comparators is given in the first section.

In the second section, we increase the complexity of the circuit in order to show how to translate the so-called “tipping point” or “threshold” of the comparator. We show that being able to translate this value is important in order to properly design level detectors.

Schmitt triggers are discussed in a third paragraph, we will see how this kind of comparators work and how they can be used in real applications. Moreover, we highlight their advantages by comparing them to basic comparators.

Presentation

Non-inverting comparator.

The simplest comparator consists of an op-amp without any resistor or feedback loop, the signal to compare is V 1 and supplies the non-inverting input, a reference signal V ref supplies the inverting input, the output is labeled V out and the supply power is V S+ and V S- , which can be symmetrical or not.

op amp comparator experiment

During this presentation section, we will pose and admit that V ref constitutes the ground, and therefore V ref =0. Moreover, we will admit that the supply is symmetrical (V S+ =-V S- ).

The functioning of this circuit is extremely simple and can be summarized depending on the value of V 1 :

  • If V 1 >V ref , V out =V S+
  • If V 1 <V ref , V out =V S-

The absence of feedback to the inverting input makes the amplifier to saturate up to the supply power level when the differential input V in =V 1 -V ref =V 1  becomes slightly higher than zero in absolute value

The input/output characteristic associated with the circuit of Figure 1 is a Heaviside-like function shown in Figure 2 below:

op amp comparator experiment

If a sine waveform is applied as an input, the comparator can be used to convert a sine to a square signal:

op amp comparator experiment

Inverting comparator

In the previous subsection, the signal to compare was applied to the non-inverting input while the reference was on the inverting input of the op-amp. However, the roles can be inverted in order to get an inverting comparator such as presented in Figure 4 :

op amp comparator experiment

In this case, the value of the output is dictated by these two conditions:

  • If V 1 <V ref , V out =V S+
  • If V 1 >V ref , V out =V S-

The transfer characteristic for this configuration is also a Heaviside-like function but with the positive saturation happening for V 1 <0 and the negative for V 1 >0:

op amp comparator experiment

Translation of the tipping point

Some complexity can be added with a voltage divider in the reference branch to either the non-inverting or inverting comparator in order to translate the tipping point. The tipping point is the value of V 1 for which the output suddenly changes from a high (resp. low) to a low (resp. high) value. In the previous section, the tipping point was always happening for V 1 =0.

Let’s consider the comparator presented in Figure 6 :

op amp comparator experiment

Thanks to the voltage divider, an alternative reference voltage labeled V’ ref is supplied to the inverting input of the op-amp. This new reference satisfies the voltage divider formula: V’ ref+ =+V S (R 2 /(R 1 +R 2 )). Note that the voltage divider can also be supplied with the negative power supply V S- , in that case, the alternative reference presents a negative sign (we label it V’ ref- ).

These observations can be summarized in the following transfer characteristics:

op amp comparator experiment

If we consider an inverting comparator, the effect of the same voltage divider circuit will have the opposite effect. Indeed, if the voltage divider is supplied with the positive (resp. negative) power supply, the translation of the tipping point will be negative (resp. positive). Moreover, the signal is inverted such as presented in Figure 5 .

Time-dependent input

The translation of the tipping point allows setting the threshold level of the comparator to a non zero level. When a variable input is applied to the circuit, such as the output of light or temperature sensor, a simple level detector can be made with this basic comparator.

op amp comparator experiment

Schmitt trigger

Non-inverting trigger.

The translation of the tipping point can also be realized by adding a voltage divider circuit as a feedback loop in the non-inverting branch, the inverting branch is grounded (V ref =0). The full configuration is shown in Figure 9 below, it is also known as a Schmitt trigger , we take as an example the non-inverting comparator:

op amp comparator experiment

In the situation proposed in Figure 9 , the differential input can be written V in =V + -V ref =V + . Moreover, the voltage V + can be written as a superposition of V 1 and V out thanks to Millman’s theorem:

op amp comparator experiment

The differential input is equal to zero when V 1 =-V out (R 1 /R 2 ). Since the output value can only be equal to V S or -V S , there are two values of V 1 that can be seen as tipping points, we label them V T + and V T- for “threshold”:

  • V T+ =V S (R 1 /R 2 ) is the upper threshold for which V out =V S- →V S+
  • V T- =-V S (R 1 /R 2 ) is the lower threshold for which V out =V S+ →V S-

The input/output characteristic of a non-inverting Schmitt trigger is a hysteresis graph presented in Figure 10 :

op amp comparator experiment

Inverting trigger

We can as well consider the same positive feedback for an inverting configuration:

op amp comparator experiment

In this case, the differential input can be written V in =V out (R 1 /(R 1 +R 2 ))-V 1 , the input voltage V 1 that cancels the differential input is therefore given by V 1 =-V out (R 1 /(R 1 +R 2 )).

Depending on the sign of V out , two thresholds specific to the inverting configuration can be defined:

  • V T+ =-V S (R 1 /(R 1 +R 2 ))
  • V T- =+V S (R 1 /(R 1 +R 2 ))

The associated hysteresis plot for the inverting Schmitt trigger is given in Figure 12 :

op amp comparator experiment

Applications

Schmitt triggers and comparators in general, as we briefly presented in Figure 8 are mainly used for the conversion of analogic signals to digital signals.

However, “basic” comparators present the disadvantage of being triggered by background noise. One of the very appreciated properties of Schmitt triggers is their noise immunity , which means that the comparator will switch between the low and high output states only when the input is effectively triggering it. Moreover, since the high output state is triggered by the upper threshold and the low output state by the low threshold, Schmit triggers usually add a delay in comparison with “basic comparators”.

When considering again Figure 8 , we could imagine that during the second global light variation, the two peaks can be related to some noise (coming from the user for example).

Thanks to the hysteresis that can be achieved with a Schmitt trigger , if the lower threshold is set below the minimum noise level, the background noise does not trigger the comparator:

op amp comparator experiment

Comparators are operational amplifiers that are intentionally designed to work in open-loop or with positive feedback , which is both unstable and non-linear modes. Their output can only be equal to two different values, which correspond approximately to the power supply voltages. The output, or saturating voltages, depending on the input supplied. This input is being compared to a reference voltage which sets the threshold of the comparator.

In the second section, we have seen that the threshold voltage can be modified by adding a simple voltage divider circuit to the inverting branch of the op-amp. Basic comparators work in open-loop and present only one threshold, which makes them simple to design and with a fast response.

The third section focuses on Schmitt triggers which present the advantage to not be triggered by background noise, such as basic comparator do. Schmitt triggers do not work in open-loop configuration but instead with positive feedback to their non-inverting input. It allows them to have two threshold levels (high and low), as a consequence, their transfer characteristic is a hysteresis.

op amp comparator experiment

More tutorials in Operational Amplifiers

  • OPAMP Monostable

OPAMP Multivibrator

  • The Summing OPAMP Amplifier

OPAMP Differentiator

  • OPAMP Integrator
  • The Differential OPAMP Amplifier
  • Inverting OPAMP
  • Non-inverting OPAMP

Operational Amplifier Building Blocks

guest

RELATED ARTICLES

OPAMP Differentiator

Voltage Comparator.

Introduction.

A comparator as its name implies, compares a signal voltage on one input of an op-amp with a known voltage called a reference voltage on the other input. Comparators are used in circuits such as digital interfacing, schmitt trigger, discriminator voltage level detector and oscillators. A comparator circuit is basically an operational amplifier without feedback, that is, the op-amp is used in its open-loop configuration, and when the input voltage, V in exceeds a preset reference voltage, V ref , the output changes state. Due to the very high open-loop gain of the operational amplifier, using it with positive feedback or even with no feedback at all causes the output to saturate to its supply rail producing one of two distinct output voltages depending on the relative values of its two inputs.

Non-Inverting Comparator

A fixed reference voltage V ref of 1 V is applied to the inverting input and time varying signal voltage V in is applied to the non-inverting input as shown in figure 1. When V in is less than V ref the output voltage V 0 = –V sat , and when V in is greater than V ref , then V 0 = +V sat . Thus the V 0 changes from one saturation level to another.

op amp comparator experiment

Inverting Comparator

An inverting comparator in which the reference voltage V ref is applied to the non-inverting input and V in is applied to the inverting input as shown in figure 3. In this circuit V ref is obtained by using a10K potentiometer that forms a voltage divider with DC supply of +V cc and the wiper connected to the input. As the wiper is moved towards +V cc , V ref becomes more positive. Thus a V ref of a desired amplitude and polarity can be obtained by simply adjusting the 10K potentiometer.

op amp comparator experiment

Applications of Comparators

1) null detectors.

A null detector identifies when a given value is zero. Comparators are ideal for null detection comparison measurements, since they are equivalent to a very high gain amplifier with well-balanced inputs and controlled output limits. The null detector circuit compares two input voltages: an unknown voltage and a reference voltage, usually referred to as v u and v r .

2) Zero-crossing detectors

For this type of detector, a comparator detects each time an ac pulse changes polarity. The output of the comparator changes state each time the pulse changes its polarity, that is the output is HI (high) for a positive pulse and LO (low) for a negative pulse squares the input signal.

3) Relaxation oscillator

A comparator can be used to build a relaxation oscillator. It uses both positive and negative feedback. The positive feedback is a Schmitt trigger configuration. Alone, the trigger is a bistable multivibrator. However, the slow negative feedback added to the trigger by the RC circuit causes the circuit to oscillate automatically. That is, the addition of the RC circuit turns the hysteretic bistable multivibrator into an astable multivibrator.

4) Window detectors

Comparators can also be used as window detectors. In a window detector, a comparator is used to compare two voltages and determine whether a given input voltage is under voltage or over voltage.

  • Evaluation Boards & Kits
  • FPGA Reference Designs
  • Quick Start Guides
  • Linux Software Drivers
  • Microcontroller Software Drivers
  • ACE Software
  • Technical Guides
  • University Program Overview
  • ADALM1000 (M1k) Active Learning Module
  • ADALM2000 (M2k) Active Learning Module
  • ADALP2000 Parts kit for Circuits
  • ADALM-PLUTO SDR Active Learning Module
  • Teaching and Lab Materials
  • Wiki Site Map
  • Recent Changes
  • Media Manager
  • Analog Devices Wiki

Diff

Table of Contents

4.1.1 the active voltage to current converter, 4.2 precision current to voltage converter, 4.3 precision current mirror, 4.4 simulated inductor, 4.5 all-pass filter, 4.6 negative impedance converter, 4.7 capacitance multiplier, 4.8.1 speed considerations, 4.8.2 output considerations, 4.8.3 input considerations, section summary, 4.9 operational amplifier schmitt trigger, chapter 4: op amp applications - advanced topics.

In this chapter we explore a number of example op amp configuration that are presented to illustrate certain advanced applications for operational amplifiers. Many of these more advanced uses for op amps will probably make more sense after the reader has studied the material on Bipolar Junction and Field Effect transistors in later chapters. The reader can skip this material for now and circle back after gaining an understanding of how transistors work.

4.1 Precision Voltage to Current Converter

The very high forward gain (A VOL ) and differential input nature of the operational amplifier can be used to create a nearly ideal voltage controlled current source or V -to-I converter. Note in figure 4.1, the input voltage to be converted is applied to the non-inverting input terminal of the op amp. The inverting input terminal is connected in feedback to one end of the resistor R 1 and the source of transistor M 1 . The output of the op-amp drives the Gate of the transistor. The high open loop gain of the amplifier will force the Gate of M 1 to the required voltage such that V IN appears across R 1 . The current in R 1 will thus be V IN /R 1 and will flow only in the Source of M 1 and also thus appear in the Drain of M 1 as I OUT .

op amp comparator experiment

Figure 4.1 Precision Voltage to Current converter

This configuration is also often referred to as an Active Cascode. To understand the concept of the cascode or common gate (base) amplifier the reader is directed to study the section in Chapter 9 on the Cascode (9.3).

An instructive application for this circuit technique can be found in this article on how to convert 1V to 5V signal to 4mA to 20mA output.

Figure 4.1.1 shows a classic voltage to current ( V -to-I) converter. The resistor values can be selected such that the output current in the load, varies only with the input voltage, V IN , and is independent of the load. The circuit is widely used in industrial instruments for supplying a 4 to 20 mA signal for example. Also often referred to as a Howland current pump this configuration has two advantages over the MOSFET based circuit shown in figure 4.1. The first is a high output impedance and the second is the ability to provide bipolar (both sourcing and sinking) output currents.

The circuit has its limitations due in part to the requirement that the resistor ratios must be quite accurate to obtain a near ideal current source. Published literature describing the circuit provides design methods that are for special cases or are for approximate designs. In this chapter we explore simple design formulas that can be used to determine the component values that produce a near ideal current source. These formulas also provide a general method for calculating the output current, I LOAD , for any selection of resistor values, not just the constant-current selection. Usually in order to improve stability, the circuit is made symmetrical. Therefore R 1 = R 3 , R 2 = R 4 , and R S = R S' .

op amp comparator experiment

Figure 4.1.1 non-inverting voltage to current converter

For a true current output, I LOAD , as a function of the input voltage, V IN , you must satisfy the following equations:

op amp comparator experiment

The load current is:

op amp comparator experiment

The Output impedance is:

op amp comparator experiment

In equation 1, any four of the terms can be arbitrarily selected and then the fifth term is determined by solving the resulting equation. With R 1 = 150 kΩ, R 2 = 15 kΩ, R S = 50 Ω, and V IN can vary from 0 to 5 V , I LOAD will vary from 0 mA to 10 mA , and the circuit has a very high output impedance.

if R S changes from 50 Ω to 200 Ω, the feedback changes fourfold, and you would expect that the output current would change fourfold, to 0 to 2.5 mA . You can check the result by substituting in the general formula for the output current.

Looking at equation 2, the output impedance, Z OUT will be infinity if R 1 =R 3 , R 2 =R 4 and R S =R S' because the bottom term in the ratio will be exactly zero. To the extent that the resistors do not match the output impedance could be either positive of negative. For example if R 3 were slightly larger than R 1 the bottom term would be negative.

More details on the Howland current source can be found in A large current source with high accuracy and fast settling and Choose resistors to minimize errors in grounded-load current source .

A simple single resistor can be used to convert a current into a voltage but the voltage cannot be used directly to drive other parts of a system without potentially disturbing or altering the voltage. Often a buffer amplifier is required or the voltage may need to be shifter or “referred” to a different node (supply voltage or ground) in the circuit. Op amp circuits like those in figure 4.2 can perform this function.

op amp comparator experiment

Figure 4.2 Precision Current to Voltage converter

Two configurations are shown in figure 4.2. Version (a) produces an output voltage V OUT from input current I IN . The output voltage is produced with respect to ground due to the virtual ground at the - input terminal of the amplifier and is negative ( V OUT = -I IN R 1 ) for currents flowing into the virtual ground (from the + V as shown) and positive for currents flowing out of the virtual ground (flowing toward - V ). Version (b) produces an output voltage V OUT from input current I IN as well but now it is produced with respect to some negative node potential, - V . Unlike version (a) which accepts both sourcing and sinking currents, version (b) will only operate for currents flowing into the virtual ground at the - input terminal. There is an advantage to using a MOSFET, M 1 , over a bipolar transistor. In the MOSFET all the current in the drain also flows in the source (no current in gate) whereas in the case of a BJT the emitter current is increased due to the base current. The current in R 1 will thus be slightly larger than I IN and the voltage V OUT will not be exactly equal to I IN *R 1 .

The simple transistor based current mirror is covered in detail in Chapter 11. Here we introduce the op amp in the feedback loop of the diode connected transistor. The very large gain of the amplifier greatly reduced many of the sources of error found in the simple two transistor current mirror.

op amp comparator experiment

Figure 4.3 Precision Current Mirror

The two MOSFETs M 1 and M 2 must be well matched (and be at the same temperature) as well as the two resistors R 1 and R 2 if I OUT is to be well matched to I IN . If two bipolar (NPN) transistors were to be used in this case, the op amp will supply all the base current for the two transistors and providing the a and V BE (I S actually) of the two devices is well matched (and R 1 and R 2 of course) the gain of the mirror will be nearly exactly 1 in spite of the finite ß. It is also important to note that the feedback current from the drain of M 1 is to the + input terminal of the op amp. This is because of the phase inversion of the common source configuration of M 1 .

Before the introduction of the transistor and the integrated circuit, coils of wire with large inductance were used in electronic filters. An inductor can be replaced by a much smaller assembly consisting of a capacitor, operational amplifiers or transistors, and resistors. This is especially useful in integrated circuit technology where building inductors from large loops of wire is impractical.

The circuit in Figure 4.4 reverses the operation of a capacitor, thus making a simulated inductor. An inductor resists any change in its current, so when a dc voltage is applied to an inductance, the current rises slowly, and the voltage falls as the external resistance becomes more significant.

op amp comparator experiment

Figure 4.4. Simulated Inductor Circuit

An inductor passes low frequencies more readily than high frequencies, the opposite of a capacitor. An ideal inductor has zero resistance. It passes dc without limitation, but it has infinite impedance at infinite frequency.

For the circuit in figure 4.4, if a DC voltage step is suddenly applied to the inverting input through resistor R L , the op amp ignores the sudden step because the change is also coupled directly to the non-inverting input via C 1 . The op amp represents high impedance, just as an inductor does. As C 1 charges through R 1 , the voltage across R 1 falls, so the op-amp draws current from the input through R L . This continues as the capacitor charges, and eventually the op-amp has an input and output close to virtual ground because the lower end of R 1 is connected to ground.

When C 1 is fully charged, resistor R L limits the current flow, and this appears as a series resistance within the simulated inductor. This series resistance limits the Q of the inductor. Real inductors generally have much less resistance than the simulated variety.

There are some limitations of a simulated inductor like this:

  • One end of the inductor is connected to virtual ground.
  • The simulated inductor cannot be made with high Q, due to the series resistor R L .
  • It does not have the same energy storage as a real inductor. The collapse of the magnetic field in a real inductor causes large voltage spikes of opposite polarity. The simulated inductor is limited to the voltage swing of the op amp, so the flyback pulse is limited to the voltage swing.

The all-pass filter passes all frequencies at the same gain. It is used to change the phase of the signal, and it can also be used as a phase-correction circuit. The circuit shown in figure 4.5 has a 90° phase shift at F(90°). At DC, the phase shift is 180°, and at high frequencies it is 0°. R 1 = R 2 = R 3 = R F(90°) = 1/(2?R 1 *C 1 )

op amp comparator experiment

Figure 4.5. All-Pass Filter Circuit

op amp comparator experiment

Figure 4.6 Gain/Phase simulation plot of All-Pass circuit

The negative impedance converter (NIC) is an op-amp circuit which acts as a negative load. This is achieved by introducing a phase shift of 180° (inversion) between the voltage and the current for a signal source. There are two versions of this circuit - with voltage inversion (VNIC) and with current inversion (INIC). The basic circuit of an INIC and its analysis is shown figure 4.7.

op amp comparator experiment

Figure 4.7 Negative impedance converter.

INIC is a non-inverting amplifier (the op-amp and the voltage divider R 1 , R 2 in figure 4.7) with a resistor (R 3 ) connected between its output and input. The op-amp output voltage is

op amp comparator experiment

The current going from the operational amplifier output through resistor R 3 toward the source Vin is -Is, and

op amp comparator experiment

So the input V in experiences an opposing current - I in that is proportional to V in , and the circuit acts like a resistor with negative resistance

op amp comparator experiment

In general, elements R 1 , R 2 , and R 3 need not be pure resistances ( i.e. , they may be capacitors, inductors, or impedance networks).

The circuit in figure 4.8(a) uses an op-amp and a small capacitor, C 1 , to simulate a much larger capacitor. It simulates the simple RC circuit of figure 4.8(b); the resistor R 2 is the same size as the resistor in the circuit being simulated (R 3 ), but the capacitor C 1 is N times smaller than C 2 .

op amp comparator experiment

Figure 4.8 Op-amp capacitance multiplier

Current flows from the input source through R 1 to the capacitor (C 1 ). If R 1 , for example, is 100 times larger than R 2 , there is 1/100th the current through it into the capacitor. For a given input voltage, the rate of change in voltage in C 1 is the same as in the equivalent C 2 in figure 4.8(b), but C 2 appears to have 100 times the capacitance to make up for 1/100th the current.

The voltages across the two capacitors are the same, but the currents are not. The op-amp causes the negative input to be held at the same voltage as the voltage across C 1 . This means R 2 has the same voltage across it as R 3 , and therefore the same current. Since the total current from V IN is the sum of the current in R 1 and R 2 and R 2 is N times smaller than R 1 the apparent charging current is N+1 times larger than the current in C 1 .

4.8 Using Op Amps As Comparators

Op Amps and comparators may seem interchangeable at first glance based on their symbols and pinouts and one might be tempted to use or substitute readily available op amps as voltage comparators in their designs. There are some important differences however. Comparators are designed to work without negative feedback or open-loop, they are designed to drive digital logic circuits from their outputs, and they are designed to work at high speed with minimal instability. Op amps are not generally designed for use as comparators, they may saturate if over-driven which may cause it to recover comparatively slowly. Many have input stages which behave in unexpected ways when driven with large differential voltages, in fact, in many cases, the differential input voltage range of the op amp is limited. And op amp outputs are rarely compatible with logic.

Yet many designers still try to use op amps as comparators. While this may work at low speeds and low resolutions, many times the results are not satisfactory. Not all of the issues involved with using an op amp as a comparator can be resolved by reference to the op amp data sheet, since op amps are not intended for use as comparators.

The most common issues are speed (as we have already mentioned), the effects of input structures (protection diodes, phase inversion in FET amplifiers, and many others), output structures which are not intended to drive logic, hysteresis and stability, and common-mode effects.

Most comparators are quite fast, but so are many op amps. Why should we expect low speed when using an op amp as a comparator?

A comparator is designed to be used with large differential input voltages, whereas op amps normally operate with their differential input voltage minimized by negative feedback. When an op amp is over-driven, sometimes by as little as a few millivolts, some of the internal stages may saturate. If this occurs the device will take a comparatively long time to come out of saturation and will therefore be much slower than if it always remained unsaturated (see figure 4.9).

The time to come out of saturation of an overdriven op amp is likely to be considerably longer than the normal group delay of the amplifier, and will often depend on the amount of overdrive. Since few op amps have this saturation recovery time specified for various amounts of overdrive it will generally be necessary to determine, by experimental measurements in the lab, the behavior of the amplifier under the conditions of overdrive to be expected in a particular design.

The results of such experimental measurements should be regarded with suspicion and the values of propagation delay through the op amp comparator which is chosen for worst-case design calculations should be at least twice the worst value seen in any experiment.

op amp comparator experiment

Figure 4.9: Effects of Saturation on Amplifier Speed when Used as a Comparator

The output of a comparator is designed to drive a particular logic family or families, while the output of an op amp is designed to swing close to it's supply rails if not to the supply rails. Frequently the logic being driven by the op amp comparator will not share the op amp's supplies and the op amp rail to rail swing may go outside the logic supply rails-this will probably damage the logic circuitry, and the resulting short circuit may damage the op amp as well.

There are three types of logic which we must consider: ECL, TTL and CMOS.

ECL is a very fast current steering logic family. It is unlikely that an op amp would be used as a comparator in applications where ECL's highest speed is involved, for reasons given above, so we shall usually be concerned only to drive ECL logic levels from an op amp's signal swing and some additional loss of speed due to stray capacities will be unimportant. To do this we need only three resistors, as shown in figure 4.10.

R 1 , R 2 and R 3 are chosen so that when the op amp output is positive the level at the gate is -0.8 V , and when it is low it is -1.6 V . ECL is occasionally used with positive, rather than negative, supplies (often called PECL where the -5.2V rail is connected to ground and the ground is connected to a positive supply voltage), the same basic interface circuit may be used but the values must be recalculated. Using low resistance values for R 1 , R 2 and R 3 will minimize the effects of stray capacitance but at the same time will increase power consumption.

op amp comparator experiment

Figure 4.10: Op Amp Comparator Driving ECL Logic

Although CMOS and TTL input structures, logic levels, and current flows are quite different (although some versions of CMOS is specified to work with TTL input levels) the same interface circuitry will work perfectly well with both types of logic, since they both work for logic 0 near to 0V and logic 1 near to +5V or whatever the positive supply rail is for that logic family.

op amp comparator experiment

Figure 4.11: Op Amp Comparator Driving TTL or CMOS Logic

The simplest interface uses a single N-channel MOS transistor, M 1 and a pull-up resistor, R L , as shown in figure 4.15. It is important to note here that this interface circuit inverts the output of the op amp and thus reverses the sense of the + and - inputs. A similar circuit may be made with an NPN transistor, Q 1 , R L , and an additional resistor, R 1 and diode D 1 . A resistor between the op amp output and the MOS FET gate and the diode to ground are generally not needed (left side of figure 4.11) because the gate can withstand relatively large voltages with respect to the source. In the case of the NPN BJT (right side of figure 4.11) the resistor serves to limit the base current and the diode limits the maximum reverse bias on the base to one diode drop (-0.7V) below ground. These circuits are simple, inexpensive and reliable, and the outputs of several op amps may be connected through separate transistors with their collectors connected in parallel and a single R L to give a “wired-or” function. The speed of the 0-1 transition depends on the value of R L and the stray capacity of the output node. The lower the value of R L the faster the response will be, but the higher the power consumption.

By using two MOS devices, one P-channel and one N-channel, it is possible to make a CMOS/TTL interface using only two components which has no quiescent power consumption in either state (figure 4.16). Furthermore, it may be made inverting or non-inverting by simple positioning of components. It does, however, have a large current surge during switching, when both devices are on at once, and unless MOS devices with high channel resistance are used a current limiting resistor may be necessary to reduce this effect. It is also important, in this application and the one in figure 4.11, to use MOS devices with gate-source breakdown voltages, V BGS , greater than the output voltages of the comparator in either direction. A value of V BGS > ±25 V is common in MOS devices and is usually adequate, but many MOS devices contain gate protection diodes which reduce the value-these should not be used.

op amp comparator experiment

Figure 4.12: Op Amp Comparator with CMOS Driver

There are a number of effects which must be considered regarding the inputs of op amps when used as comparators. The first-level assumption engineers make about all op amps and comparators is that they have infinite input impedance and can be regarded as open circuits (except for current feedback (transimpedance) op amps, which have a high impedance on their non-inverting input but a low impedance of a few tens of ohms on their inverting input)

But many op amps (especially bias-compensated ones such as the OP-07 and its many descendants) contain protective circuitry to prevent large differential input voltages from damaging the input stage transistors. Protective circuitry such as current limiting resistors and clamp diodes, as shown in figure 4.13, are often integrated between the input pins and the sensitive input transistors. This protection circuit will greatly lower the input impedance for differential input voltages greater than +/- 700 mV .

Other op amp designs contain more complex input circuitry, which only has high impedance when the differential voltage applied to it is less than a few tens of mV , or which may actually be damaged by differential voltages of more than a few volts. It is therefore necessary, when using an op amp as a comparator, to study the manufacturer's data sheet to determine how the input circuitry behaves when large differential voltages are applied to it. It is always necessary to study the data sheet when using an integrated circuit to ensure that its non-ideal behavior, and every integrated circuit ever made has some non-ideal behavior, is compatible with the proposed design - it is just more important than usual in the present case.

Of course some comparator applications never involve large differential voltages-or if they do the comparator input impedance when large differential voltages are present is comparatively unimportant. In such cases it may be appropriate to use as a comparator an op amp whose input circuitry behaves non-linearly-but the issues involved must be considered, not just ignored.

op amp comparator experiment

Figure 4.13: Op Amp Input Structure with Protection

As mentioned elsewhere in this text, nearly all BIFET op amps exhibit anomalous behavior when their inputs are close to one of their supplies (usually the negative supply). Their inverting and non-inverting inputs may become interchanged. If this should occur when the op amp is being used as a comparator the phase of the system involved will be inverted, which could well be inconvenient. The solution is, again, careful reading of the data sheet to determine just what common-mode range is acceptable.

Also, the absence of negative feedback means that, unlike that of op amp circuits, the input impedance is not multiplied by the loop gain. As a result, the input current varies as the comparator switches. Therefore the driving impedance, along with parasitic feedback paths, can play a key role in affecting circuit stability. While negative feedback tends to keep amplifiers within their linear region, positive feedback forces them into saturation.

Operational amplifiers are not designed to be used as comparators, so this section has been, intentionally, a little discouraging. Nevertheless there are some cases where the use of an op amp as a comparator is a useful engineering decision-what is important is to make it a considered decision, and ensure that the op amp chosen will perform as expected. To do this it is necessary to read the manufacturer's data sheet carefully, to consider the effects of non-ideal op amp performance, and to calculate the effects of op amp parameters on the overall circuit. Since the op amp is being used in a non-standard manner some experimentation may also be necessary, since the amplifier used for the experiment will not necessarily be typical and the results of experiments should always be interpreted somewhat pessimistically.

ADALM1000 Lab Activity Comparators

Although the simple voltage comparator circuit using either an ordinary operational amplifier or a special comparator is often adequate, the input waveform may be slow or have noise superimposed on it. This can result in the possibility that the output will switch back and forth several times as the input transitions through the comparator threshold voltage. The very large open loop gain of the amplifier will allow only small levels of noise on the input to cause the output to change. This may not cause a problem in some circumstances, but if the output from the operational amplifier comparator is being fed into fast logic circuitry, then it can often result in problems. For example, if the desire is to count the number of times the input crosses the threshold then these multiple output changes per input transition will give false readings.

The problem can be solved very easily by adding some positive feedback to the operational amplifier or comparator circuit. This is provided by the addition of R 3 in the circuit in figure 4.14. The circuit is known as a Schmitt trigger. Resistor divider R 1 and R 2 set the comparison voltage at the non-inverting input of the op amp.

op amp comparator experiment

Figure 4.14 Operational amplifier Schmitt trigger circuit

The effect of the new resistor (R 3 ) is to give the circuit different switching thresholds dependent upon the output state of the comparator or op amp. When the output of the comparator is high, this voltage is fed back to the non-inverting input of the op amp or comparator. As a result the comparison threshold becomes higher. When the output is switched low, the comparison threshold is lowered. This gives the circuit what is called hysteresis.

It is straight forward to calculate the resistor values needed for the Schmitt trigger circuit. The center voltage about which the circuit will switch is determined by the voltage divider consisting of R 1 and R 2 . This should be chosen first. Then the feedback resistor R 3 can be calculated. This will provide a level of hysteresis that is equal to the output swing of the op amp reduced by the voltage divider (attenuation) formed as a result of R 3 and the parallel combination of R 1 and R 2 . The higher the value of R 3 with respect to R 1 ||R 2 the smaller the hysteresis, or the difference between the two threshold levels.

The fact that the positive feedback applied within the circuit ensures that there is effectively a higher gain and therefore the switching is faster. This is particularly useful when the input waveform may be slow. However a speed up capacitor can be applied within the Schmitt trigger circuit to increase the switching speed still further. By placing a capacitor across the positive feedback resistor R 3 , the gain can be increased during the changeover, making the switching even faster. This capacitor, known as a speed up capacitor may be anywhere between 10 pF and 100 pF dependent upon the circuit.

Return to Previous Chapter

Go to Next Chapter

Return to Table of Contents

  • View Source
  • Fold/unfold all
  • [ Back to top ]

op amp comparator experiment

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to design a comparator using op-amp?

Intention is to design a comparator with following specification:

Input: 0V to 1.65V, Output: Low

Input: 2.1V to 5V, Output: High

This is the TI design doc I have refereed for the design.

enter image description here

For my design requirement, I have recalculated the value of Rx, Ry and Rh as follows,

Rx = 10K Ry = 5.689K Rh = 36.67K ( VL = 1.65V, VH= 2.1V and VCC = 5V)

enter image description here

But the simulation result is as follows:

enter image description here

Obs: As per the LTSpice simulation VL is 2.02V and VH is 1.65V It is not matching with the design I have done.

Please do advice why there is a mismatch between the design and simulation. Kindly let me know if further any information required.

  • operational-amplifier

vt673's user avatar

  • 1 \$\begingroup\$ Can you label the nodes in your circuit so we can tell which trace in the chart is which? \$\endgroup\$ –  The Photon Commented Oct 16, 2017 at 16:13

You are assuming the op-amp will output 5V when high and 0V when low, they do not.

Look at the green output in your image, notice high is under 4.5V and low is above ground.

You would need to use those voltages in your math.

enter image description here

Also be aware, Voh and Vol of the op-amp will vary from device to device, with temperature, and depending on what load is attached to the output. Using op-amps as comparators is generally not a great idea.

The above is partly the reason why most actual comparator devices are open collector outputs.

schematic

simulate this circuit – Schematic created using CircuitLab

\$Th_{lo} \approx V_{cc} * R2||R3/(R1 + R2||R3)\$

\$Th_{hi} = V_{cc} * R2/(R2 + R1||(R3+R4))\$

Trevor_G's user avatar

  • \$\begingroup\$ Ideally it should be 5V high and 0V low right? Why this change? How can I make 5V high and 0V low at output? \$\endgroup\$ –  vt673 Commented Oct 16, 2017 at 16:14
  • \$\begingroup\$ @vt673 you can pick a better op-amp that gets closer to the rail, but you will never get exactly 5V and 0V. You need to figure out how much tolerance you can accept on the thresholds and work it back from there. \$\endgroup\$ –  Trevor_G Commented Oct 16, 2017 at 16:16
  • \$\begingroup\$ I was referring the op-omp datasheet, link . I am bit confused as I failed to find the tolerance of LT1006. What parameter can be referred against the the change in high and low of the op-amp output? \$\endgroup\$ –  vt673 Commented Oct 16, 2017 at 16:33
  • 1 \$\begingroup\$ @vt673 Maximum Output Voltage Swing.. at 5V ~ 4.4V typical. Can be as low as 4V could be closer to 5V.. \$\endgroup\$ –  Trevor_G Commented Oct 16, 2017 at 16:41

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

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 operational-amplifier comparator hysteresis or ask your own question .

  • The Overflow Blog
  • One of the best ways to get value for AI coding tools: generating tests
  • The world’s largest open-source business has plans for enhancing LLMs
  • Featured on Meta
  • User activation: Learnings and opportunities
  • Site maintenance - Mon, Sept 16 2024, 21:00 UTC to Tue, Sept 17 2024, 2:00...

Hot Network Questions

  • What was the main implementation programming language of old 16-bit Windows versions (Windows 1 - Windows 3.11)?
  • How did NASA figure out when and where the Apollo capsule would touch down on the ocean?
  • Is it feasible to create an online platform to effectively teach college-level math (abstract algebra, real analysis, etc.)?
  • How to decrease by 1 integers in an expl3's clist?
  • The meaning of an implication in an existential quantifier
  • How many engineers/scientists believed that human flight was imminent as of the late 19th/early 20th century?
  • Function with memories of its past life
  • What are the pros and cons of the classic portfolio by Wealthfront?
  • How can I analyze the anatomy of a humanoid species to create sounds for their language?
  • Why Pythagorean theorem is all about 2?
  • Navigating career options after a disastrous PhD performance and a disappointed advisor?
  • If Act A repeals another Act B, and Act A is repealed, what happens to the Act B?
  • What would the natural diet of Bigfoot be?
  • Definition of annuity
  • In this page of Ein Yaakov on Sotah, near the bottom of the page, appears the word "Piska" in bold lettering. What does it signify?
  • Concerns with newly installed floor tile
  • What “C’s” did Tugger borrow from the Pin?
  • Treat unset variables as an error when substituting (set -u) ignores array expansion
  • What came of the Trump campaign's complaint to the FEC that Harris 'stole' (or at least illegally received) Biden's funding?
  • Help updating 34 year old document to run with modern LaTeX
  • Is there an essential distinction between experienced and observed consciousness?
  • Is it safe to use the dnd 3.5 skill system in pathfinder 1e?
  • Copyright Fair Use: Is using the phrase "Courtesy of" legally acceptable when no permission has been given?
  • What is the rationale behind 32333 "Technic Pin Connector Block 1 x 5 x 3"?

op amp comparator experiment

COMMENTS

  1. PDF CIRCUITS LABORATORY EXPERIMENT 9 Operational Amplifiers

    An operational amplifier ("op amp") is a direct-coupled, differential-input, high-. gain voltage amplifier, usually packaged in the form of a small integrated circuit. The. term "operational" dates back to the early days of analog computers when these devices. were employed in circuits that performed mathematical operations such as addition ...

  2. Op-amp Comparator

    Op-amp Comparator. The comparator is an electronic decision making circuit that makes use of an operational amplifiers very high gain in its open-loop state, that is, there is no feedback resistor. The Op-amp comparator compares one analogue voltage level with another analogue voltage level, or some preset reference voltage, V REF and produces ...

  3. 741 IC Op-amp comparator circuit diagram,schematic ...

    A non-inverting 741 IC op-amp comparator circuit is shown in the figure below. It is called a non-inverting comparator circuit as the sinusoidal input signal Vin is applied to the non-inverting terminal. The fixed reference voltage Vref is give to the inverting terminal (-) of the op-amp. When the value of the input voltage Vin is greater than ...

  4. PDF MT-084: Using Op Amps as Comparators

    Op amps are not designed for use as comparators, they may saturate if over-driven which may cause it to recover comparatively slowly. Many have input stages which behave in unexpected ways when used with large differential voltages, in fact, in many cases, the differential input voltage range of the op amp is limited.

  5. PDF Operational Amplifier Circuits Comparators and Positive Feedback

    The basic comparator circuit is an op-amp arranged in the open-loop configuration as shown on the circuit of Figure 1. The op-amp is characterized by an open-loop gain A and let's assume that the output voltage Vo can go all the way to VDD and VEE. The output voltage is given by. Vo = A ( V −V ) + −.

  6. 2.3: Simple Op Amp Comparator

    Figure 2.3.1 2.3. 1: Comparator (single input). The op amp cannot produce 20,000 V. The data sheet lists a maximum output swing of only ± ± 13.5 V when using ± ± 15 V supplies. The output will be truncated at 13.5 V. If the input signal is reduced to only 1 mV, the output will still be clipped at 13.5 V.

  7. Op Amp Comparator

    In this electronics tutorial, I explain the fundamentals of how op amp comparators work and walk through an example problem.For more on nonideal op amps:http...

  8. Analog Lab

    Instructions. Step 1: Build the op amp circuit illustrated in Figures 1 and 2. Figure 2. Breadboard implementation of the analog comparator with LED indicator. The resistors connected to the output of the op amp limit the current through the LED. Step 2: Adjust the two potentiometers and observe the LED. From this, you should be able to easily ...

  9. ADALM2000 Activity: Op Amp as Comparator

    For an op amp comparator, we can consider a single input V D as the difference between V+ and V-. Therefore, the output voltage V O can get one of the two possible values: V O = V OH (high), meaning that V+ > V- (v D > 0) V O = V OL (low), meaning that V+ < V- (v D < 0) We consider the threshold voltage V Th as the particular value (or ...

  10. Op-Amps, Comparator Circuit

    Comparators are often used, for example, to check whether an input has reached some predetermined value. In most cases a comparator is implemented using a dedicated comparator IC, but op-amps may be used as an alternative. Comparator diagrams and op-amp diagrams use the same symbols. Figure 4 shows a comparator circuit.

  11. How an Op-amp Comparator Works

    With an op-amp, the output amplifies the difference between the two inputs. If the voltage on the non-inverting input is higher than the voltage on the inverting input, the output will create a positive voltage that amplifies the difference in input voltages. Ideally, that amplification factor is infinite, though real op-amps obviously are not ...

  12. PDF Experiment 10 Operational Amplifier Circuits

    Figure 4: "Integrator" amplifier Non-linear Op Amp Circuits: An operational amplifier can be used in logic-like applications to make voltage comparators and "latch" circuits that memorize signal states. These are useful in process control. When used with a diode, an op amp can perform non-linear mathematical

  13. 3: The Op Amp Comparator

    Electronics. Laboratory Manual: Operational Amplifiers and Linear Integrated Circuits 3e (Fiore) Page ID. 26281. James M. Fiore. Mohawk Valley Community College. In this exercise, the performance of a typical op amp will be examined in the open-loop mode. This circuit is often referred to as a comparator. The investigation will include the ...

  14. PDF Comparator and Schmitt Trigger Circuit Using Op-amp

    supply voltages, since the op-amp is used in the open loop configuration, a small difference (−) makes the output to saturate). For the comparator circuit shown in Figure 1, the output will be at its negative saturation value when the input is greater than the reference and at its positive saturation value when the input is less than the ...

  15. Using an op amp as a comparator

    Figure 1 The op amp is used as a comparator with zero threshold voltage. The above comparator circuit operates around zero volts. Figure 2 adds a resistive divider to the circuit to set the voltage at the inverting input, providing a means to control the reference voltage for the comparator, V REF. Figure 2 An op amp comparator with a resistive ...

  16. PDF INTRODUCTION V+ WHY USE AN OP AMP AS A COMPARATOR? V-

    There are several reasons to use op amps as comparators. Some are technical, one is purely economic. Op amps are manufactured as single devices, but also as duals and quads, two or four op amps on a single chip. These duals and quads are cheaper than two or four separate op amps and occupy less board space, saving yet more money.

  17. OPAMP Comparators

    The simplest comparator consists of an op-amp without any resistor or feedback loop, the signal to compare is V 1 and supplies the non-inverting input, a reference signal V ref supplies the inverting input, the output is labeled V out and the supply power is V S+ and V S-, which can be symmetrical or not. fig 1: Non-inverting comparator circuit ...

  18. Activity: Op Amp as Comparator, For ADALM2000

    For an op-amp comparator we can consider a single input v D as the difference betwee v + and v -. Therefore, the output voltage VO can get one of the two possible values: VO = VOH (High), meaning that v + > v - (v D > 0) VO = VOL (Low), meaning that v + < v - (v D < 0) We consider the threshold voltage VTh as the particular value/values of the ...

  19. Virtual Labs

    A comparator circuit is basically an operational amplifier without feedback, that is, the op-amp is used in its open-loop configuration, and when the input voltage, V in exceeds a preset reference voltage, V ref, the output changes state. Due to the very high open-loop gain of the operational amplifier, using it with positive feedback or even ...

  20. Op-Amp Applications

    Expected waveforms: COMPARATOR: Fig 4. Result: Verified the functioning of adder, subtractor and comparator circuits using Op-Amp 741. Outcome: After conducting this experiment, students are able to design the circuits using op-amps to perform addition, subtraction and comparison operations.

  21. Chapter 4: Op Amp applications

    The effect of the new resistor (R 3) is to give the circuit different switching thresholds dependent upon the output state of the comparator or op amp. When the output of the comparator is high, this voltage is fed back to the non-inverting input of the op amp or comparator. As a result the comparison threshold becomes higher.

  22. operational amplifier

    Also be aware, Voh and Vol of the op-amp will vary from device to device, with temperature, and depending on what load is attached to the output. Using op-amps as comparators is generally not a great idea. ADDITION: The above is partly the reason why most actual comparator devices are open collector outputs.

  23. Experiment 4: Op-amp Comparator Laboratory Report

    Op amps used as a comparator should have a fast slew rate to be able to switch from one state to the other quickly. [1] This experiment aims to understand the open-loop behavior of the op amp, verify the differential input action of an amp and to explain the effect of slew rate in comparator circuits.