Figure 1 - Basic 50/60Hz Zero Crossing Detector

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Introduction

Zero crossing detectors as a group are not a well-understood application, although they are
essential elements in a wide range of products. It has probably escaped the notice of readers who
have looked at the lighting controller and the Linkwitz Cosine Burst Generator, but both of these
rely on a zero crossing detector for their operation.

A zero crossing detector literally detects the transition of a signal waveform from positive and
negative, ideally providing a narrow pulse that coincides exactly with the zero voltage condition.
At first glance, this would appear to be an easy enough task, but in fact it is quite complex,
especially where high frequencies are involved. In this instance, even 1kHz starts to present a
real challenge if extreme accuracy is needed.

The not so humble comparator plays a vital role - without it, most precision zero crossing
detectors would not work, and we'd be without digital audio, PWM and a multitude of other
applications taken for granted.

Basic Low Frequency Circuit


Figure 1 shows the zero crossing detector as used for the dimmer ramp generator in Project 62.
This circuit has been around (almost) forever, and it does work reasonably well. Although it has
almost zero phase inaccuracy, that is largely because the pulse is so broad that any inaccuracy is
completely swamped. The comparator function is handled by transistor Q1 - very basic, but
adequate for the job.

The circuit is also sensitive to level, and for acceptable performance the AC waveform needs to
be of reasonably high amplitude. 12-15V AC is typical. If the voltage is too low, the pulse width
will increase. The arrangement shown actually gives better performance than the version shown
in Project 62 and elsewhere on the Net. In case you were wondering, R1 is there to ensure that
the voltage falls to zero - stray capacitance is sufficient to stop the circuit from working without
it.

Figure 1 - Basic 50/60Hz Zero Crossing Detector


The pulse width of this circuit (at 50Hz) is typically around 600us (0.6ms) which sounds fast
enough. The problem is that at 50Hz each half cycle takes only 10ms (8.33ms at 60Hz), so the
pulse width is over 5% of the total period. This is why most dimmers can only claim a range of
10%-90% - the zero crossing pulse lasts too long to allow more range.

While this is not a problem with the average dimmer, it is not acceptable for precision
applications. For a tone burst generator (either the cosine burst or a 'conventional' tone burst
generator), any inaccuracy will cause the switched waveform to contain glitches. The seriousness
of this depends on the application.

Precision zero crossing detectors come in a fairly wide range of topologies, some interesting,
others not. One of the most common is shown in Project 58, and is commonly used for this
application. The exclusive OR (or XOR) gate makes an excellent edge detector, as shown in
Figure 2.

Figure 2 - Exclusive OR Gate Edge Detector

There is no doubt that the circuit shown above is more than capable of excellent results up to
quite respectable frequencies. The upper frequency is limited only by the speed of the device
used, and with a 74HC86 it has a propagation delay of only 11ns [1], so operation at 100kHz or
above is achievable.

