Electrical – Understanding this comparator circuit for AC voltage protection


The circuit shown below is taken from this whole design. I understand the main idea. They want to measure some voltage condition and trigger something else with the comparator. R39 and C38 form a low pass filter. R37 is the pull-up resistor as the comparator's output is open collector. D19 and D20 are protection diodes as the input goes positive and negative. What I don't understand is the arrangement of the resistors R36, R38, R35, and R40. Why are R36 and R38 referenced to ground in the midpoint? How is the comparison process achieved? According to the reference design, the input AC voltage is 230 VAC 50/60 Hz.

enter image description here

Best Answer

The design appears to assume that L and N can be swapped. This is a common problem in countries with reversible mains plugs. The circuit, therefore, needs to accommodate live on either pin.

Let's ignore D19, 20 and C37 for a now.

With the junction of R36 and R38 earthed one of the comparator inputs will be grounded. Remember that the neutral is so called because one of the supply wires has been earthed or 'neutralised' at the supply transformer so its voltage will be close to zero. As drawn, 'AC_N' will be at zero volts and since the top of R38 is at zero volts the junction between them will be at zero volts. The comparator '+' input will now also be at zero volts. Any time AC_L goes negative the comparator output will switch high. The result is a squarewave which goes high when AC_L is negative and low when positive.

Reversing the input polarity inverts the result.

D19 does two things when AC_L goes positive:

  • It limits the voltage on IN- to one diode drop above that on IN+.
  • It causes the voltage on IN+ to rise above zero somewhat. This is probably a good thing as it gets the inputs away from operating at 0 V (although the chosen device will work down to zero on the inputs.)


simulate this circuit – Schematic created using CircuitLab

Figure 1. Equivalent circuit while AC_L is positive.

You can work out what happens on the negative half cycle or when the live and neutral are reversed.