Electronic

### Why does the comparator oscillate during conversion?

A comparator is a simple concept – comparing two voltages at the input. The output is high or low. So why is there oscillation during the transition?

A comparator is a simple concept – comparing two voltages at the input. The output is high or low. So why is there oscillation during the transition?

This phenomenon often occurs when the transition level changes slowly. Often due to the presence of noise in the input signal, slight fluctuations around the transition level can cause oscillations at the output. Even if the input signal has no noise, the comparator itself will have noise, such as the op amp in it. Noise is also sometimes introduced when the output transitions abruptly from one rail to another, and can be reflected back to the input through the power supply or output circuitry.

Whatever the cause, hysteresis is usually a solution – controlled positive feedback. It’s like snapping off a switch. As you push the rod gradually, it jumps to a new position as it passes the center point. Without cushioning, the switch would constantly oscillate and its contacts would constantly spark.

Figure 1a shows a simple comparator with the comparison voltage VR set at 2V. During the conversion process, 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 – positive feedback switches the threshold voltage to create hysteresis. When a rising input voltage reaches the comparison voltage, the falling edge of Vo will move the threshold voltage to a lower value, preventing noise from causing ringing.

The magnitude of the hysteresis is determined by the comparator’s output voltage swing, VOH, 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 to oscillate.

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

Some comparators have open-drain (or open-collector) outputs. These comparators have limited hysteresis on positive output edges because the output capacitor slows the rate at which the output level rises. It will only bring a small threshold voltage change when you need it most. Also realize that, depending on the component values, the hysteresis network also acts as an output load, reducing the output voltage swing.

The hysteresis will create different threshold voltages during the rising and falling periods of the input signal, which can be a disadvantage in some applications. A capacitor in series with R2 will temporarily change the value of the threshold voltage, perhaps long enough for the input to pass through the noisy threshold range. This approach will not work if you encounter extremely slow input changes, such as battery voltage. You can try this method when the rate of change of the input signal is fast enough. Some comparators (such as the TLV3201) have built-in hysteresis, eliminating the need for external resistors. This is achieved through internal circuit nodes, while keeping the input and output unaffected by the circuit. The hysteresis voltage band of these devices is valid for most circuits. You can add external resistors if needed.

Can an op amp be used as a comparator? Sometimes it’s ok.