Voltage Comparators
Bridging the Analogue and Digital Worlds
A sensor voltage divider produces a smoothly varying output — a continuous analogue signal that could sit at any value between 0 V and the supply. But a logic gate or microcontroller needs a clean binary signal: decisively HIGH or decisively LOW. A voltage comparator is the bridge between these two worlds. It performs one simple operation: it compares two voltages and tells you which is bigger.
How a Comparator Works
A comparator IC has two inputs and one output:
- Non-inverting input (+): receives the sensor signal (the varying voltage from the transducer voltage divider).
- Inverting input (−): receives the reference voltage — a fixed voltage set by a potential divider or potentiometer, representing the threshold at which the output should switch.
- Output: switches to HIGH (close to the positive supply) when the non-inverting input is greater than the reference; switches to LOW (close to 0 V) when the non-inverting input is less than the reference.
The rule is easy to remember: + > − ⇒ output HIGH; + < − ⇒ output LOW. The output does not sit at an in-between voltage — because the comparator has an extremely high open-loop gain, the tiniest difference between the inputs is amplified to drive the output rail-to-rail.
Comparator output rule: if V(+) > V(−) then output = HIGH. If V(+) < V(−) then output = LOW. The output switches sharply because the open-loop gain is very large — it never sits midway.
The Inverting Input Gets the Reference — and Why
The convention used in the circuits in this course is: the inverting (−) input gets the reference voltage and the non-inverting (+) input gets the sensor signal. This means:
- When the sensor signal exceeds the reference, the output goes HIGH. If the sensor is an LDR divider whose output rises in bright light, the output goes HIGH in bright light — which is what a light-activated relay circuit needs.
- When the sensor signal drops below the reference, the output goes LOW. This LOW state can be used to signal an alarm condition or turn off a load.
Swapping the inputs produces an inverted comparator that does the opposite. Be explicit about which input receives which signal in every circuit drawing and answer.
Setting the Reference Voltage
The reference voltage is set by a second voltage divider (often a fixed resistor and a variable resistor or potentiometer) connected between the supply and 0 V. Adjusting the potentiometer changes the threshold — the point at which the comparator switches. For example, with a 9 V supply and a potentiometer set to give 4.5 V at the inverting input, the comparator switches its output when the sensor voltage crosses 4.5 V.
Circuit: 9 V supply. LDR voltage divider feeds the non-inverting (+) input. A potentiometer sets the inverting (−) input to 4.5 V.
In bright light, the LDR resistance is low; \(V(+) = 2 \text{ V}\). Since 2 V < 4.5 V, the output is LOW.
In darkness, the LDR resistance is high; \(V(+) = 7 \text{ V}\). Since 7 V > 4.5 V, the output is HIGH.
This HIGH output could drive a transistor or MOSFET to switch on a street lamp. The sensor, comparator and transistor driver form the complete input → processing → output chain of the system.
Convention: sensor signal → non-inverting input (+); reference voltage → inverting input (−). Output HIGH when sensor exceeds reference; output LOW when sensor is below reference.
Output Drive Limitations
A comparator IC can directly drive a small LED (with a series current-limiting resistor), a logic gate input, or another comparator input. It cannot directly drive a motor, solenoid or lamp because these require more current than the comparator output can supply. A transistor or MOSFET transducer driver must be inserted between the comparator output and the high-current load. This is explicitly in the specification under the comparison of comparator, transistor and MOSFET drive capabilities.
A night-light must switch on a 200 mA lamp when darkness falls. Here is the complete design chain:
Input: 10 kΩ fixed resistor (R1, top) and LDR (R2, bottom) in a voltage divider from 9 V, so the sensor voltage is the voltage across the LDR. In darkness, LDR resistance rises ⇒ more voltage across the LDR ⇒ \(V(+)\) is HIGH in darkness. (With the LDR at the top, the output would be LOW in darkness: the wrong way round for a night-light.)
Processing: Comparator with reference at 4.5 V on inverting (−) input. In darkness \(V(+)\) rises above 4.5 V ⇒ output HIGH. In daylight \(V(+)\) falls below 4.5 V ⇒ output LOW.
Output: Comparator output → base resistor → npn transistor base. When comparator is HIGH, transistor saturates ⇒ lamp turns on. The comparator’s HIGH output forward-biases the transistor’s base-emitter junction.