In this post we comprehensively learn how to use any opamp as a comparator in a circuit for comparing a input differentials and producing the corresponding outputs.
What is an Opamp Comparator
We've been using an opamp IC probably since we started learning electronics, I am referring to this wonderful little IC 741, through which virtually any comparator based circuit designing becomes feasible.
Here we are discussing one of the simple application circuits of this IC where it is being configured as a comparator, no surprise the following applications can be modified in numerous different ways as per the user preference.
As the name suggests, opamp comparator refers to the function of comparing between a particular set of parameters or may be just a couple of magnitudes as in the case.
Since in electronics we are primarily dealing with voltages and currents, these factors become the sole agents and are used for operating or regulating or controlling the various components involved.
In the proposed opamp comparator design, where the IC 741 is being used as a comparator, basically different voltage levels are used as the referring and comparaing parameters by the IC.
The two input pins named the inverting (with a minus sign)and the non-inverting pin (with a + sign) become the sensing inputs of the IC 741.
When used as a comparator, one of the pins out of the two is applied with a fixed reference voltage while the other pin is fed with the voltage whose level needs to be monitored.
The monitoring of the above voltage is done with reference to the fixed voltage that's been applied to the other complementary pin.
Therefore if the voltage which is to be monitored goes above or falls below the fixed reference threshold voltage, the output reverts state or changes its original condition or changes its output voltage polarity.
How an Opamp Comparator Works
Let's analyze the above explanation by studying the following example circuit of a light sensor switch.
Looking at the circuit diagram we find the circuit configured in the following way:
We can see that the Pin #7 of the opamp which is the +supply pin is connected to the positive rail, similarly its pin #4 which is the negative supply pin is connected to the negative or rather the zero supply rail of the power supply.
The above couple of pin connections powers the IC so that it can carry on with its intended functions.
Now as discussed earlier, pin #2 of the IC is connected at the junction of two resistors whose ends are connected to the power supply positive and negative rails.
This arrangement of the resistors is called a potential divider, meaning the potential or the voltage level at the junction of these resistors will be approximately the half of the supply voltage, so if the supply voltage is 12, the junction of the potential divider network will be 6 volts and so on.
If the supply voltage is well regulated, the above voltage level will also be well fixed and therefore can be used as the reference voltage for the pin #2.
Therefore referring to the junction voltage of the resistors R1/R2, this voltage becomes the reference voltage at pin #2 which means the IC will monitor and respond to any voltage that might go above this level.
The sensing voltage which is to be monitored is applied to pin #3 of the IC, in our example it is via an LDR. The pin #3 is connected at the junction of the LDR pin and a preset terminal.
That means this junction again becomes a potential divider, whose voltage level this time is not fixed because the LDR value cannot be fixed and will vary with the ambient light conditions.
Now suppose you want the circuit to sense the LDR value at some point just around when dusk falls, you adjust the preset such that the voltage at pin #3 or at the junction of the LDR and the preset just crosses above the 6V mark.
When this happens the value rises above the fixed reference at pin #2, this informs the IC about the sense voltage rising above the reference voltage at pin #2, this instantly reverts the output of the IC which changes to positive from its initial zero voltage position.
The above change in the state of the IC from zero to positive, triggers the relay driver stage which switches ON the load or the lights which might be connected to the relevant contacts of the relay.
Remember, the values of the resistors connected to pin #2 may also be altered for altering the sensing threshold of pin #3, so they are all inter-depended, giving you a wide angle of variation of the circuit parameters.
Another feature of the R1 and R2 is that it avoids the need of using a dual polarity power supply making the involved configuration very simple and neat.
Interchanging the Sensing Parameter with Adjustment Parameter
As shown below, the above explained operation response can be just reversed by interchanging the input pin positions of the IC or, by considering another option where we only inter-change the positions of the LDR and the preset.
THis is how any basic opamp behaves when it is configured as a comparator.
To summarize we can say that in any opamp based compartaor, the following operations take place:
1) When the inverting pin (-) is applied a fixed voltage reference, and the non-inverting (+) input pin is subjected to an altering sensing volatge, the output of the opamp remains 0V or negative as long as the (+) pin voltage stays below the (-) refernce pin voltage level.
Alternately as soon as the (+) pin volatge goes higher than the (-) voltage, the output quickly turns positive supply DC level.
1) Conversely, when the non-inverting pin (+) is applied a fixed voltage reference, and the inverting (-) input pin is subjected to an altering sensing voltage, the output of the opamp remains supply DC level or positive as long as the (-) pin voltage stays below the (+) refernce pin voltage level.
Alternately as soon as the (-) pin volatge goes higher than the (+) voltage, the output quickly turns negative or switches OFF to 0V.