Home Back Video download Video download PDF download Ppt download IWB download PDF download

Comparator Circuits

Introduction

An operational amplifier, or Op-Amp, can be used to compare two input voltages and decide which is bigger.

This is very useful, for example, when using input transducers to detect when the temperature has exceeded a certain value or the light level is above a certain brightness. An analogue input transducer is usually used with a comparator if a digital output is required. A comparator takes an analogue input and has a digital output (either ON or OFF) and is therefore a very simple Analogue to Digital Converter (ADC).

Basic Functionality

An Op-Amp (such as the 741 IC) has two inputs:

When the Non-Inverting input is a bigger voltage than the Inverting input, the output will be as big as possible (i.e. ON). This can be written as:
if V+ > V then Vout > 0
When the Non-Inverting input is a smaller voltage than the Inverting input, the output will be as low as possible (i.e. OFF). This can be written as:
if V > V+ then Vout ≤ 0
(assuming the Op-Amp has normal power supply arrangements).

Important Note: The maximum and minimum output voltages often have about a 2 V difference from the power supply voltages. For an Op-Amp connected to a 0 V and 9 V supply (i.e. a battery) the highest output voltage will be 7 V and the lowest will be 2 V. For an Op-Amp connected to ±15 V supplies the maximum and minimum output voltages will be ±13 V. The exact voltage difference depends on the type of Op-Amp IC used and some Op-Amps are designed to have no voltage difference between the supply voltage and the maximum output voltage.

Several Examples

Example1The Non-Inverting input is bigger than the Inverting input

The output will be as big as possible

The power supply is 9 V, therefore

Vout = 7 Volts


Example2The Non-Inverting input is smaller than the Inverting input

The output will be as small as possible

The lower power supply is 0 V, therefore

Vout = 2 Volts


Example3The Non-Inverting input is bigger than the Inverting input

The output will be as big as possible

The power supply is +12 V, therefore

Vout = +10 Volts


Example4The Non-Inverting input is smaller than the Inverting input

The output will be as small as possible

The lower power supply is −12 V, therefore

Vout = −10 Volts



In Summary (using technical language):
An op-amp, used without any limiting feedback, will amplify the difference between the inputs by the open loop gain. As the open loop gain is assumed to be very large then even a very small difference between the inputs will result in the output saturating. The output saturating means that the output voltage gets as close to the supply voltage as possible. For example, if a standard 741 is used with ±15 V power supplies then the output voltage will either be +13 V or −13 V unless the inputs are within a few microvolts of each other. In effect the Op-Amp is comparing the two inputs and giving an output that shows which of the inputs is bigger ... hence the Op-Amp is acting as a comparator.

The output voltage is given by the equation:

Vout = A0 (V+ − V)
Where A0 is the open loop gain. A0 is approximately 106 for standard Op-Amps


Using LDRs, Thermistors and Potentiometers

When comparators are used as an input subsystem with an analogue transducer (such as an LDR) one of the inputs is held at a fixed reference voltage. The other input is connected to a potential divider containing the input transducer. The output of the comparator will either be ON or OFF.

Example with LDRThe two 10 kΩ resistors form a potential divider and hold the Inverting input at 4.5 V, this is the fixed reference voltage.

The LDR and the unlabelled resistor form a potential divider that determines the voltage at the Non-Inverting input, V+.

When it is DARK the resistance of the LDR is high and therefore V+ is a low voltage. The Non-Inverting input is smaller than 4.5 V and the output is LOW or OFF.

When it is LIGHT the resistance of the LDR is low and therefore V+ is a higher voltage. The Non-Inverting input is bigger than 4.5 V and the output is HIGH or ON


Example with ThermistorThe fixed potential divider has been replaced with a potentiometer so that the reference voltage (Vref) at the Inverting input can be changed.

The thermistor and the unlabelled resistor form a potential divider that sets the voltage (V+) at the Non-Inverting input.

When it is COLD the resistance of the thermistor is high and the voltage at the Non-Inverting input is bigger than the reference voltage at the Inverting input. The output is HIGH or ON.

When it is HOT the resistance of the thermistor is low and the voltage at the Non-Inverting input is smaller than the reference voltage at the Inverting input. The output is LOW or OFF.

The potentiometer sets the temperature at which the output changes from HIGH to LOW or LOW to HIGH. At the point where the output changes state, the voltages at the Inverting and Non-Inverting inputs are (virtually) the same.


Source and Sink

Current SourceThe output of an Op-Amp can act as a current SOURCE.

Current flows from the positive power supply, through the Op-Amp, out of the output and through the LED (in this case) to the negative power supply, which could be zero volts or could be a negative voltage.

The output of the Op-Amp is at a high voltage and provides current for the output transducer.

The same is true of almost any active device such as logic gates, timers, counters and drivers. All of these active components can act as a current source.


Current SinkThe output of an Op-Amp can act as a current SINK.

Current flows from a point of higher potential, into the output of the Op-Amp, through the Op-Amp and down to the negative power supply.

The output of the Op-Amp is at a low voltage (possibly negative) and allows current to flow through the output transducer from a point at a higher voltage.

The output of the Op-Amp is called the output because it controls the output transducer. It is NOT called the output because current flows out of the output because current can also flow into the output.

The same is true of almost any active device such as logic gates, timers, counters and drivers. All of these active components can act as a current sink.


Example of an Op-Amp acting as both a current source and a current sink

Example with ThermistorThe potentiometer provides a variable reference voltage (Vref) at the Inverting input.