The XOR gate is a special case in logic. It will output a 1 only when the inputs are different (i.e.
one input must be at logic high (1) and the other at logic low (0v). The resistor and cap form a
delay so that when an edge is presented (either rising or falling), the delayed input holds its
previous value for a short time. In the example shown, the pulse width is 50ns. The signal is
delayed by the propagation time of the device itself (around 11ns), so a small phase error has
been introduced. The rise and fall time of the squarewave signal applied was 50ns, and this adds
some more phase shift.

There is a pattern emerging in this article - the biggest limitation is speed, even for relatively
slow signals. While digital logic can operate at very high speeds, we have well reached the point
where the signals can no longer be referred to as '1' and '0' - digital signals are back into the
analogue domain, specifically RF technology.

The next challenge we face is converting the input waveform (we will assume a sinewave) into
sharply defined edges so the XOR can work its magic. Another terribly under-rated building
block is the comparator. While opamps can be used for low speed operation (and depending on
the application), extreme speed is needed for accurate digitisation of an analogue signal. It may
not appear so at first glance, but a zero crossing detector is a special purpose analogue to digital
converter (ADC).

Comparators
The comparator used for a high speed zero crossing detector, a PWM converter or conventional
ADC is critical. Low propagation delay and extremely fast operation are not only desirable, they
are essential.
Comparators may be the most underrated and under utilised monolithic linear component. This is
unfortunate because comparators are one of the most flexible and universally applicable
components available. In large measure the lack of recognition is due to the IC opamp, whose
versatility allows it to dominate the analog design world. Comparators are frequently perceived
as devices that crudely express analog signals in digital form - a 1-bit A/D converter. Strictly
speaking, this viewpoint is correct. It is also wastefully constrictive in its outlook. Comparators
don't "just compare" in the same way that opamps don't "just amplify". [2]

The above quote was so perfect that I just had to include it. Comparators are indeed underrated
as a building block, and they have two chief requirements ... low input offset and speed. For the
application at hand (a zero crossing detector), both of these factors will determine the final
accuracy of the circuit. The XOR has been demonstrated to give a precise and repeatable pulse,
but its accuracy depends upon the exact time it 'sees' the transition of the AC waveform across
zero. This task belongs to the comparator.

Figure 3 - Comparator Zero Crossing Detector


In Figure 3 we see a typical comparator used for this application. The output is a square wave,
which is then sent to a circuit such as that in Figure 2. This will create a single pulse for each
squarewave transition, and this equates to the zero crossings of the input signal. It is assumed for
this application that the input waveform is referenced to zero volts, so swings equally above and
below zero.

Figure 4 - Comparator Timing Error

Figure 4 shows how the comparator can mess with our signal, causing the transition to be
displaced in time, thereby causing an error. The significance of the error depends entirely on our
expectations - there is no point trying to get an error of less than 10ns for a dimmer, for example.

The LM339 comparator that was used for the simulation is a very basic type indeed, and with a
quoted response time of 300ns it is much too slow to be usable in this application. This is made a
great deal worse by the propagation delay, which (as simulated) is 1.5us. In general, the lower
the power dissipation of a comparator, the slower it will be, although modern IC techniques have
overcome this to some extent.

You can see that the zero crossing of the sinewave (shown in green) occurs well before the
output (red) transition - the cursor positions are set for the exact zero crossing of each signal. The
output transition starts as the input passes through zero, but because of device delays, the output
transition is almost 5us later. Most of this delay is caused by the rather leisurely pace at which
the output changes - in this case, about 5us for the total 7V peak to peak swing. That gives us a
slew rate of 1.4V/us which is useless for anything above 100Hz or so.

One of the critical factors with the comparator is its supply voltage. Ideally, this should be as low
as possible, typically with no more than ±5V. The higher the supply voltage, the further the
output voltage has to swing to get from maximum negative to maximum positive and vice versa.
While a slew rate of 100V/us may seem high, that is much too slow for an accurate ADC, pulse
width modulator or zero crossing detector.

At 100V/us and a total supply voltage of 10V (±5V), it will take 0.1us (100ns) for the output to
swing from one extreme to the other. To get that into the realm of what we need, the slew rate
would need to be 1kV/us, giving a 10ns transition time. Working from Figure 3, you can see that
even then there is an additional timing error of 5ns - not large, and in reality probably as good as
we can expect.

The problem is that the output doesn't even start to change until the input voltage passes through
the reference point (usually ground). If there is any delay caused by slew rate limiting, by the
time the output voltage passes through zero volts, it is already many nanoseconds late. Extremely
high slew rates are possible, and Reference 2 has details of a comparator that is faster than a TTL
inverter! Very careful board layout and attention to bypassing is essential at such speeds, or the
performance will be worse than woeful.

References

1 - Quad 2-input EXCLUSIVE-OR gate 74HC/HCT86, Philips Semiconductors Data Sheet


2 - A Seven-Nanosecond Comparator for Single Supply Operation, Linear Technology,
Application Note 72, May 98

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy