Electronic – Zero crossing detector inconsistency

opto-isolatorzero crossing

I designed the following zero crossing detector using an FOD819S optocoupler (U5):

zero crossing schematic

The source of the optocoupler is connected to a MB6F full-bridge rectifier (D2) which is supplied by a 9V transformer connected to 220V AC/50Hz. The 3.3V regulator (U8) supplies power to an ESP32 microcontroller and a segment display (not shown in schematic).

I probed the circuit in T1 (in blue, relative to GND) and it works as expected most of the time. For reference, I connected another probe to T2 (in yellow) before the full-bridge rectifier.

zero crossing wave

However, when cutting and re-applying AC to the transformer, it sometimes shows some odd behavior:

zero crossing wave

Or it simply stays at 0V:

zero crossing wave

Another issue is that the detected frequency is ~10% above 100Hz (not stable) which is also what I detect from a microcontroller using an interrupt on falling edge. It might be a consequence of the slow rise time.

What is wrong with this circuit? Should I add a constant load before the regulator?


Here is the signal when using the first circuit from Dave Tweed (with a pull-down resistor):

zero crossing wave

Best Answer

If you want to monitor the output of the bridge rectifier, put your optoisolator in parallel with the power supply, not in series with it. Note that this requires an extra blocking diode (D6) in order to prevent the power supply input capacitor from driving the optoisolator LED.


simulate this circuit – Schematic created using CircuitLab

Better still, put the optoisolator upstream of the bridge rectifier. Then every rising and falling edge at its output represents a zero crossing of the AC voltage.


simulate this circuit