Types of a comparator:
The comparators are mainly divided into two categories inverting and non-inverting. That is decided by the terminal on which the voltage is applied. If it's applied on the inverting terminal we will confirm the non-inverting end of our reference voltage and the comparator will act as an inverting comparator. On the other hand, if the voltage is applied to its non-inverting voltage making the inverting terminal a reference voltage terminal the comparator will act as the non-inverting comparator. Diagrams for both types of comparators are given below.

Figure 1 Non-inverting comparator
Figure 2 Inverting comparator
How do we achieve a comparator?
By using an op amp without negative feedback we can make a comparator. Due to the high voltage gain, a very small difference in input voltage is resolved. The comparator can be improved to a great extent by adding features like internal references and hysteresis to it. In our article, we will discuss in detail about comparator as hysteresis.
Hysteresis:
A phenomenon in which the values of physical properties are lagging behind the changes causing it is known as hysteresis. A general example of it is when a magnetic induction is lagging behind the magnetizing force. Here magnetic induction (a physical property of an inductor) is lagging behind the change in effect (magnetic force) that causing the induction. This phenomenon can also be defined as a concept in physical science. The output signal of a system not only depends upon input signals but the history of past inputs of an output signal also plays a vital role in it. Since history affects the value of an internal state this concept is quite logical. The phenomenon of hysteresis occurs in ferroelectric and ferromagnetic materials, for example, when ferromagnetic materials become permanently magnetized they will remain magnetized even after removing the magnetic field. This clearly shows we cannot revert the magnetized ferromagnetic material to zero unless we apply external factors like a field in the opposite direction or heat. Applying an alternating magnetic field under these conditions will generate a loop known as a hysteresis loop (magnetic hysteresis). Hysteresis is considered an ideal stabilizing mechanism because of its predictability.

Figure 3 diagram illustrating hysteresis
I. A comparator not equipped with hysteresis:
As we discussed earlier the sole purpose of a comparator is to compare two different input signal levels of a system. A simple example of this is distinguishing between a high temperature and a low temperature by a system equipped with a comparator. Multiple transitions could occur due to signal or noise variations at the comparison thresholds. Here hysteresis serves the purpose of setting lower and higher limits to eradicate the multiple transitions generated by the noise. A comparator not equipped with a hysteresis will use a voltage divider to set the voltage threshold. When the comparator compares the threshold voltage (Vth) with the input signal (Vin). Then at the inverting input end, we apply the comparator’s input signal so that the output will have an inverted polarity. The output will drive to a low logic or a negative supply in the case of Vin > Vth. On the other hand, it will drive to a high logic or positive supply when Vin < Vth. We can use this simple methodology to determine if the actual signal (e.g. temperature) is above a predetermined value. However, this method has adverse side effects in the fields of science, physics, and electronics like most other things. The most common issue faced is the input affected by the noise, A minor quantity of noise at the input end can trigger the output. That causes an unpredictable output.
II. A comparator with the hysteresis:
As mentioned above the comparator without hysteresis can be very unstable, even a small noise can cause an erratic output. The input signal transitions below and above multiple times when it reaches the approaches the threshold (Vth). This causes the transitions below and above in the output numerous times as well. The functionality issues caused by these erratic transitions are easily understandable. For example, consider an input signal for critical temperature readings and a vital monitor for its output. And interpret this by a microcontroller, as we know that if consistent or accurate messages are not provided to the microcontroller by erratic output the system will suffer a critical failure. However, with a minor change to our comparator circuit, we can equip it with a hysteresis. The two different threshold voltages will be used by the hysteresis to prevent the multiple transitions introduced in the circuit. The input signal must surpass the upper threshold (VH) to transition low or below the lower threshold (VL) to transition high. Typically, we do not consider noise a factor when we are using a comparator with hysteresis until it exceeds the range of hysteresis. In this case, the comparator with hysteresis generates some kind of additional transitions. Therefore we set the range of it wide enough so it can cancel the noise up to a larger range. In temperature sensors, various alarm systems, and motor controls we widely use a comparator with hysteresis and It provides a critical functionality. Without a comparator with hysteresis, we cannot achieve stable functionality. So hysteresis in a comparator assures the importance of functionality, which provides us with a positive feedback methodology.
What's the role of hysteresis in a comparator?
Capacitive strays from output to input (in case of non-inverting input) even without actual feedback circuitry may cause the comparator circuit to become unstable. As well as coupling of output currents in grounds (the point where non-inverting input is normally connected) could also cause instability. Paying careful attention to grounding and layouts, and guarding high impedance nodes can help us to minimize the coupling effects. Latching is another method that could be helpful in this regard. However, all these methods are not accurate to some extent and still instability occurs after their measures. So the most effective solution to all these problems is introducing a hysteresis as positive feedback into our system. This hysteresis can separate down-going and up-going switching points in such a way that before the reverse transition can occur the input must undergo a significant reversal once a transition has started. Varying signals with a small amount of noise when processing slowly, multiple output transitions are produced through the comparator. Noisy signals are a must to occur in all kinds of applications mostly at the industrial level. The noise is amplified by the open loop gain as the signal crosses the threshold region, which causes the bouncing of output back and forth. This situation is not considered ideal in most of the applications and can be cured by introducing hysteresis in the comparator. The diagram below illustrates the noise causing multiple transitions in a signal

