I am working on a circuit that requires zero crossing detection. I detected the zero crossings of the 230 Volt AC sine with the help of a full bridge rectifier and a 4N25 optocoupler with a pull up resistor as shown in the figure. zero crossing detection circuit.

I got this to work and with software I could determine the middle point of the pulse and accurately determine the zero crossing. However, the power loss over the Resistor R7 is a bit high. I used a 2 Watt resistor for this. I do have a transformer already used in my circuit. I use it in order to get an isolated 5 Volt DC to power my Arduino.

Which is this one: https://nl.rs-online.com/web/p/products/7320528/.

I could use the transformer output for the zero crossing instead of the 230 Volt. By doing that I could use a lower resistor value and therefore have a much lower power dissipation. The question that I have is about using the transformer. Are the zero crossings of the secondary output of the transformer at the exact same time as the primary (230 V) side? Or can their be a phase shift between the primary and secondary side?

thank you!


The circuit would look something like this. The Isolated 5V goes to power my Arduino which will controls some opto-coupled outputs (low power).

transformer coupled circuit

  • 1
    \$\begingroup\$ The transformer phase shift is minimal. But, you should draw the circuit, there are other potential issues if this transformer is shared with a circuit that generates a DC voltage. \$\endgroup\$
    – Mattman944
    Commented Dec 6, 2020 at 19:33
  • 1
    \$\begingroup\$ It's your circuit, but normally the transformer is pretty much unloaded when the rectifiers aren't conducting, so there will be approximately no phase shift. \$\endgroup\$
    – user16324
    Commented Dec 6, 2020 at 19:40
  • 2
    \$\begingroup\$ Using more sensible opto you could use small 220k resitor for mains. Also using an opto on secondary is not needed, you could use a transistor instead. \$\endgroup\$ Commented Dec 6, 2020 at 20:00
  • \$\begingroup\$ See this post: electronics.stackexchange.com/a/459412/82111 \$\endgroup\$ Commented Dec 6, 2020 at 20:11

1 Answer 1


With a lightly-loaded transformer the phase shift will be very small, and repeatable enough to be tuned out in software.

Here's a suggestion. If you add one more diode between the + output of the bridge and C11, you can eliminate the 2nd bridge and the optocoupler. The bridge + output will have the full-wave rectified AC waveform. This can drive an NPN transistor (emitter to Iso_GND) through a base resistor (re-purposed R40), and you get the same output as with the opto, but with less cost and better reliability. Size the base resistor for a peak base current of 1 mA -ish.

  • 1
    \$\begingroup\$ +1 for the diode between the bridge and C11. I used this method on one of my first projects, before I graduated. \$\endgroup\$
    – Mattman944
    Commented Dec 6, 2020 at 22:54
  • \$\begingroup\$ Using something like SFH620a will elliminate need for bridge rectifier and additional secondary winding. Just connect it before bridge with proper resistor. It holds 60 mA max. \$\endgroup\$
    – user263983
    Commented Dec 6, 2020 at 23:07
  • \$\begingroup\$ Ah I see, it is already isolated so no opto-coupler needed of course. I think I will use this method I think I will manage to get this working. Thank you! \$\endgroup\$ Commented Dec 6, 2020 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.