Electronic – 120VAC 60Hz Zero Cross Detector

acopto-isolatorpowerzero crossing

I'm designing a digital phase-controlled light dimmer, and I need a zero-crossing detector circuit. From what I've read, it's a bad idea to wire the AC main directly to the microcontroller through a resistor, and folks have suggested using optoisolation instead. However, I don't know how the circuit actually falls together.

It would seem elegant to me if the zero cross circiut's output is a 5V logic pulse for use as a rising-edge interrupt. But I'm not married to that idea if some other output is easier to use.

Input: 120V AC @ 60 Hz
Output: 5V pulse at zero crossing

Interesting related post, with not enough detail for me: detecting zero cross in ac?

Best Answer

Why not use an optocoupler? Vishay's SFH6206 has two LEDs in anti-parallel, so it works over the full cycle of the mains voltage. If the input voltage is high enough the output transistor is switched on, and the collector is at a low level. Around the zero crossing, however, the input voltage is too low to activate the output transistor and its collector will be pulled high. So you get a positive pulse at every zero crossing.

enter image description here

The most important parameter for an optocoupler must be its CTR or Current Transfer Ratio, which gives you the ratio between output current and input current. You can compare it with the \$H_{FE}\$ of a common BJT. But while \$H_{FE}\$ for a small signal transistor is often higher than 100, CTR is low. So low that it's expressed in %, like 20%. That's not 20, that's 0.2.
A CTR of 0.2 means that you have to drive the input LED(s) with 1mA to get a mere 200\$\mu\$A out. Usually that's not a problem, since the output is often only used to get a logic level, which will connect to a high impedance input. In that case a high value pull-up resistor can be used, like > 27k\$\Omega\$ in a 5V system. Then the 200\$\mu\$A is sufficient to drive the output low.

Detailed calculations can be found here.