The zero crossing detector circuit is an important application of the op-amp comparator circuit. It can also be called as the sine to square wave converter. Anyone of the inverting or non-inverting comparators can be used as a zero-crossing detector. The reference voltage with which the input voltage is to be compared, must be made zero (Vref = 0V). An input sine wave is given as Vin. These are shown in the circuit diagram and input and output waveforms of an inverting comparator with a 0V reference voltage.
As shown in the waveform, for a reference voltage 0V, when the input sine wave passes through zero and goes in positive direction, the output voltage Vout is driven into negative saturation. Similarly, when the input voltage passes through zero and goes in the negative direction, the output voltage is driven to positive saturation. The diodes D1 and D2 are also called clamp diodes. They are used to protect the op-amp from damage due to increase in input voltage. They clamp the differential input voltages to either +0.7V or -0.7V.
In certain applications, the input voltage may be a low frequency waveform. This means that the waveform only changes slowly. This causes a delay in time for the input voltage to cross the zero-level. This causes further delay for the output voltage to switch between the upper and lower saturation levels. At the same time, the input noises in the op-amp may cause the output voltage to switch between the saturation levels. Thus zero crossing are detected for noise voltages in addition to the input voltage. These difficulties can be removed by using a regenerative feedback circuit with a positive feedback that causes the output voltage to change faster thereby eliminating the possibility of any false zero crossing due to noise voltages at the op-amp input.