Various integrated circuits can often be found in electronic devices. One of them is a comparator. Its applications range from signaling sensors to industrial and automotive electronics. Knowing how the comparator works, you can independently assemble various interesting circuits, for example, a charger, an indicator unit, or even a generator.
Content
-
Description and circuitry
- Instrument characteristics
- Device and principle of operation
-
Simple constructions
- Control photo relay
- Charging unit
- Crystal oscillator
Description and circuitry
Despite its apparent simplicity, the comparator is a much more interesting device than it might seem at first glance. In electronics, it is called a logic microcircuit designed to compare between two electrical signals applied to its input. Depending on the results of this measurement, the operating mode of the device changes.
The term "comparator" comes from the Latin word "comparare", which literally translates into Russian as how to compare. Structurally, the device can be produced in various packages, for example, DIP, SOIC, SSOP. The simplest type of comparison element has two analog inputs and one digital output. Its operation is based on a differential stage with a high gain. Therefore, comparators are widely used in equipment designed to measure or convert an analog signal to digital (ADC).
In the diagrams and in the technical literature, the device is graphically designated as an isosceles triangle with three leads. On the one hand, conclusions are signed with signs «+» and «—», respectively denoting the non-inverting input and the inverting one, and on the other - the output is depicted, which is marked with the symbol Uout.
When on direct input («+») of the microcircuit, the signal level will be greater than on the inverse («—»), then a stable value is formed at its output. Depending on the schematic solution of the comparator, this value can take the form of a logical zero or one. In digital electronics a signal is counted as a unit, the voltage level of which is five volts, and its absence is taken as zero. That is, the output state of the device is determined to be high or low. But in practice, the value of the potential difference up to 2.7 V is taken as a logical zero.
One of the input signals to the instrument is called the reference or threshold voltage. It is with this value that the magnitude of the signal at the second input is compared. The reference voltage can be applied to both inverse and direct inputs. Depending on this, the comparators are called inverting or non-inverting. When the device operates with one reference voltage, it is called one-threshold, and if with a different one, it is called multi-input.
Instrument characteristics
In essence, the device can be thought of as a simple voltmeter or ADC. A comparator, like any electronic device, has a number of technical characteristics that can be divided into two types: static and dynamic.
Static parameters include the following characteristics:
-
The limiting sensitivity denotes the signal threshold values that the device identifies at the input and changes the potential of its output to a logical zero or one.
- The amount of displacement is determined by the transfer moment of the device relative to the ideal position.
- Input current is its maximum value that can pass through any output without damaging the device.
- Output current - the value of the current that appears at the output when the device enters the state of unity.
- The difference in currents is the value found by subtracting the values of the currents flowing when the inputs are shorted.
- Hysteresis - the difference in input signal levels, leading to a change in the stable state at the output.
- The common-mode rejection ratio is determined by the ratio of the common-mode to the differential signal that causes the comparator to switch.
- Input impedance is the impedance of the input.
- Minimum and maximum operating temperature - the range in which the technical parameters of the device do not change.

