The input voltage (VI), charges capacitor C1 until zener diode D1 conducts. Then, the zener diode triggers an “avalanche” circuit that discharges C1 into optocoupler Q1. After Cl discharges, the charging cycle repeats. C1 also averages the sensed-voltage level, which thereby provides noise immunity.