FB pixel

How an Op-amp Comparator Works

Published

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.

Op-amp comparator typical circuit diagram
Op-amp comparator input/output graph

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.

Summary

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.

Make Bread with our CircuitBread Toaster!

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

What are you looking for?