ESP Logo
 Elliott Sound Products AN-020 

Mains Peak Voltage Detectors

© Rod Elliott (ESP)
Created May 2022

HomeMain Index app notesApp. Notes Index
Introduction

Zero-crossing detectors are covered in detail in AN-005, but peak detectors are a different animal altogether.  In this case, I'm referring to circuits that provide a synchronisation pulse at the peak of an AC waveform, rather than detecting (and holding) a peak voltage level.  In this sense, peak detectors are not very common.  In reality, it's difficult to detect the true peak of a waveform with any precision, because it's rather poorly defined.  Despite this, even a poorly defined pulse may be quite sufficient in some cases.

The question will no doubt asked "why would anyone need to detect the peak?".  I admit, it's a rather unusual requirement, but it is something that's needed in some classes of test equipment.  An example is the Inrush Current Tester, where it's necessary to be able to apply mains power at the very peak of the AC mains waveform.  There are countless peak detectors to be found on-line, but all that I saw were designed to capture the peak voltage, not provide a signal at the instant when the waveform arrives at its peak amplitude.

The comparator plays a vital role - without it, there's no easy way to obtain a reference signal from an AC waveform.

The reader may also wish to have a look at the zero-crossing detector described in the article about Comparators, which includes a circuit that can perform very well with audio frequencies up to at least 10kHz.  It's more complex than the ones shown here, but is also a great deal more versatile.  It's easy to get a pulse duty cycle of less than 2% at 1kHz.  Similar results can be obtained from some of the other circuits described here, provided a fast enough comparator is used.

In a way, you could consider these circuits (particularly the Fig. 3 version) as a rather over-complicated leading-edge dimmer.  While this is certainly true, the circuit is designed for fairly high accuracy, and was originally devised for the inrush tester linked above.  The circuits described are intended for fairly specific requirements, but I'm sure that at least a few people will have a need for them.  I certainly did, and I seriously doubt that I'm alone.


Basic Low Definition Circuit

Figure 1 shows a simple peak detector, and although it will work, the peak is not well defined.  The pulse width is almost ~1.5ms with a 50Hz waveform, but a half-cycle at that frequency is only 10ms, so the mains voltage (based on 230V RMS) will vary by almost 17V during the detection period.  That might not sound like much with a peak voltage of 325V, but it's certainly not a true indication of the peak amplitude.  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 if you don't need high accuracy.

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.

Fig 1
Figure 1 - Basic 50/60Hz Peak Detector

The pulse width of this circuit (at 50Hz) is about 1.9ms.  The problem is that at 50Hz each half cycle takes only 10ms (8.33ms at 60Hz), so the pulse width is almost 20% of the total period.  If you need true peak detection, this is nowhere near good enough.  A simple circuit such as this also has issues when (not if) the mains voltage changes.  Even a small drop of voltage can cause the circuit to miss a pulse, because the capacitor (C1) will retain some voltage.  This is a requirement, as the circuit works by detecting the peak of the AC waveform as it momentarily exceeds the voltage across C1.

If the mains voltage suddenly increases or decreases, the pulse-width is affected.  A voltage increase will cause the 'detection' pulse to be wider, and vice versa.  If you try to make the circuit more accurate (e.g. by increasing the value of R4), it becomes more sensitive to changes of the incoming mains voltage.

Fig 2
Figure 2 - Basic Detector Waveforms

The waveforms are shown above.  The full-wave rectified voltage exceeds the voltage across C1 briefly for each half-cycle, turning on Q1 and producing a pulse that roughly corresponds to the peak of the waveform.  It's quite obvious that it's not a precision detector, because the pulse is far too wide.  To improve matters, greater complexity is necessary, relying on a more precise reference - the waveform's zero-crossing point.


Mains Voltage Peak Detector

There aren't a great many ways to make a mains peak detector.  For best accuracy, a reference is required, and this will come from a zero-crossing detector.  The simple circuit shown above works, but it's far from a precision detector.  The next circuit is powered directly from the mains, but it can also be powered from the secondary of a transformer.  Isolation is necessary for mains voltage operation, and this is provided by an optocoupler.

