Improved comparators for better designs

Article By : Michael A. Shustov

Analog and digital comparators allow you to compare input signals by their level.

Traditional digital comparator ICs are electronic analogs of mechanical lever scales. Like their mechanical counterparts, they compare two logical signals and produce an output (typically a voltage level) indicating the relationship of the inputs, i.e., A > B, A < B, and in some cases, A = B.

As useful as they are, these simple comparators have a few problems including:

  1. In order to obtain a visual indication of the comparison, the comparator’s output must be connected to a transistor which drives an LED.
  2. If the comparator is used to monitor the presence of two supply voltages, an error condition occurs if both input voltage sources are switched off. In this instance the digital comparator will indicate a misleading “normal” status, i.e., A = B, even though both supplies are inoperative.

The comparator presented in this DI solves these problems and adds some other useful functionality. It is based on discrete elements, which allows you to achieve the maximum result with a minimum of electronic components. In addition, this solution provides visual indications (with LEDs) of the previously available comparison states (A > B; A < B and A = B), it also indicates the state of the inputs when A = B = 0 and A = B = 1.

Before we get into the details, let’s review some of the differences between analog and digital comparators.

Analog comparators usually have a configurable switching threshold. If the input signal exceeds this threshold, the comparator output signal switches the output level from logical one to logical zero or vice-versa.

Digital comparators allow you to compare the ratio of logical signal levels at inputs A and B. These devices can indicate: A = B; A > B; A < B.

Figures 2-4 show schematics of simple universal-purpose comparators that use multiple LEDs (LED1 to LED3) to indicate the relationships between the levels of inputs A and B as follows:

The equivalent scheme of states can be seen in Figure 1.

Figure 1 Basic improved comparator equivalent schemes.

Circuit 1: Comparator Realized using BJTs

The comparator shown in Figure 2 is formed by bipolar transistors VT1, VT2, and the three status indicator LEDs mentioned earlier.

 Figure 2 Comparator with bipolar transistors.

The circuit functions as follows:

If there are no logic level signals at inputs A and B, the transistors are closed (off), causing the current through LED3 to flow through resistors R1, R3 and R2, R4. This led indicates the state A = B = 0.

If a unit level logical “1” signal is applied to input A and a logical zero is applied to input B, the VT1 transistor opens (turns ON), causing LED1 to light, indicating that A > B.

If a unit level logical “1” signal is applied to input B and a logical zero is applied to input A, the VT2 transistor opens and the LED2 illuminates, indicating the condition A < B.

If a unit level logical “1” signal is applied to both inputs A and B, both transistors VT1 and VT2 will be open, so that neither of the LEDs will light, indicating the condition A = B = 1.

The comparator, shown on Figure 2, has a switching threshold of about 3 V. This circuit has an interesting feature insofar as the switching of LEDs is not instantaneous, but as a gradual change in their brightness. This characteristic makes this type of comparator convenient to use for monitoring the level of stereo audio signals. It can also be connected to the outputs of a stereo amplifier and used to drive multi-colored LEDs that add a visual effect to musical compositions.

Circuit 2: Improved Comparator Realized using FETs

The digital comparator on field-effect transistors shown in Figure 3 also has a switching threshold of 3 V, which allows it to be used in TTL or CMOS digital devices operating at logic levels from 3 to 15 V, and possibly higher.

If necessary, the comparators’ switching thresholds, in both Figures 2 and 3, can be adjusted by changing the values of the input resistive dividers (i.e., R5 & R6, R7 & R8).

 Figure 3 Comparator with bipolar transistors.

Circuit 3: Improved Comparator with Adjustable Threshold

The digital comparator shown in Figure 4 is based on an A1 LM393 comparator chip and has an adjustable threshold that can be smoothly varied between from 0 to 20 V using potentiometer R3.

Figure 4 Digital comparison based on the A1 LM393 comparator chip.

Conclusions and Applications

The digital comparators shown in Figures 2-4 can fully solve the problem of monitoring two supply voltages because they provide a positive indication of which of the voltages are missing. The power supply voltage of all these comparators is not critical and can almost always use the application’s existing power supply; provided it is 5V or higher.

These improved comparator circuits eliminate the “blind spot” in conventional designs which cannot distinguish between both inputs being at “1” or “0”. All three designs described in this DI also feature built-in LED drive capability.

This type of circuit can also be adapted for some other interesting applications beyond monitoring power supplies including:

  • A two-channel logic tester that allows you to visually monitor the presence and level of logic levels at two points of the digital device being monitored or repaired.
  • A circuit for electrically isolated data transmission when using optronic pairs as LEDs, including those with an open optical channel.
  • A safety interlock which will not allow a mechanism to be activated until two (or more) sensors indicate that it is properly configured.
  • The variable threshold comparator (Circuit 3) can be modified for use as a simple analog alarm for temperature, voltage, or other variables.


This article was originally published on EDN.


Expo booth:

New products & solutions, whitepaper downloads, reference designs, videos

Conference sessions:
  • Internet of Things (IoT)
  • Supply Chain
  • Automotive Electronics
  • Wave of Wireless
3 Rounds Lucky Draw:

Register, join the conference, and visit the booths for a chance to win great prizes.

Leave a comment