Title

Subtitle

DIY - Isolated High Quality Mains Voltage Zero Crossing Detector

DIY - Isolate High Quality Mains Voltage Zero Crossing Detector
 
FEATURES
  • highly accurate mains zero crossing detection
  • fully isolated and low voltage safe output
  • ultra-low power consumption; worst case power dissipation < 120mW
  • produces symmetrical pulses around zero crossings
  • output pulse stays constant, independent of the mains voltage
  • very low parts count, no precision components required
  • all components can be low voltage SMD
  • works over all voltage ranges (100VAC/240VAC), without modification
  • 50Hz/60Hz compatible
  • 50Hz produces a 1ms ZC pulse, 60Hz produces 0.83ms ZC pulse
  • highly stable with varying temperature and aging
AVAILABLE DOWNLOADS
Schematic
RESTRICTIONS
None (free use)

Background

Modern electronic equipment are nowadays typically powered by switch­-mode power supplies. Due to their high frequency operation, these PSU’s have no means of providing mains frequency (and/or phase infor­mation) for the low voltage electronics circuitry on the se safe low voltage seconda­ry side. Devices such as lighting con­trollers, thermostats, motor drives and similar AC-load controlling or monitorin applications, often needs mains phase and/or frequency information. Adding an old type iron core mains transformer for this purpose would be both expensive and clumsy. A suitable zero crossing circuit is often needed. 

This DIY project presents one very clever variety of such a zero crossing detector, invented by the autho odern electronic equipment are nowadays typically powered by switch­-mode power supplies.

OTHER KNOWN ZC-DETECTORS
The Design Idea “Isolated circuit monitors ac-line” published in EDN the 5th of July 2007, is primarily intended for mains line ac-voltage measurement, and is not optimal for efficient zero-crossing detection. The Design Idea “Improved opto­coupler circuits reduce current draw, resist LED aging”, published 14th of December 2007, also suffers from unnecessary complexity and cannot produce the often required symme­trical zero crossing pulses for proper thyristor or triac firing.

THIS CIRUIT 
The circuit presented here produces constant and well defined zero crossing pulses, centered symmertically around the zero crossings, using very little power and just a few plain vanilla components. The pulse length is virtually independent of the mains voltage, is stable with temperature, and immune against compo­nent and opto­coupler tole­rances and aging. A perfboard prototype is presented in Fig.2.

DETAILED DESCRIPTION 
The zero crossing circuit consists of the voltage to current converting resistors R1-R2, full-wave rectifier diodes D1-D4, a voltage averaging and storing capacitor C1, the opto-coupler U1, and transistor Q1 that functions as a voltage compa­rator. R3 provides base current for Q1, and doubles as an input voltage divider together with resistors R1-R2. R4 limits and sets the current into the opto-coupler LED. D5 provides a proper charge current path for C1, preventing the reverse-biasing of the Q1 b-e junction.

Transistor Q1 stays off during the majority of the mains cycle, during which C1 is charged via R1-R2 and D5. Q1 turns on and feeds current from C1 to the opto via R4, whenever the mains voltage (divided by (R1+R2)/R3) is lower than the voltage across C1. The voltage across C1 will reach within about 400ms an equilibrium that defines the final  operating point. The voltage across C1 never exceeds 10 volts with the given resistor ratios. The voltage stabilizes at a point when the average current charged equals the average current consumed. The typical pulse width is 1ms at 50Hz, and 0.83ms at 60Hz,when using the component values shown. The output pulse width is fairly constant, independent of the designated AC-line voltage (90… 240VAC). This makes this simple zero crossing detector quite unique, since the mains voltage does not affect the pulse width nor its position. 

The circuit’s total power consumption is a mere 32mW at 120VAC, and barely 120mW at 240VAC.  The majority of this power is dissipated in the input resistors R1-R2. The peak current flowing into the optocoupler LED varies almost linearly with the mains voltage. This does not cause any inaccuracies to the zero crossing function, as long as the opto-coupler output is always allowed to saturate - even at the lowest mains voltage. This factor determines the minimum allowed value of the pullup resistor R5. The 4N35 optocoupler has a guaranteed CTR (Current Transfer Ratio) of 100%. If you use another optocoupler, please consider this when calculating the minimum value for R5. You cannot increase the current fed into the optocoupler led by decreasing R4, if you do not at the same time decrease the total resistance of R1 and R2 with the same ratio. The component values given here are optimized for the best signal quality at the lowest possible power dissipation.

C2 forms a first-order low pass filter to deal with the real world noisy power lines. By decreasing the 1/f frequency of this filter you can deliberately delay the ZC-pulse. The voltage rating of this capacitor does not to be high since it sees only the same voltage as C1 plus three diode forwards drops. A 16VDC rating would do (or anything higher). 