mains WARNING - The circuits described below involve mains wiring, and in some jurisdictions it may be illegal to work on or build mains powered equipment unless suitably qualified.  Electrical safety is critical, and all wiring must be performed to the standards required in your country.  ESP will not be held responsible for any loss or damage howsoever caused by the use or misuse of the material provided in this article.  If you are not qualified and/or experienced with electrical mains wiring, then you must not attempt to build the circuit described.  By continuing and/or building any of the circuits described, you agree that all responsibility for loss, damage (including personal injury or death) is yours alone.  Never work on mains equipment while the mains is connected ! mains

The circuit may look complex, but it's quite straightforward.  It uses a single dual comparator, with the first stage being a zero-crossing detector.  See AN-005 Zero-Crossing Detectors (ZCDs) for a complete explanation of these circuits.  The ZCD discharges C2 at each zero-crossing, and it charges via VR1.  This is a trimpot, so the exact timing can be set.  For 50Hz mains, the peak occurs 5ms after the zero-crossing, or 4.17ms for 60Hz.  The trimpot is set so that the output of U1B goes high at exactly the peak of the waveform.  Note the 'isolation barrier', which separates mains (hazardous) voltages from 'safe' low voltage.

Fig 3
Figure 3 - Mains Voltage, Isolated Peak Detector

The two important waveforms are shown next.  The green trace is the voltage across ZD1, which is the zero-crossing signal.  When that goes low, C2 is discharged, but the period is very short.  As soon as the zero-crossing signal goes high again, C2 charges via VR1.  When the voltage across C2 exceeds 3.3V (set by ZD2), the output of the timer goes high.  This rapid increase of voltage is differentiated by C3 and R7, and drives the gate of Q1 high.  The pulse duration is about 70µs.  This pulses the LED in optocoupler U2, causing a positive pulse at the output.

Fig 4
Figure 4 - Mains Voltage, Isolated Peak Detector Waveforms

VR1 is adjusted to get the output pulse to match the peak of the AC waveform.  By using the mains zero-crossing as a reference, far greater accuracy is possible than by any other means.  This principle is used in the Inrush Current Test Unit, which allows the mains to be turned on at the zero-crossing point or at 90° (the peak of the AC waveform).  The circuit can easily detect the 325V peak of a 230V AC waveform with an error of less than 1V (about 120µs).

The circuit is also easily adapted for low voltage operation, in the same way as Fig. 1.  There are very few changes needed, and while it's safe to work on you need a transformer.  Despite any misgivings you may have, a transformer's output voltage is in phase with the input, so there's no displacement.  The circuit is shown with a 15-0-15V transformer, but a single winding can be used, substituting a bridge rectifier for the full-wave version.  It can be operated from any voltage you like (within reason), but if the zener diode voltages are changed the timing changes as well.

Fig 5
Figure 5 - Low Voltage High-Performance Peak Detector

You can build and test the Fig. 5 version with a (safe) low voltage, then simply power it directly from the mains with a series resistor arrangement as shown in Fig. 3.  Because the circuit has a slightly higher current than the Fig. 3 version, the series resistance has to be lower.  For 230V, a pair of 47k, 1W resistors in series will be fine for 230V, and only one is needed for 120V.  The only other change is to add the optocoupler and change R9 to 1k (or less for more current).  The optocoupler LED is wired in series with R9.

Fig 6
Figure 6 - Typical High-Performance Peak Detector Waveforms

The waveform from the output should look like that shown in Fig. 6 (or Fig. 7), with very narrow pulses that are aligned with the peak voltage by means of VR1.  The red trace is in mA through the optocoupler, and the rectified voltage waveform is in green.  The current peaks are only ~250µs wide, with the leading edge aligned with the AC peak.  This can be used to trigger a switching circuit or anything else that needs a mains peak reference.

Fig 7
Figure 7 - Test Circuit

