# Why does the comparator oscillate during the conversion process?

The comparator is a simple concept-compare two voltages at the input. The output is high or low. Therefore, why is there oscillation during the conversion process?

The comparator is a simple concept-compare two voltages at the input. The output is high or low. Therefore, why is there oscillation during the conversion process?

This phenomenon often occurs when the conversion level changes slowly. Often due to the presence of noise in the input signal, slight fluctuations around the conversion level will cause oscillations at the output. Even if the input signal has no noise, the comparator itself will still have noise, such as the operational amplifier in it. When the output suddenly changes from one rail to another, noise is sometimes introduced, and it will be reflected to the input through the power supply or the output circuit.

Regardless of the cause, hysteresis is usually a solution-controlled positive feedback. It’s like turning off the switch suddenly. When you gradually push the rod, it will suddenly jump to a new position when passing through the center point. If there is no buffer, the switch will keep oscillating and its contact point will keep sparking.

Figure 1a shows a simple comparator with the comparison voltage VR set at 2V. In the process of conversion, the slowly rising and falling input signal tends to trigger the output multiple times.

In Figure 1b, R1 and R2 form a voltage divider at the output-the positive feedback switches the threshold voltage to form hysteresis. When a rising input voltage reaches the comparison voltage, the falling edge of Vo will move the threshold voltage to a lower voltage value, thereby avoiding noise causing oscillation.

The magnitude of the hysteresis is determined by the output voltage swing VOH of the comparator, which is related to the value of the resistor divider. The hysteresis width ?VT is set according to the magnitude of the input noise and the tendency of oscillation.

As shown in Figure 2, changing Vin and VR will form a non-inverting comparator with hysteresis. The threshold voltage will be slightly different. Make sure that the input signal is consistent. In some circuits, the feedback formed by the output level will introduce interference to the input signal source, resulting in ringing and more oscillations.

Some comparators have open-drain (or open-collector) outputs. Since the output capacitor will slow down the rate at which the output level rises, this type of comparator has limited hysteresis on the positive output edge. When you need the threshold voltage to change the most, it will only bring a small threshold voltage change. At the same time, it should be realized that depending on different component values, the hysteresis network will also act as an output load, reducing the swing of the output voltage.

In the rising period and falling period of the input signal, the hysteresis will form different threshold voltages, which will be a disadvantage in some applications. The capacitor in series with R2 will temporarily change the value of the threshold voltage, and there may be enough time for the input to pass through the noisy threshold range. If the input changes very slowly, such as battery voltage, this solution will not work. When the rate of change of the input signal is fast enough, you can try this method. Some comparators (such as TLV3201) have built-in hysteresis function, no external resistor is needed. This is achieved through internal circuit nodes, while keeping the input and output from being affected by the circuit. For most circuits, the hysteresis voltage band of these devices is effective. If needed, you can add external resistors.

Can an operational amplifier be used as a comparator? Sometimes it is possible.