All components are low cost and low voltage types (<10V), with the exception that R1 and R2 must sustain each half of the maximum peak mains voltage (200 volts). R2 can be omitted if R1 alone can sustain the maximum peak input voltage. In this case use a 390kohm standard resistor. Splitting the input resistor into two (halving the voltage handling requirement) makes it possible to use only SMD-components. 

The oscilloscope screenshot shows the quality and symmetry of the output pulse. The "downhill" trace is the mains voltage at 20V/div vertical scale, zero volts is at the sceen centerline. The other trace is the output with a 5V/div scale factor. The timebase is 500µs per division. The output pulse is beautifully symmertic around the mains zero crossing.

Even huge temperature variations have a minuscule effect on the zero crossing pulse, due to the “self-biasing” nature of the circuit. The tolerance of C1's capacitance has no effect either. The circuit’s resistor ratios set mainly the operation point, and that is the reason is why the output pulse is almost temperature independent.

The picture on the right is a simulated responce for two extreme mains voltages (100VAC...240VAC). You can see that the pulse width variation is minuscule, being less than 100us over the whole mains voltage range. Real behaviour of the actual circuit is equal.

Warning! Mains voltage carrying circuit!
Please be careful when building ANY mains voltage carrying circuits.

Fig. 2 - Prototype circuit built on perfboard

Fig. 3 - Actual scope image of a zerocrossing. Y-scale for the mains voltage is 20V/div and 5V/div for the output signal. Zero is at centerline. Time scale is 500us/div.

Fig. 4 - Simulated responce for 115VAC and 230VAC, real world performance is as good.

Fig. 5 - Example of load monitoring. The triac snubber produces enough of current to detect if the load is disconnected. Likevise, the ZC-detector can tell if power is deliveret to a connected load.

NOTEWORTHY OBSERATIONS
This zero crossing detector takes a while to start because C1 must first be charged to its equilibrium voltage. This takes about 200 to 400ms, depending on the mains voltage. However, after this period the circuit works normally and reacts immediately to missing mains voltage cycles.

This ZCD can be used for other specific purposes, for example as a missing mains cycle detector, as a pulse-length discriminator, as a AC-load monitor, as a mains fuse condition detector, as an AC-motor function monitor, to mention a few. 

Connecting the phase detector between the phases of a 1-phase motor will produce somewhat higher voltages than the mains, and you have to make sure that the combined voltage and power rating of R1 and R2 is high enough.

OTHER USES  - LOAD MONITORING
Sometimes you don't need to monitor the mains itself, but you need to monitor a controlled mains load. Also here the ZC circuit come in handy. An example is shown in Fig 5. Here a triac controls an incadescent bulb either on or off. With the help of the ZC you can monitor a shorted load, an open load, missing live voltage, and also if the triac is working properly. 

When the power to the load is switched off: 
There is always a small leakage current via the triac snubber, even if the triac is off. This current is effectively shorted by the load, thus the ZCD sees no voltage and does not produce output pulses when the load is connected. If the load becomes disconnected or the bulb filament has failed, then the snubber leakage current is high enough to produce ZC-pulses even if the triac is off. This way you can check the contidion of the bulb without adding cumbersome current measurement circuits, and get a warning if the load has failed.
When the power to the load is switched on:
During this time the ZCD must produce pulses - if not - then the triac has failed or the live voltage is missing (possibly a blown fuse earlier in the circuit).

By combining ZCD information with the triac drive status, you will be able to detect failures in driving a load.  Any mission critical loads (such as alarm lights, traffic lights) can benefit from load monitoring.


Fig. 6 - AC-motor monitoring ciruit. The first ZC-detector determines the existence of the mains voltage and gives the microprocessor a reference zero crossing signal. The other ZC-circuit measures the phase difference (or it's zero crossing occurence). If the delay between the two ZC-circuits is within predetermined limits you can be sue of that the motor rotates.

OTHER USES - AC MOTOR MONITORING
Running an 1-phase AC motor and knowing that the motor actually rotates can also easily be monitored by using two ZC detectors. This quite unique but simple idea using only two simple ZC detectors can actually monitor many types of failures, including; open or short circuits in any widning or wires to the motor, open or short circuits in the motor capacitor or its wires, relay, triac and fuse failures. Even a stalled rotor can be detected. Any of these failures will cause the motor not to rotate, and this condition can be sensed as explained.

You need a microprocessor to perform the logic, but the circuitry is othervice simple. To power the motor on or off, you can use the circuitry in Fig 2, and use Fig 3 as the load. It is recommended to use a triac to control the motor power, and a relay (preferably two) to control the direction of the motor (if needed). To prevent relay contact damage the relay(s) should change stwhen the triac is off and  

As usual - your feedback, comments and/or suggestions are more than welcome: SEND MESSAGE