I built the circuit shown above to test and verify the circuit's operation.  I didn't have any LM393 comparators to hand, so I used an LM358 dual opamp.  The other (small) changes were simply a matter of convenience (C3 & R6).  The circuit behaves very well, and there is no sign of instability.  In short, the simulated and physical circuits performed virtually identically.  The next waveform (violet trace) was captured across R6, and it should be apparent that this is more than good enough to trigger the MOSFET driver stage.

Fig 8
Figure 8 - 'Scope Capture Of Mains And Peak Trigger Waveforms

The capture was taken using the Fig. 7 circuit, but without the MOSFET and optocoupler.  It was powered from a 10V AC source (ignore the voltage shown for the yellow trace, as that's a separate transformer voltage for reference).  The peak detection pulse (violet trace) can be shifted across the mains peak, but because it's flat-topped the exact position isn't critical.  The LM358 opamp instead of the LM393 comparator saves one resistor but adds a diode.  Despite the rather dismal performance of the opamp (compared to a comparator), the circuit performs perfectly.

The negative pulses seen on the violet trace indicate the point where the ZCD discharges the timing capacitor.  As you can see, these pulses are not at the zero-crossing, because no attempt was made to use a 'precision' ZCD, as it's not necessary.  It only needs to be predictable and repeatable, and while you only see a small number of pulses in Fig. 8, I observed the circuit for some time.  The pulse positions stayed exactly where they were supposed to be for as long as I cared to run the test.  Due to the normal 'flat-top' mains waveform (which changes during the day), there is some leeway.  There is no significant shift in the pulse position when the mains voltage is varied, even if well beyond the variations normally seen (nominally ±10%).

Current drawn from the mains is minimal (about 1.1mA RMS).  The voltage on U1.2 is about 5.1V (set by ZD2), but the LM393 comparator and the LM358 opamp can have their inputs at (or even slightly below) ground.  The output pulses low when Pin 3 falls below 5V, and discharges C2.

The 10µF filter cap for both circuits looks as if it's far too low, but it can maintain the voltage for the very brief current pulses.  Be careful of stray capacitance around the comparator's input pin.  If it's more than around 50pF the circuit may not work, and R4 will need to be reduced a little.  Lower values give a wider pulse.  The LED current will be about 3mA with the 1k series resistor for the optocoupler, and it can be reduced if you need more current.

These circuits are provided so you can experiment, and the waveforms (other than Fig. 8)are from the simulator.  Fig. 7 has been tested on the workbench.  A scope capture is the final proof of operation.  If used with 120V, 60Hz, reduce the value of R1 and R2 (only half the resistance is needed, and two resistors in series for each isn't needed).

There are limited applications for peak detectors, and they can only work with a fixed frequency because the 'peak' pulse is determined by a timer.  Nevertheless, I hope that someone will find the circuits to be useful.  Despite the limited application for something like the circuits described, the usefulness cannot be denied based on my inrush tester, which has allowed me to produce high resolution 'scope captures of inrush current under different conditions.  It's one thing to hypothesise and/ or simulate, but another to run the tests on the workbench and provide real-world measurements.

These circuits are ESP originals, and there's virtually nothing else even remotely similar described that I could find.  The Fig. 3 circuit was inspired by the circuit I developed for the Inrush Tester, and also works as a 'proof of concept' for the circuitry shown in that article.


References
  1. LM393 Datasheet
  2. AN-005 ESP Application Note

 

HomeMain Index app notesApp. Notes Index
Copyright Notice.This article, including but not limited to all text and diagrams, is the intellectual property of Rod Elliott, and is © 2022.  Reproduction or re-publication by any means whatsoever, whether electronic, mechanical or electro-mechanical, is strictly prohibited under International Copyright laws.  The author (Rod Elliott) grants the reader the right to use this information for personal use only, and further allows that one (1) copy may be made for reference while constructing the project.  Commercial use is prohibited without express written authorisation from Rod Elliott.
Change Log:  Page Created and © Rod Elliott May 2022.