Typically, ac line sensors use comparators. But I had to design a power supply to be as low in cost as possible, be self-powered, use through-hole components, and take up as little space as possible on a small two-sided pc board. So I developed the simplest ac sensor possible. The resulting circuit senses the high-voltage dc bus (see the figure). During normal operation, the AC_OK signal is low. At about 90 V ac, the signal goes high.
R1 and D1 create a 5.1-V bias that allows the design to be self-powered. To keep dissipation on R1 to a minimum, the rest of the resistors were chosen to minimize current. U2, an LM431BCZ, is employed as a reference and comparator. Q1 and R7 create the hysteresis to prevent chatter around the trip point. Because the LM431 still sinks current when off, using Q1's base current to drive U1 guarantees that no current flows through U1. C1 filters noise that would affect U1. R4 and R6 sense the power supply's dc bus. Two resistors are employed to dissipate 1/4 W.
The current through R8 at the trip point is:
2.5 V/R8 = 531 µA
Since Q1 is on as the trip point is approached,
(5.1 V - 2.5 V) × R7 = 56 µA
Therefore, R4 and R6 must supply:
531 µA 56 µA = 475 µA
Using the values of R4 and R6,
(560 kΩ) × 475 µA = 266 V
Because the power supply uses a voltage doubler, the trip point is 94 V ac. That is:
(2 × √2) × 94 = 266).
Since Q1's base current is only about 900 A and U1's current transfer ratio is 100% minimum, the optocoupler's output should not exceed 900 A. Because the current transfer ratio of the optocoupler can deteriorate with time, this should be derated.
Note that the ripple on the dc bus is affected by load and capacitance. As a result, the final selection of resistor values is based on testing. Also, not all manufacturers' parts will work for U2 in this application, due to the fact that bias current drops below the device's recommended minimum. This design used National Semiconductor's LM431.
The power supply housing this circuit has been produced for the past five years and continues to be used in new products. To date, the power supply hasn't had any problems in manufacturing.