The thermistor and the unlabelled resistor form a potential divider that sets the voltage (V+) at the Non-Inverting input.

The ±15 V power supply means that the output will be either +13 V or −13 V.

When it is COLD the resistance of the thermistor is high and the voltage at the Non-Inverting input is bigger than the reference voltage at the Inverting input. The output is +13 V and the Red LED is forward biased. Current flows from the Op-Amp through the resistor, through the Red LED and down to 0 V. The output of the Op-Amp is a current source.

When it is HOT the resistance of the thermistor is low and the voltage at the Non-Inverting input is smaller than the reference voltage at the Inverting input. The output is −13 V and the Green LED is forward biased. Current flows from the 0 V supply, through the Green LED and the series resistor and into the Op-Amp down to the −15 V supply. The output of the Op-Amp is a current sink.


Range Detector

It can be very useful to know when an input is within a certain range of values. For example, a bath thermometer should tell you if the temperature is too hot or too cold or when it is within a given range and just right. This is achieved by connecting the input voltage to a pair of Op-Amps.

Range detectorThe three 10 kΩ resistors form a potential divider that divide the 9 V supply equally into three parts so that the Non-Inverting input of Op-Amp 1 is at 6 V and the Non-Inverting input of Op-Amp 2 is at 3 V.

The input voltage (Vin) is connected to the Inverting inputs of both Op-Amps

When Vin is less than 3 V: The Non-Inverting inputs of both Op-Amps are larger than the Inverting inputs. Output 1 = +13 V and Output 2 = +13 V. There is no potential difference across the LED and the LED is therefore OFF.

When Vin is between 3 V and 6 V: The Non-Inverting input Op-Amp 1 is larger than the Inverting input and Output 1 = +13 V. The Non-Inverting input Op-Amp 2 is smaller than the Inverting input and Output 2 = −13 V. There is a potential difference of 26 V across the LED and the series resistor. Current flows from Op-Amp 1 (source), through the resistor and LED and into Op-Amp 2 (sink). The LED is therefore forward biased and will be illuminated.

When Vin is more than 6 V: The Non-Inverting inputs of both Op-Amps are smaller than the Inverting inputs. Output 1 = −13 V and Output 2 = −13 V. There is no potential difference across the LED and the LED is therefore OFF.

The LED is only lit when the input voltage is between 3 V and 6 V. The range of voltages can be changed by using different resistors for the potential divider or by using potentiometers to individually set each Non-Inverting input.


Inputs and Output Combinations

Different input and output combinations can achieve the same result. The output of the Op-Amp can source and sink current and the Inverting and Non-Inverting inputs can be either way round.

In the first four examples, the Op-Amp acts as a current SOURCE

Input and Output CombinationsWhen the temperature rises, the resistance of the thermistor goes down. The voltage at the Non-Inverting input goes down. When it becomes less than the reference voltage the output voltage goes from 7 V to 2 V and the LED goes OFF.

When the temperature goes UP, the LED goes OFF.


Input and Output CombinationsThermistor and resistor swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Non-Inverting input goes up. When it becomes more than the reference voltage the output voltage goes from 2 V to 7 V and the LED comes ON.

When the temperature goes UP, the LED comes ON.


Input and Output CombinationsNon-Inverting and Inverting inputs swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Inverting input goes down. When it becomes less than the reference voltage the output voltage goes from 2 V to 7 V and the LED comes ON.

When the temperature goes UP, the LED comes ON.


Input and Output CombinationsNon-Inverting and Inverting inputs swap places and Thermistor and resistor swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Inverting input goes up. When it becomes more than the reference voltage the output voltage goes from 7 V to 2 V and the LED goes OFF.

When the temperature goes UP, the LED goes OFF.



In the next four examples, the Op-Amp acts as a current SINK

Input and Output CombinationsWhen the temperature rises, the resistance of the thermistor goes down. The voltage at the Non-Inverting input goes down. When it becomes less than the reference voltage the output voltage goes from 7 V to 2 V. The potential difference across the LED is now (9 V − 2 V) 7 V and the LED comes ON. Current flows from the 9 V rail, through the LED and resistor and into the Op-Amp which is acting as a current sink.

When the temperature goes UP, the LED comes ON.


Input and Output CombinationsThermistor and resistor swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Non-Inverting input goes up. When it becomes more than the reference voltage the output voltage goes from 2 V to 7 V. The potential difference across the LED is now only 2 V and the LED goes OFF.

When the temperature goes UP, the LED goes OFF.


Input and Output CombinationsNon-Inverting and Inverting inputs swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Inverting input goes down. When it becomes less than the reference voltage the output voltage goes from 2 V to 7 V. The potential difference across the LED is now reduced to 2 V and the LED goes OFF.

When the temperature goes UP, the LED goes OFF.


Input and Output CombinationsNon-Inverting and Inverting inputs swap places and Thermistor and resistor swap places. When the temperature rises, the resistance of the thermistor goes down. The voltage at the Inverting input goes up. When it becomes more than the reference voltage the output voltage goes from 7 V to 2 V. There is a 7 V potential difference across the LED and the LED comes ON.

When the temperature goes UP, the LED comes ON.


Important Note: All of the above examples assume that the LED needs more that 2 V to conduct and that when the potential difference is 2 V then the LED is in actual fact OFF. There are some LEDs where this is not the case and 2 V is sufficient to turn them ON. In this case, placing a normal diode with a 0.7 V forward bias voltage drop in series with the LED is usually sufficient to make the circuits behave as expected. Alternatively rail to rail Op-Amps can be used.