Site menu:

Currently listening to…

Body Talk
by Robyn

Currently reading…

To the Lighthouse
by Virginia Woolf

Welcome…

Links:

Categories

Recent Comments

Archives

Meta

Zero-cross Detector

My Christmas Light Show Project requires electronic dimming of lights. This is accomplished by phase-control of solid state relays. Thus, it is important to synchronize the microcontroller to the power mains (i.e. the controller should be able to operate in-phase with the AC line in the house).

To do this, I built a zero-cross detector, which is a circuit that generates a pulse every time the hot AC line goes to zero (i.e. it generates a pulse at the start of each AC cycle). Here is the schematic:

Circuit SchematicThe L and N pins on the left go to a wall socket, and the three pins on the right go to the microcontroller.

When the controller supplies 5V via the VCC pin, the zero-cross pulses are generated on the INT pin. This pin connects to an external interrupt on the controller.

Here’s what it looks like in action. The first plot shows the AC line, and the second plot shows the corresponding zero-cross pulses.

Circuit Simulation ResultsHere’s how it works… When the AC line is NOT at zero, current flows through the optocoupler diodes, causing the transistor to turn on and pull the INT pin to GND. When the AC line goes to zero, current ceases to flow through the optocoupler diodes, causing the transistor to stop conducting. At that point, no current is pulled through R2, so the INT pin is set to VCC.

The circuit works really well… now I just need to finish up the schematics and board layout so I can get a printed circuit board manufactured.

Write a comment