Comparators
1. What Is a Comparator?
A comparator is an electronic circuit that compares two input voltages and produces an output indicating which voltage is higher.
Comparators are commonly used in sensor circuits, automatic lighting systems, battery voltage monitoring, temperature control, and electronic switching circuits.
A comparator has three main functional connections:
- Non-inverting input (+): Receives one of the voltages being compared.
- Inverting input (−): Receives the other voltage, often a reference voltage.
- Output: Changes state according to the relationship between the two input voltages.
LM393 Dual Comparator IC DIP-8 - synthCube
For example, a comparator can compare a light sensor's voltage with a reference voltage to determine whether the surrounding area is bright or dark.
2. Working Principle of a Comparator
A comparator compares the voltage at its two inputs.
Its basic operation is:
- If , the output goes toward its high state.
- If , the output goes toward its low state.
Here, is the non-inverting input voltage, and is the inverting input voltage.
Was Komparatoren leisten und wo sie eingesetzt werden
Unlike a typical linear amplifier circuit, a comparator is generally designed to switch between output states rather than produce a continuously amplified version of the input difference.
Example
Suppose the reference voltage is 3 V.
| Sensor voltage | Reference voltage | Comparator output tendency |
|---|---|---|
| 1 V | 3 V | Low |
| 2 V | 3 V | Low |
| 3.5 V | 3 V | High |
| 4.5 V | 3 V | High |
This table assumes the sensor is connected to the non-inverting input and the reference is connected to the inverting input.
The actual output voltage levels depend on the comparator's power supply and output design.
3. Comparator Circuit Diagram
A basic comparator circuit can be constructed using a comparator IC such as the LM393.
LM2903-N: Figure Error in the Datasheet - Amplifiers forum - Amplifiers - TI E2E support forums
In a typical circuit:
- A sensor provides the input voltage.
- A reference voltage sets the switching threshold.
- The comparator compares the two voltages.
- The output changes state when the sensor voltage crosses the threshold.
The LM393 has an open-collector output, so an appropriate pull-up resistor is normally required. Its output does not independently drive itself high.
4. Types of Comparators
Comparators are commonly classified according to their input arrangement and switching behavior.
A. Non-Inverting Comparator
In a non-inverting comparator, the signal being measured is connected to the non-inverting input, while the reference voltage is connected to the inverting input.
What is comparator | Electronics Forums
Its operation is:
- When , the output tends toward its high state.
- When , the output tends toward its low state.
Example: A light sensor voltage increases as the light intensity increases. The comparator can switch an output when the voltage rises above a selected threshold.
B. Inverting Comparator
In an inverting comparator, the input signal is connected to the inverting input, and the reference voltage is connected to the non-inverting input.
Op Amp vs Comparator Explained: Differences, Working Principles, and Applications
Its operation is:
- When , the output tends toward its high state.
- When , the output tends toward its low state.
The output behavior is opposite to that of a non-inverting comparator with the same input and reference voltages.
5. What Is a Reference Voltage?
A reference voltage is a known voltage against which another voltage is compared.
It establishes the point at which the comparator changes its output state.
For example, if a circuit must detect when a battery voltage falls below 3.3 V, a suitable 3.3 V reference can be applied to one comparator input.
When the battery voltage crosses the threshold, the comparator changes its output state.
A reference voltage can be produced using:
- A voltage divider made from resistors.
- A voltage reference IC.
- A Zener diode circuit.
- An adjustable potentiometer circuit.
For a simple unloaded voltage divider:
Where:
- = Supply voltage.
- = Upper resistor.
- = Lower resistor.
- = Voltage at the midpoint.
Example: A 5 V supply is connected to a divider containing a 10 kΩ upper resistor and a 10 kΩ lower resistor.
This calculation assumes the comparator input draws negligible current and the reference node is not significantly loaded.
6. Comparator Output Types
Comparator ICs can have different output designs.
A. Push-Pull Output
A push-pull output actively drives the output both high and low.
Advantages:
- Can actively produce both output states.
- Often does not require an external pull-up resistor.
- Can provide relatively fast switching.
The output voltage range and load-driving ability still depend on the device specifications.
B. Open-Collector Output
An open-collector comparator output can pull the output low but cannot independently drive it high.
An external pull-up resistor connects the output to a suitable positive supply.
When the internal output transistor is OFF, the pull-up resistor raises the output voltage. When the transistor turns ON, it pulls the output low.
Open-collector outputs are useful for interfacing circuits with different voltage levels, provided the output ratings and electrical compatibility are respected.
7. Comparator With Hysteresis (Schmitt Trigger)
A comparator can sometimes switch rapidly between high and low states when the input voltage is close to the reference voltage, especially if the signal contains noise.
This behavior can cause unwanted switching.
Hysteresis solves this problem by using positive feedback to establish two different switching thresholds:
- Upper threshold: The input must rise above this voltage to switch the output in one direction.
- Lower threshold: The input must fall below this voltage to switch the output back.
For example, a circuit could switch ON when a sensor voltage rises above 3.2 V and switch OFF when it falls below 2.8 V.
Between 2.8 V and 3.2 V, the output retains its previous state.
This prevents rapid switching when the input fluctuates near the threshold.
8. Comparator vs. Operational Amplifier
A comparator and an operational amplifier (op-amp) may look similar internally, but they are generally designed for different purposes.
| Feature | Comparator | Operational Amplifier |
|---|---|---|
| Main purpose | Compare voltages and switch states | Amplify voltage differences |
| Typical operation | Switching | Linear amplification with feedback |
| Output behavior | High or low state | Variable output within its operating range |
| Switching speed | Designed for fast transitions | Depends on the amplifier |
| Output structure | Often open-collector or push-pull | Depends on the op-amp design |
| Feedback | Often used for hysteresis | Commonly uses negative feedback |
| Examples | LM393, LM311 | LM358, LM741 |
An op-amp can sometimes be used as a comparator in suitable applications, but a dedicated comparator is usually preferable for reliable switching because its design and specifications are intended for that purpose.
9. Comparator vs. Rectifier
Although their names sound similar, comparators and rectifiers perform different functions.
| Feature | Comparator | Rectifier |
|---|---|---|
| Main function | Compares two voltages | Converts AC into unidirectional current |
| Common components | Comparator IC or op-amp circuit | Diodes or controlled semiconductor devices |
| Output | Switching state based on input comparison | Pulsating or filtered DC |
| Example | Battery voltage detector | Bridge rectifier |
10. Applications of Comparators
Comparators are used in many electronic systems.
Comparator - Night Light - jpralves.net
Automatic Lighting
Detects whether ambient light is below a selected threshold and switches a light accordingly.
Adjustable Low-Battery Threshold Detector Extends Battery Runtime | Analog Devices
Battery Monitoring
Detects when a battery voltage crosses a low-voltage or high-voltage threshold.
Temperature Control
Compares a temperature-dependent sensor voltage with a reference to control a fan, alarm, or other suitable output.
Modulo Sensor Obstaculo Infravermelho LM393 com Trimpot
Obstacle Detection
Converts a changing sensor signal into a switching output for robotics and automation.
Other applications include zero-crossing detection, waveform generation, overvoltage protection, and analog-to-digital conversion circuits.
11. Important Comparator Parameters
| Parameter | Meaning |
|---|---|
| Input offset voltage | Small input difference that may cause a switching error |
| Propagation delay | Time between an input crossing the threshold and the output responding |
| Input common-mode range | Permitted range of input voltages |
| Output voltage levels | High and low output voltages under specified conditions |
| Input bias current | Small current flowing into or out of the input terminals |
| Hysteresis | Difference between upper and lower switching thresholds |
| Supply voltage range | Permitted operating power-supply range |
These specifications determine whether a comparator is suitable for a particular sensor, voltage level, and switching speed.
In summary: A comparator compares two input voltages and changes its output state depending on which voltage is higher. Its main applications include sensor detection, automatic switching, battery monitoring, and threshold detection. Hysteresis improves stability when the input voltage is noisy or fluctuates near the switching threshold.