In automatic control systems it is often important to have valid information on whether a remote device has a proper power supply voltage or whether an actuator is currently powered on etc. As operation of some devices and actuators depends on AC while that of some others on DC voltage, we constructed two circuit variants, one suitable to AC, the other one to DC input voltage monitoring.
AC input circuit
! ! ! W A R N I N G ! ! !
INPUT VOLTAGE OF THIS CIRCUIT IS LETHAL
The first variant of the circuit is optimised for AC input voltages, from 100 to up to 470Vrms. This means that the circuit is able to withstand voltage amplitudes up to 470 * 1.4142 = 666 V. If the systems designer knows in advance that the circuit will have to detect only rather high voltages (e.g. higher than 180Vrms), then the two resistors can be of even higher resistances, which will make them produce significantly less thermal dissipation. Optimal resistances of these two resistors can easily be calculated if one observes that R4 limits optocoupler LED current to approximately 0.6mA:
R1opt = R2opt = 1/2 * ((Vrms - Vzener) / 0.6mA)
Note that we used RMS voltage in the previous formula instead of peak amplitude value as in practice this proved to be the easiest way of taking into account several factors: the expected statistical spread of rated resistances (usually 5%), the minimum conduction angle needed to recharge C1 in each AC half-period (around 25°), possible variations in input voltage (10%) etc. After all, high AC voltages are usually specified by their RMS rather than peak-to-peak value, so this simple implicit approach seems to be doubly justified.
The expected power dissipation on R1 and R2 can be calculated as:
P1min = P2min = 1/2 * (Vrms - Vzener)2 / (R1 + R2)
It is advisable to pick resistors with at least 2x higher rated maximum dissipation than the calculated value, as it translates to much lower spot temperatures on the device PCB and to correspondingly much better long term reliability of the whole unit. Carbon film components are preferred in this application as they tend to behave better than metal-film ones with respect to occasional overvoltages which generate peak temperature stresses.
Although overall input circuit dissipation could be reduced by replacing one (or even both) input resistor by a high voltage capacitor, we do not recommend doing that as such input current limiting would act as a short circuit to transient overvoltages, exposing D1 and optocoupler input LED to unnecessarily high voltage and current spikes. Since overvoltages even higher than 10kV are not uncommon in AC grid, that would effect the reliability of the circuit in a significantly detrimental way.