An important dynamic characteristic is the switching time tn. It is determined by the time interval from the beginning of the comparison of the input signal to the moment at which the opposite stable state occurs at the output of the comparator. This time is determined with one value of the threshold voltage and its jump at the opposite input. This time interval is divided into two parts - delay and rise.
All relevant parameters of the comparator are presented as a transient response. This is a plot in a Cartesian planar coordinate system, in which the X-axis indicates the time in nanoseconds, and the Y-axis indicates the input and output voltage in volts.
Device and principle of operation
The circuitry of the device is based on a differential opamp with a fairly high gain. Its differences with a simple linear amplifier are in the implementation of the input and output stage.
The device input withstands a wide signal range up to power supply values and a full common-mode voltage range. The comparator output is compatible with TTL and ECL technologies due to the possibility of performing this stage on an open collector transistor. The device does not use negative feedback as in an operational amplifier, but, on the contrary, the output is covered by a positive connection, which forms a hysteresis transfer characteristic.
The two-threshold comparator is called the Schmitt trigger or ternary. For comparison, it uses two voltages. The signals in the binary comparator are divided into three ranges:
- Urf2> Urf1;
- Uout1 = 0 if Uin
Uref1; - Uout2 = 0 if Uin
Uref2.
Uref - voltage of the lower and upper switching thresholds, Uout - output signal level, Uin - voltage at the device input.
The internal circuit of the device is an amplifier assembled on transistors VT1-VT2, which is loaded with a VT5-VT6 cascade connected in a common emitter circuit. An additional key VT4 controls the collector mode of the input signal. And through the transistor VT7, operating in diode mode, the signal level at VT8 is controlled, which makes it possible to achieve its independence from changes in the supply voltage. The keys VT5 and VT6 are connected to the Zener diode VD1. Therefore, through the VT8 repeater, the input signal is fed to the output from the VT6 collector pin.
If the input signal does not exceed one volt, then the transistor VT6 is closed, and VT5 is in saturation mode. The output signal will not be able to exceed four volts, since a larger value will open the diode. With the opposite sign, VT6 will saturate, and the output voltage will become zero. Modern devices use a strobe output or latch flip-flops, that is, elements that control the output of the comparator when a sync pulse is detected. Comparison results can appear in two forms: during a strobe or in pauses between pulses.
Simple constructions
In practice, voltage comparators have found wide application in electronic circuits of various directions. In radio stores, you can find a fairly large number of different microcircuits. But the most commonly used microcircuits among radio amateurs are:
- LM311;
- K554CA3;
- LM339;
- MAX934.
They are available for sale, and their cost is more than democratic. These comparators have a wide input voltage range and can operate with unipolar and bipolar supplies.
Any load with a current consumption usually not exceeding 50 mA can be connected to the output of the device. It can be a relay, resistor, LED, optocoupler, or any actuator, but with current-limiting elements. It is also possible to connect an inductive load, but in this case it is usually shunted by diodes. For the operation of the device, power supplies with an output voltage of 5-36 volts are used.
Control photo relay
Such a relay is assembled by surface mounting. It can be used in a security system or to control the level of illumination. The work of the circuit is as follows. The input voltage goes to a divider consisting of R1 and a photodiode VD3. Their common point of connection through the limiting diodes VD1 and VD2 is connected to the inputs of the comparator DA1. As a result, there is no potential difference at the input of the device, which means that the sensitivity of the device is maximum.
In order for the signal at the output to be inverted, it will be necessary to create a difference at the input of only one millivolt. Due to the fact that capacitor C1 and resistor R1 are connected to the inverse input, the voltage value on it will increase with a short delay equal to the capacitor charging time.
But this time is enough for a logical unit to appear at the output, which will rebuild the operating mode of the relay connected as a load. As soon as the lighting changes again, the situation will repeat itself. Thus, by directing the photo relay to some place, in the event of a change in its illumination, a voltage difference will appear at the inputs of the comparator. Accordingly, the operation of the relay will also change, to which various loads can be connected.
Charging unit
A completed power supply unit from serviceable elements begins to work immediately. Its settings are reduced only to setting the nominal charge current and the thresholds of the comparator operation. When the device is turned on, the green LED lights upindicating the power supply. During charging, the red LED should be constantly on, which will go out as soon as the battery is charged.
The supplied voltage from the power supply is regulated by R2, and the charging current is set by R4. The setting is done using a 150 Ohm resistor connected in parallel with the contacts of the battery holder. The battery itself is not put into it. The VT1 transistor is installed on the radiator; instead, you can use an analogue of KT814B.
Such a circuit will have to be assembled on a printed circuit board, but in the end its size should not exceed 50 x 50 mm.
You can assemble a simpler circuit using the principle of operation of a current stabilizer. The reference voltage is supplied to the input of the LM358 through a zener diode. The second input of the microcircuit is connected after the current sensor. If a discharged battery is connected to the output of the comparator, then the current in the circuit will begin to increase, and part of the voltage will drop across the low-resistance resistor.
There will be a voltage difference between the two inputs of the microcircuit. The circuit will begin to compensate for this difference by increasing the output amperage. In the process of charging the battery, the voltage at the input will begin to decrease, which will lead to a decrease in the current in the circuit. As soon as the battery is charged, the VT1 transistor will close and the load will turn off. The charge current is limited by changing the resistance R1.
Crystal oscillator
Such a generator of rectangular pulses, assembled according to the scheme on the domestic comparator K544C3, operates at a clock frequency of 32768 Hz. The circuit will operate within an input voltage range of 7 to 11 volts. The frequency is set by quartz ZQ1, but for the device to work above 50 kHz, it will be necessary to reduce the resistance of R5 and R6.

When the second terminal is closed with a neutral wire, the comparator output turns on according to the open collector circuit, in which R7 is the load. Frequency adjustment is done with C1. Due to the resistor R4, the generator starts automatically. By changing the resistance R2, the duty cycle of the pulses changes.
By selecting containers C1 and C2, the generator can be used as a non-contact liquid sensor. For this, you will need to use a microcontroller with software as a detector. Although one more comparator can be used, which will register the changes rectified by voltage diodes.
Thus, the voltage comparator is designed to compare the signal levels at its inputs. If they start to differ, then, depending on this difference, the device output changes its state. Developers use this property when designing various electrical appliances.