Thanks for your help in advance!

  • I'm doing a zero cross detector for a microcontroller, PIC16F15223. I will be reading this as a digital input, and not as analog. The circuit is posted below. I know the supply circuit works, and the zero cross detector too, but do you think that will work if I put two bridge rectifiers like that?
  • Of course the PIC part is not in the schematic I uploaded, but that's not my doubt.
  • Also do you know any way to improve my circuit? Improve talking about the base circuit I posted, not a new one. Thanks!

enter image description here

EDIT: The optocoupler its wrong in the schematic, i use PC817, that its a transistor output optocoupler

  • \$\begingroup\$ @user263983 Yeap, i checked but the pic16f15223 doesn't :( \$\endgroup\$ Jun 6, 2023 at 2:01
  • \$\begingroup\$ Your schematic shows optotriac. That device will not work with DC. \$\endgroup\$
    – user263983
    Jun 6, 2023 at 2:03
  • \$\begingroup\$ @user263983 Yes! Sorry for that! the opto its a PC817, it has a transistor output! My mistake \$\endgroup\$ Jun 6, 2023 at 2:04
  • \$\begingroup\$ Second diode bridge will be essential if input connected to primary voltage, not low voltage. \$\endgroup\$
    – user263983
    Jun 6, 2023 at 2:07
  • \$\begingroup\$ This is essentially a duplicate of electronics.stackexchange.com/questions/667415/… which I think I answered sufficiently. You have made some unnecessary changes in your design, and you don't say why you need additional help. I'm downvoting accordingly. \$\endgroup\$
    – PStechPaul
    Jun 6, 2023 at 2:09

1 Answer 1


If a signal is required for both positive and negative zero crossings are needed, here is a simulation of one way to do it. There will be some timing differential between zero crossing and the output pulses. This can also be accomplished with an AC input (dual LED) opto-isolator.

Full wave zero detector

Changing C2 to 1 uF shifts the negative-going transitions to align with actual zero crossing within 100 us, which is about 1.8 degrees.

Improved phase shift

Here is a simulation of the OP's design. Note that I greatly reduced the value of R1 and I used Schottky rectifiers to provide higher current into the optocoupler, and I used 4.7 uF to get closer alignment of the signal to the zero crossings.

Full wave Schottky bridge

  • \$\begingroup\$ Its a nice way to do it also... What will be the difference with the circuit i posted? Because where i live, pc817 doubles in price a integrated smd bridge rectifier, i search also for double integrated opto and nothing... \$\endgroup\$ Jun 6, 2023 at 3:16
  • \$\begingroup\$ Search for AC input optocouplers. IL755 is one. But also vishay.com/docs/83466/vos628a.pdf in stock at Digikey for less than $1. But APC817 are about 2/$1. Your circuit might work. Try simulating it. \$\endgroup\$
    – PStechPaul
    Jun 6, 2023 at 3:50

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.