Figure 4 Multiple Transitions caused by the noise
How to design a comparator with hysteresis?
By feeding the positive input a small fraction of the output voltage (that could be a lower or an upper limit of voltage) we can apply the hysteresis to our comparator. A polarity-sensitive offset is added by the voltage to the input that increases its threshold range. We decide whether we are going to use our chosen comparator as an inverting or inverting configuration. Some types of comparators provide both positive and negative outputs, allowing us a variety of their installation in a system. We can introduce the hysteresis by connecting the tap of two resistor voltage dividers with the positive input between the reference source and the positive outputs. The resistance ratio determines the value of the output voltage feedback. This circuit design frees a direct connection of the input signal to the inverting input as illustrated in the figure below.
I. A comparator with dual supplies using an inverting input
As illustrated in the figure below the hysteresis with dual supplies is designed, As shown in the figure the signal is applied to the inverting input of the comparator. The output-to-input plot is also given in the figure which shows the vicinity of the switching point. R1 is mostly much lower than the R2. In case when R2 is infinite, we will not get any hysteresis, and switching of devices will be done at the Vref. The hysteresis is calculated by the resistance ratio (R1/R1+R2) and the output levels. By the attenuation ratio the R2/(R1+R2).

Figure 5 A comparator with dual supplies using an inverting input
II.A comparator with dual supplies using a non-inverting input
On the other hand, the figure below illustrates the signal applied to the non-inverting input of the comparator circuit. As the input signal is slightly attenuated, the hysteresis added to the comparator will be slightly larger as compared to the inverting case.

Figure 6 A comparator with dual supplies using a non-inverting input
Applications:
I. Analog to digital conversions
The comparator with hysteresis is considered effectively a one-bit analog to digital converters. The signal switches from low to high state when the signal reaches a given level.
II. Detection of Level:
Level Detection is also possible through the level detection. The hysteresis voltage should be taken into them when undertaking this application so that the circuit switches on a required voltage.
III. Line reception;
A data line during its running condition could pick up some noise into a logic gate, to ensure that a logic output level is only changed as the data changed is very necessary. And also it’s because of the spurious noise that was picked up.
IV. Noise Immunity:
Increasing the noise immunity of a circuit is another important application of comparators with hysteresis using only a single input threshold. The switching of output rapidly back and forth from noise alone is caused by with only one input threshold and a noisy input signal. A noisy comparator with a hysteresis input signal can cause only one switch in output value near one threshold. After that, it will move to the next threshold to do another switch.
We can understand it with the example of an amplified infrared photodiode. It can generate an electric signal, between its absolute lowest value and its highest value this signal switches frequently. From a smooth signal, this signal is low pass-filtered and rises and falls corresponding to the related amount of time for which the signal is off and on. Through the input of the comparator with hysteresis the filtered output passes. The output of the comparator with hysteresis only passes from low to high as a net effect, then it receives an infrared signal that excites the photodiode. This excitation exists longer than some known period. As soon as the hysteresis circuit is high, it only passes for a longer period than a similar known period after the photodiodes are excited by infrared rays. The photodiodes are likely to have spurious switching, that is caused by noise from the surrounding. The delay caused by the comparator with hysteresis makes sure that output only switches when a device is stimulated by the input
V. Comparator with hysteresis as an oscillator:
A bistable multivibrator is another useful application of the Comparator with hysteresis and it can be used to implement as a relaxation oscillator which is another type of multivibrator. By connecting a single RC integrated circuit between the output and input of an inverting comparator with hysteresis we can achieve it. A continuous square wave as output will be generated whose frequency will depend on R and C values also the threshold points of the comparator with hysteresis. A circuit diagram of a comparator with hysteresis used as an oscillator is illustrated below.

Figure 7 Comparator with hysteresis as an oscillator
ALSO SEE:All Online Conversion Calculators by Richard





















