ESP Logo
 Elliott Sound Products Project 138 

Brownout & Over-Voltage Detector/ Protector

© July 2012, Rod Elliott (ESP)


Based on things I've heard recently, it seems that more equipment is damaged by brownout (low mains voltage) conditions than ever used to be the case.  I'm unsure who is to blame, but the increasing use of alternative/ green energy supplies may have something to do with it.  If your house is supplied by wind-turbines (for example) and the wind suddenly stops, there is likely to be a significant voltage sag that lasts until more capacity can be brought on-line - for example from an OCGT power station.  In addition, most power grids are now running much closer to their maximum capacity, so a small increase in demand can cause the voltage to drop well below the rated nominal value.

Meanwhile, if your TV is on or your refrigerator decides to switch on while the voltage is low, there is a real chance that damage will occur.  Motors are particularly susceptible, especially when they have to start under load.  The humble fridge is especially easy to damage with low voltage mains, because the motor always has to start under load.  If the mains voltage falls too low, the motor can't start, but stalls and may overheat quickly.  While there is nearly always an over-temperature switch in the circuit, it doesn't always save the motor after repeated abuse.

I've also heard recently that many plasma TV sets can fail if the voltage falls too low.  This may also apply to LCD sets, but I have no details about this.  Other household products are also likely to be susceptible, but most people won't try to operate appliances if the voltage is low (evidenced by dim lights for example).  Heating elements are immune from voltage sags, because they simply draw less current because of the low voltage.  Even wide-range switchmode power supplies are affected.  As voltage is reduced, current increases.  For a high power application, it's easy to exceed the maximum circuit current ... just because the voltage fell below normal.  For example, a 150W LED floodlight will draw 652mA at 230V, but if the mains voltage were to fall to 150V it would draw 1A.  For one it's not a problem, but if you have 15 lamps on a 10A circuit, the breaker will may if the voltage falls far enough.

This project may not appear to have much to do with audio, but valve amplifiers in particular are vulnerable.  Low voltage mains reduces the heater temperature which can cause cathode damage, the amp's bias circuits may only have a limited tracking range, and high mains voltages can easily stress valves and electrolytic capacitors that may only have a small margin for excess voltage.  Most transistor amps are immune (many will work at reduced power with as little as 25% of the nominal mains voltage), but excess voltage can cause damage in some cases.  However, there are amplifiers that are known to misbehave badly if the voltage is too low.  Toroidal transformers are especially susceptible to excess voltage, because magnetising current increases rapidly as the core is pushed into saturation by higher than normal voltages.

For 230V mains, most products will work with a mains voltage between 204V to 260V (±13%), and for 120V countries the range is from 106V to 136V.  To be useful, the upper and lower limits should be able to be set independently.  The easiest way to power the circuit is to use a switchmode plug-pack (wall-wart) supply.  You can pull the PCB from inside its case and wire it directly into the brownout detector box.  This is by far the preferred method, because there is no likelihood of mains voltages on the low voltage insulated wiring.  You can also use a small iron-core transformer with a suitable rectifier, filter and regulator, but that will be larger, use more standby power, and cost more.  However, it's also more reliable.

There seem to be people posting complete drivel on the Net regarding the mains tolerances that are 'allowable' or 'acceptable' for connected equipment (I'll bet that came as a surprise!) One I saw claims that there are 'industry standards' that it's naively assumed are adopted by 'everyone' because they've been in place for over 30 years.  Utter nonsense.  There are exactly no standards that are universally adopted, and doubly so if the standard is not mandatory, if Asian manufacturers don't even know it exists, and it only applies to some items of office equipment in the US!  There are no standards and no required tests for over or under voltage, other than to ensure that the item does not catch on fire and/or become electrically unsafe if subjected to mains supplies outside the nameplate rating.  To assume that somehow the 'magic standards fairy' will keep your equipment safe is unlikely to ensure protection.

Because of the problems people are starting to experience in major metropolitan areas (where mains power has been taken for granted for a great many years), there are several manufacturers now offering under-voltage cutouts.  The number of protection devices available is sure to grow over the next few years.  Some equipment may have in-built protection, but it's unlikely that you'd ever know about it because wide mains variations have been uncommon until fairly recently, and no-one has bothered to mention the ability in their sales pitch.


All circuitry used in this project operates at mains potential, and is therefore potentially lethal.  Do not attempt construction if you are not 100% confident of your abilities to safely work with and wire mains circuits.  In some countries, it may be illegal for non-qualified persons to construct or work on mains powered equipment.  ESP accepts no liability for death or injury if you choose to build the project.  Do not ignore these warnings.  The material presented in this article describes equipment that can kill or seriously injure anyone who builds it.  Extreme caution is advised.  NEVER work on the project with mains power applied.

All warnings are to be observed - always!  Every part of the circuit is at mains potential, including the DC output from the power supply.  For this reason, an external supply must never be used.  It must be internal and fully insulated from the case, regardless of whether it is a conventional (transformer based) or switchmode.


Please don't ignore the warnings above - they are deadly serious!  It only takes a momentary lapse of concentration for you to die by electrocution or be seriously injured due to electric shock.  Any adjustments should be made with the power disconnected - this may well be inconvenient, but it is generally considered that death is a great deal more inconvenient than spending a few extra minutes to ensure your safety.

Also, be aware that you can buy ready made units rather cheaply, and it goes without saying that many corners will have been cut and the end result will perform poorly and will probably have a short life.  I bought a 'typical' low-cost protection circuit to see what they did, and the results aren't pretty.  AC caps are 630V DC types which will not survive 230V AC mains - only X-Class caps should ever be used in this role, as that's what they are designed for.  Circuitry is basic (that's actually rather high praise), and a phenolic PCB is used in the one I bought.  Yes, it was cheap, and now I know why.  I would not use it as supplied, and at least some modification is essential just to make it passable.  It cannot compete with the design shown here in any respect.


The project is not especially complex, but you must take great care to ensure that it is electrically safe.  This isn't just for you as you build it, but for others who may use it - perhaps many years after it was built.  While it would seem logical to use a PIC rather than an analogue circuit, the benefit of the system described is that it is easily adapted to suit different voltages, and doesn't require any programming.  The circuit uses readily available and cheap parts.

The current that can be handled by the circuit is limited by the relay you select and the maximum load permitted by the electrical circuit.  Normally, a 10A relay will be sufficient for most applications, especially with 230V mains.  If you are in a 120V country you may choose to use a 20A relay.  Some industrial applications might need a larger relay, but this is up to the constructor.

There are a few commercial units available that claim to do what this project does, but I can't comment on them since I have none to check out.  It's to be expected that most will use a PIC or microcontroller, and for a mass produced item that is undoubtedly the cheapest option.  For people who want to make their own, it's less appealing because of the need to write code that is 100% reliable and the designer also needs to understand mains and analogue functions.  The design shown can be simplified, but at the expense of performance and flexibility.  To me, the important thing is that it should work as well as possible, and compromising to save a few cents is unwise.

fig 1
Figure 1 - Conceptual Schematic Of The Brownout Protector

The schematic doesn't show the power supply.  As noted above, this can be a switchmode power supply which should be internal.  If you use an external supply, you absolutely cannot and must not use the standard DC connector or DC lead.  These are not safe because the output of the supply is effectively connected to the mains!  The DC wiring and connector must be rated for mains voltages, and cannot have any conductor part of the socket that can be touched by a finger or other object.  The cable from plug-pack supplies is not rated for mains voltages, and I cannot recommend strongly enough against using an external power supply.

The circuit itself is quite straightforward.  The mains voltage is 'isolated' by C1 - this isn't true isolation though, C1 acts mainly as a current limiter.  The maximum current available is a little over 7mA with 230V, 50Hz mains.  C1 must be an X-Class capacitor, designed specifically to direct connection to mains voltages.  Do not even think of using a standard DC rated capacitor - X2 caps are rated for 275V RMS, but DC capacitors will fail eventually.  R1 and R2 form the first section of the mains voltage divider, and although their dissipation is very low, they must be rated at 1W so they can withstand the maximum possible peak voltage without failure.  There are two in series for the same reason.  For 120V operation, only one resistor is used, either R1 or R2 - not both!

The AC is rectified by the 4 diodes, and is reduced by the voltage divider created by VR1.  The reduced voltage from the mains is compared against a reference voltage, nominally 10V.  Should the mains rise above the upper threshold or fall below the lower threshold, the relay turns off and disconnects the load.

When the mains returns to a safe value (between the upper and lower thresholds), a simple timer waits for a preset time before allowing the relay to switch on again, restoring power to the load.  This is one area where a PIC would be particularly useful, because long time delays are easy to implement.  It doesn't matter though, because the delay only needs to be long enough to prevent repetitive switching at a rate that might damage connected equipment.  Luckily, a cheap CMOS IC can be used easily (see full circuit below).

The comparator is called a 'window comparator' because it will only provide an output if the signal is outside the upper or lower limit - i.e.  there is a 'window' of acceptable voltages.  As long as the input voltage is within the window, the output remains low and power is passed through to the load.

230V OperationSense Voltage120V OperationSense Voltage
Table 1 - Sense Voltages VS Mains Voltage (±13%)

The 'sense voltage' referred to in the table is simply the voltage presented to the window comparator, based on the assumption that the optimum is exactly half the reference voltage of 10V, set by D5, a 10V zener diode.  For the recommended upper and lower limits, the upper threshold is therefore 5.65V when the mains at the upper limit, and the lower threshold is 4.42V

If you wish to use a different mains tolerance percentage (say ±15%), then you simply multiply the reference voltage (5.00V) by 1.15 to obtain the upper threshold (5.75V, for a maximum mains voltage of 264.5V).  Then divide 5.00 by 1.15 to get the lower threshold (4.35V for a minimum mains voltage of 200V).  You can have different upper and lower percentages if you wish - just use the method described with your revised percentage figures.

These voltages need to be set fairly accurately, and fortunately this can be done with only a 12V DC power supply - you don't need any mains connection.  The threshold voltages can also be set independently of each other, and can be tweaked to get the voltage range you desire.  It does not have to be the same as the range I've suggested.  You will see from the circuit that the voltage you are sensing is low, and the variation is small.  This is unavoidable because we have to divide the peak mains voltage by 46 for 230V or by 24 for 120V.  Any error setting the thresholds is therefore multiplied by 46 or 24 at the mains.  Accurate setting and high stability are obviously important!

Be aware that even if you do set the voltages exactly as specified, there can still be an error caused by the mains waveform.  The sense signal is based on the peak value rather than true RMS, and even tiny errors in the threshold voltages are magnified by 46 or 24 depending on your mains supply.  A mains error of a couple of volts either way is not really an issue - the important thing is that you can sense out-of-range voltage and switch off the appliance.  Extreme accuracy is not necessary, but you'd obviously like the cutout voltages to be fairly close to those you set up.

The schematic shown assumes that you'll use a switchmode 12V power supply, but you can eliminate all mains wiring (other than to the relay) by using the linear (transformer based) power supply shown in Figure 3.  It provides the 12V DC, the signal for TP1 (mains voltage sense) and a clock generator for U2.  That means that the circuitry in the shaded section (D1-D4, R1-R5, D7, C1 and C2) is not used.  This is the safest way to build the circuit, but it will be somewhat larger than one using a small SMPS.

fig 2
Figure 2 - Full Schematic Of The Brownout Protector (Excluding PSU)

There are some changes from the conceptual version, mainly because of the requirement for a clock signal for the timer (U2).  D1-D4 must be 1N4007 diodes, and remaining diodes can be also be 1N4007 even though the voltage is much less (there is less chance of getting diodes mixed up if they are all the same).  The 10V zener (D5) stabilises the reference voltages VH and VL (overvoltage and undervoltage).  As noted above, for the suggested range the voltages are 5.65V and 4.42V respectively.  As with the conceptual version, for 120V operation, omit (short) R2 and R4, because R1 then sets the sense voltage at close to 5V without any other changes.  R3 provides the clock signal to the 4020 CMOS counter.  Capacitors C3 and C4 prevent sudden short spikes from causing the circuit to trip unexpectedly.  Probably not strictly necessary, but I think they are a worthwhile addition.  Remember that even a momentary pulse at the output of U1A or U1B will reset the timer and disconnect the mains.

I suggest that you add a MOV across the mains input as shown.  This will provide some added protection against short voltage spikes that will not be detected by the circuit.  The MOV used must be appropriate for the mains voltage, so consult the supplier's data sheet to select the one that's right for you.  Use the largest (physical size) MOV that you can, as their protection is far better than small units - all MOVs degrade with time and use, and larger ones will last longer and can absorb more energy.

Provided the sense voltage is lower than 5.65V and higher than 4.42V, the outputs of both opamps will remain low, and U2 is not reset.  If the voltage goes above the upper threshold, the output of U1B will go high, turning on the 'Protect' LED and resetting U2.  Once reset, there is no voltage at Q13 (pin 2), so transistor Q1 turns off, and the relay disconnects the mains.  Should the mains voltage sag so that the sense voltage is below 4.42V, U1A's output will go high - this also resets U2 and disconnects the mains.  The timer's output remains off for as long as the reset pin is held high, and once the reset goes low again (voltage within tolerance) it stays off until the selected time has elapsed.

Because of C2, there will always be a delay before the window comparator will operate, and this prevents false tripping with momentary variations.  This delay will typically be between 100-500ms, depending on the magnitude of the 'surge' or 'sag' relative to the nominal voltage.  It is possible to reduce the delay time by reducing the value of C2, but that is likely to cause more grief than it's worth.  The idea of the circuit is to protect against sustained mains voltage aberrations, and making it hyper-sensitive is not likely to be useful.  Any equipment that cannot withstand a short voltage variation is probably faulty and should be repaired.

You'd normally expect to see a 555 timer used, but the timer arrangement shown is actually the easiest way to get a reasonably long time delay without having to resort to comparatively bulky analogue timer techniques.  These require large capacitance and high resistance, and may be subject to considerable variation over years of operation.  The 4020 CMOS IC is cheap, draws very little current, and runs perfectly from the 12V supply we are using.  The 10µF cap shown should be as close to the IC as possible.

The maximum delay produced is approximately 2m 44s at 50Hz, or 2m 16s with 60Hz.  It uses the mains frequency as the clock signal.  It is approximate only because of the initial delay while C2 charges.  D8 blocks the clock signal by forcing the clock input high once the selected output pin goes high, preventing the IC from constantly switching on and off as it would do with a continuous clock signal.

The 4020 is a 14 bit binary counter, so divides the input frequency by a maximum of 214, which is 16,384.  We can't make use of the full count range though, and at the maximum setting (Q14) it will actually stop after 8,192 clock cycles.  With 50Hz input, this is 163.84 seconds or 2.73 minutes.  If you wanted to make a longer delay you could use two 4020 ICs - the maximum time is then over a month with a 50Hz clock.  Personally, I think this is probably too long to wait for your fridge to turn back on. 

Not all 4020 IC outputs are shown in the schematic - only those that are potentially useful have been included.  If you want to use any of the shorter delays, see the 4020 datasheet or Table 2 below for the pin numbers.

It is very likely that you won't need the full 2m 44s delay, so you can use any of the available outputs.  Q13 will halve the time (1m 22s), Q12 halves it again (41s - as shown in the schematic, and probably ideal), Q11 halves that again (21.5s) and Q10 reduces the delay to about 10s.  You could even use Q9 (pin 12) to get a 5s delay (6 seconds including the startup delay caused by C2), but I think that's probably too short and can't recommend it.  Although the circuit shows the use of Q12 (pin 1), Q11 (pin 15) may be preferred by some people - the important thing is that you have a choice.  The following table shows the IC delay for each available output.  Add 1 second to allow for the charge time of C2.  Delay times in the shaded cells are too short and are not recommended.  The drawing shows jumper positions for the four most useful delay times, with the jumper installed at Q12.

IC OutputDelay (50Hz)Delay (60Hz)IC OutputDelay (50Hz)Delay (60Hz)
Q4 - pin 7160 ms133 msQ10 - pin 1410.24 s 8.5 s
Q5 - pin 5320 ms266 msQ11 - pin 1520.5 s 17 s
Q6 - pin 4640 ms533 msQ12 - pin 141 s *34 s *
Q7 - pin 61.28 s1.07 sQ13 - pin 282 s (1:22 m:s)68 s (1:08 m:s)
Q8 - pin 132.56 s2.13 sQ14 - pin 3164 s (2:44 m:s)136 s (2:16 m:s)
Q9 - pin 125.12 s4.27 sDo not use greyed italic out values - delay is too short
Table 2 - 4020 Delay Times In Seconds ( * = Default )

The default is 41s (34s with 60Hz) as shown in the circuit diagram.  Delays shorter than 8 seconds or so are not useful and should not be used, as it would mean that the connected load will just switch on and off if the mains were close to the upper or lower threshold.  The upper threshold isn't a major issue, because when the load is disconnected the mains voltage will rise slightly - enough to ensure that the circuit remains disabled.  At the lower threshold, the mains will be cut when the voltage falls far enough, but that will cause the mains voltage to rise slightly (no load voltage) and the mains would normally be switched on again as a result.

To prevent this, there is a hysteresis circuit (D11 & R10) that means that the mains has to increase to around 210V before the power will be restored.  You can adjust this by changing the value of R10.  A higher resistance means less hysteresis and vice versa.  The lower cutout threshold is not changed by the hysteresis circuit, except that the mains will not be restored until the timer has expired, so transient variations around the minimum won't create problems.

Note the two transistors that activate the relay.  You can use any small-signal transistors for Q1 and Q2 - the BC549 devices are only a suggestion.  Q2 must have a current rating to suit the relay coil - typically around 50mA, but it depends on the relay you use.  You could use a small signal MOSFET in place of Q1 and Q2 - a 2N7000 will work fine.  No other changes are needed.

When first powered on, the load will not be activated until the delay has expired.  The power LED will remain on, but the protect LED will flash briefly, because as C2 charges it initially indicates that the voltage is low - this is completely normal.  If the mains should fail completely (a blackout), the relay will switch off because it has no power, and your equipment is protected against short-term re-connection because of the timer.

If the mains is very close to the upper or lower threshold, the circuit may attempt to switch the load on and off.  However, there is the preset delay and hysteresis for the lower threshold, and if the window comparator detects a fault within this time, the timer is reset.  Power will not be returned to the load until the voltage is stable for the delay time, and remains within the valid range the whole time.  No protection system is infallible - the possibility always exists that power is restored, only to be disconnected again soon thereafter.  The delay ensures that power cannot cycle on and off quickly - a condition that may damage some equipment.  If you use this circuit with a valve amplifier, I suggest that you use a delay of 1 minute or more.

Power Supply

There are very good reasons to use a conventional transformer based linear supply.  The primary must be able to handle the full phase to neutral voltage, and it needs a DC output (before regulation) of around 24V at normal mains input.  This ensures that the DC will remain regulated even well below the nominal mains voltage.  A suitable supply is shown below.  It includes the clock generator and unregulated adjustable voltage sense output.  The circuit of Figure 2 now has no mains on the control circuits at all - the relay is the only part that connects to mains wiring (apart from the transformer primary of course).

fig 3
Figure 3 - Conventional Linear 12V Supply

The linear supply is conventional in all respects, except the transformer secondary voltage is a little higher than I would normally recommend.  The mains On/ Off switch (Sw1) is entirely optional.  The transformer and main filter cap should be good quality types to ensure long life.  The regulator will dissipate around 1W, and must be provided with a suitable small heatsink.

If you don't mind the idea of working with live mains but don't want to use a switchmode supply, you can use the supply circuit shown without the extra parts.  R1, R2 and VR1 are omitted, and the circuitry inside the shaded box in Figure 2 is used to derive the sense voltage and clock signal.  If you do that, remember that the entire circuit is then at mains potential, so the 7812 must not be attached to the case - the entire supply must be fully floating and insulated accordingly.

The other alternative is to use a wide-range SMPS, as these are readily available.  You can steal the 'guts' from a plug-pack (wall wart) supply, or buy one ready made from any number of suppliers.  Whatever you use, it has to be reliable and reasonably noise-free so it doesn't affect the circuitry.  An example unit is shown in Figure 7, mounted on a piece of plastic to allow chassis mounting.  Most miniature switchmode supplies do not provide mounting points, so you have to arrange this yourself.

3-Phase Detection

A reader was wondering about a 3-phase version, which made me realise that this is actually an important application.  3-phase loads are commonly motors, and under-voltage is likely to cause a very expensive failure.  While over-voltage is usually less harmful, that's certainly not always true because the motor's magnetic circuit may start to saturate causing a much higher than normal current draw.  The internal fan may not be able to keep the temperature within allowable limits.

note WARNING:   The single phase version of this project can kill you with the greatest of ease if you let your concentration lapse even for a moment.  The 3-phase version is much more dangerous.  Unless you are 100% competent and confident, don't even consider it.  I was zapped by Australian 415V many years ago, and I can assure you that the electric shock is extreme.  While I survived, you may die.  If I did it again, I might die.
Never attempt mains wiring unless you are qualified to do so!  Multiply this warning by three for 3-phase !

For 3-phase systems, there is obviously greater complexity.  Only a single timer is needed, but three separate detectors are needed - one for each phase.  The reference voltages can be shared between the three phases, so while each phase needs to be adjusted, the reference voltages are shared between the window comparators.  The rectifiers can no longer be full wave though, so the smoothing cap needs to be increased to suit.  It's also important to understand that the neutral conductor must be available, because each detector is designed to use the phase to neutral voltage.  Other than using three separate transformers (bulky and expensive), there is no simple way to monitor the phase voltages without the neutral.

The voltage sensor circuits are shown below.  The wire colours shown comply with IEC recommendations for 3-phase systems, with the 'old' colours shown in brackets for each.  The rectifier on each phase just uses two diodes, and the clock signal for the 4020 timer is derived from one of the phases.  I've shown it on Phase 1, but it doesn't make any difference which one you use.  Note that I have based this on the Australian standard 3-phase domestic supply, which is 230V from phase to neutral, and 400V between phases (commonly still referred to as 415V).  You may need to adjust resistor values if your 3-phase supply is dramatically different.

Don't even think of using this circuits with voltages exceeding 277V from phase to neutral!  (That derives from the US 480V 3-phase voltage - there are two common 3-phase voltages in the US - 208V and 480V.) Note too that the DC supply must be designed for the phase to neutral voltage, and in the case of US 480V systems, you'll probably need to run the 12V supply from a normal 120V outlet because very few AC-DC converters are designed to be able to handle 277V input.

For what it's worth, to calculate the nominal 3-phase (delta, phase to phase) voltage when you only know the single phase (wye, phase to neutral) voltage, use the formula ...

Vdelta = √3 × Vwye,     so ...
Vdelta = 1.732 × V230 = 398V

You probably won't ever need to know this, but it's too late now .  You can also use the formula the other way around to obtain the phase to neutral voltage from the phase to phase voltage.  If none of this means anything to you, I suggest that you do NOT attempt to build this circuit.

fig 4
Figure 4 - 3-Phase Voltage Sources & Clock Generator

The idea is that if any one of the phases falls outside the preset voltage limits, the circuit will trip and disconnect the 3-phase mains from the load.  Only a single clock generator is required, because the timer can't operate if any one of the three phases is outside the preset limits.  So, even if Phase1 was functional but the others were out of tolerance, the circuit locks out all three phases until they are all within the limits.  Then (and only then) will the timer start.

fig 5
Figure 5 - 3-Phase Voltage Window Comparator Detectors

As you can see, the two reference voltages (VH - TP1 and VL - TP2) are shared by all three comparators, and there is a shared under-voltage hysteresis circuit.  The only additional parts needed here are two more LM358 dual opamps and four diodes.  Unlike the single phase version shown, I suggest that you use 1N4148 small signal diodes here, because there are quite a few of them and they are cheaper and smaller than 1N4007s.

fig 6
Figure 6 - Timer And Output Relay Switching

While the standard relay is included in the timer circuit, it is expected that it will in turn operate a three phase contactor.  Attempting to operate the contactor directly would be unwise, because they are generally fairly large, and the coil is often AC and driven from the mains.  You could substitute a SSR (solid state relay), but there's a lot to be said in defence of the standard electromechanical types, and that would be my choice.


Predictably, there is no PCB available for this project, but it's easily assembled on Veroboard or similar.  Be careful with the high voltage section though - prototype boards are not designed to withstand mains voltage, and C1, the bridge rectifier (D1-D4) and resistors R1-R4 (all 1W) should be wired independently, insulated with heatshrink tubing and held in place with hot-melt glue or similar.  It is vitally important that no short circuits can occur between any of these parts!  Likewise, the relay should not be mounted on the prototype board.  The same applies to the 3-phase version of course.

Because there are two versions of power supply (transformer based or switchmode), you need to adapt the construction accordingly.  The single phase unit will most likely use the Figure 3 power supply, but the 3-phase unit can use either supply, but still needs the voltage detector circuits so all circuitry will be live.

The remainder of the circuit can all be wired on a fairly small piece of Veroboard, making sure that it is firmly mounted so it can't move around.  Remember that during normal operation, all parts are at mains potential when a switchmode supply is used.  This includes the LEDs, so use standard 5mm types, as they have enough plastic in front of the LED chip to ensure safety.  If you use a metal chassis, it must be connected to protective earth as shown in the schematic.

VR1, VR2 and VR3 (etc.) should all be 10-turn trimpots.  You can drill a small hole in the case to that VR1 can be adjusted, but it's not especially useful since you need to be able to measure the voltage across VR1 or C2.  To this end, you can include test points (loops of tinned copper wire) so you can attach clip leads from your multimeter for final adjustment.  This has to be done with the mains present, so follow the instructions below carefully to avoid a possibly fatal electric shock.  Initially, set VR1 for half resistance (5k).  In the 3-phase version, the trimpots that have to be set with mains present are VR1, 2 and 3.

As suggested earlier, the intestines of a switchmode plug-pack makes an ideal power supply.  Most are designed for wide range (<100V to 240V) operation and are regulated.  They are also surprisingly inexpensive - far cheaper (and smaller) than a transformer, bridge rectifier, filter capacitor and regulator IC.  I leave it to you to figure out how to get the case apart - there are too many variations to be able to give specific recommendations.  As a general rule, you can crack the glue join by squeezing the top section of the case in a vise.  Be gentle - you don't want to damage the internal PCB!

The power supply you use must be regulated, and also must retain normal 12V output to a voltage at least 10% below the low mains threshold voltage.  This is something that you'll need to check if you use 120V mains - with a wide range supply, there is no problem with 230V mains, as the supply will never fall low enough to cause the voltage to drop below 100V (other than during a blackout of course).  The supply only needs to be rated at 100-400mA or so (a 5W supply gives 400mA), because the overall current drain is very low, typically less than 100mA when the relay is on.

fig 7
Figure 7 - Plug-Pack Supply PCB Mounting Example

Once you have the board out of the case, it can be mounted as shown in Figure 7.  I used a piece of acrylic, with holes drilled so the mains and DC wiring holds the board in place.  Tinned copper wire makes a good mounting method, and also provides termination points.  If you use a metal case, you'll need another piece of acrylic or similar underneath the mounting plate, because the mounting wires are accessible on the back of the mounting plate shown.  The mains leads are connected to the board on the left side of the photo.  Make sure that you cannot inadvertently mix up the mains and DC connections!  If mains is applied to the DC output of the supply the results will be spectacular, to put it mildly!

Remember the warnings at the beginning of this article - if you are unsure of your abilities to mount the board solidly and safely, then don't even attempt this.  Get assistance from someone who is used to mains wiring and knows how much insulation and clearance is needed for mains voltages.  The mounting plate shown must be mounted using nylon screws if the screws are accessible from outside the case, and it is imperative that the screws cannot be undone from the outside, so use two nuts on the inside.  Safety is paramount, and you cannot leave anything to chance.

Inexpensive PCB mounting switchmode supplies have recently become available, and should be available from major suppliers.  If you can get one, this is obviously a better option than gutting a plug-pack and having to figure out a mounting technique for the board and its terminations.  A typical unit should cost less than AU$20 and only needs to be rated for about 100-150mA (assuming a relay current of less than 70mA).  The remainder of the circuitry is all low power.  The 10V zener diode draws more power than any of the other circuitry (other than the relay), at about 20mA.  You can reduce the current if you wish (not less than 10mA though), by increasing the value of the 100 ohm resistor.  180 ohms is the highest value I recommend.

The 3-phase version can use the same type of supply, because the additional opamps only draw a few milliamps.  However, you must be wary of the input voltage, which will be excessive with a US 480V 3-phase supply (277V).  There should be no issues with the common 400V (415V) 3-phase voltage common in Australia, the UK, Europe and elsewhere.

noteWARNING:   The relay contacts must be rated for the mains voltage used and the current drawn by the appliance.  Failure to use a mains rated relay may cause arcing, relay damage or even a fire.  Minimum contact rating should be 10A, and preferably 20A for 120V use.

For most constructors, I recommend the PSU shown in Figure 3.  This makes the circuitry far safer, because it's no longer connected to the mains.  The linear supply also means that setup is a great deal easier because it can be done safely with the mains connected normally.  Make absolutely sure that all mains terminations are protected against accidental contact.

Setting Up & Testing

Most of the material here applies if you use a switchmode supply or have built a 3-phase version.  The dire warnings don't apply if you use the Figure 3 supply with its voltage sense and clock generator, and all adjustments can be made with the internal supply.  The process of setup is otherwise the same.

If you opted for the SMPS, use an external regulated 12V supply, and ensure that all mains connections are NOT connected to the mains!  Test point 0 (TP0) is the common connection, and the multimeter -ve test lead connects to this point.  First, verify that the voltage across the zener diode (D5) is close to 10V, and that it doesn't get too hot.  D5 current should be about 30mA with the 68 ohm resistor shown, giving a dissipation of 290mW.  The zener will get quite warm - this is normal.  Once you have verified this, carefully adjust VR2 (VH) to get exactly 5.65V at TP1.  Then adjust VR3 (VL) to obtain exactly 4.42V at TP2.  These voltages may be adjusted to provide for modified cutout voltages if desired.

The settings are completely independent - adjusting one will not affect the other.  The divider circuit that sets the threshold voltages could have been simplified, but that would make the adjustments interdependent, so adjusting one would affect the other.  The method shown is far easier to deal with.


Remember - for this final step you are working with LIVE mains powered equipment.  Do not touch the multimeter, leads, or any part of the internal circuit!  Use plastic tools only!


Finally, connect multimeter +ve probe to TP3.  The mains should then be connected, and the voltage at TP3 measured.  It is set using VR1 to be exactly 5.00V with normal mains (at nominal value - 230V or 120V as appropriate).  I recommend that you disconnect the circuit from the mains to make any adjustment.  If you choose to work 'live', then use an insulated screwdriver to adjust VR1,2 and 3!  If you don't have one, use a sharpened plastic knitting needle, shaped so it will fit the adjustment screw.  If the mains voltage is high or low (for example you measure 235V), then use the following method to determine the correct voltage at TP3 (then TP4 & TP5 for 3-phase) ...

VSense = 5V at 230V
230 / 5 = 46
235 / 46 = 5.108 ... this is the voltage required at TP3 (5.11V is acceptable)

The calculation is exactly the same for 120V mains - simply substitute 120 for 230, and the measured mains voltage in place of the example 235V.  The same process is used if the mains is a little low.  If you get a silly answer, you made a mistake in the calculation - the final voltage you arrive at should be close to 5V depending on the mains voltage at the time.  As the mains varies, so does the voltage at TP3 (and TP4, TP5 if used) - this is how the circuit functions.  Because of the filter capacitors, the voltages (mains vs. rectifier) will not track perfectly - the rectified voltage will be delayed a little when the mains voltage changes.

When measuring your actual mains voltages, ideally use a true RMS voltmeter.  Using an 'ordinary' meter will give the wrong reading, but it will probably be close enough.  If you have two meters (highly recommended), use one to measure the mains, and the other to measure the voltage at the appropriate test point(s).  With 3-phase systems, the voltage on each phase will almost always differ slightly, so each needs to be measured and adjusted individually.  Whichever phase provides the clock signal is more heavily loaded than the others, and the trimpot will be set to a higher resistance than the others.


This is definitely not the simplest version you'll find on the Net, but it's easy to set up and will work very well, provided you take care with the adjustments.  If you use the transformer supply, it's also safe to work on and adjust with mains connected, so that's obviously my recommendation for most constructors.  The biggest difference between the circuits shown here and elsewhere, is that this unit can be easily wired for 3-phase use.

It could have been simplified, but as it stands it has the advantage of being very straightforward, and it's easy to see how everything works and what the various parts are meant to do.  Look around, and there are some circuits that purport to do what this does, but often miss the mark because they have been over-simplified.  They might be easier to build, but it's not worth it if you can't rely on the unit doing its job.  Beware of any that use CMOS gates for detection, and those that don't use a proper comparator circuit.

The 3-phase version is potentially lethal, and I cannot emphasise strongly enough the need for extreme caution.  You can use three separate transformers if you prefer, but that will increase both size and cost quite dramatically.  If you can get one (unlikely but theoretically possible), you could use a small 3-phase transformer, with one leg only providing the clock signal.  Only one regulator is needed, but the three phases all have to be rectified and smoothed for detection.  This has not been shown, but is simple enough to work out for yourself.  As already noted, don't even think about building a 3-phase version unless you are 100% confident in you ability to do so without killing yourself.


HomeMain Index ProjectsProjects Index
Copyright Notice.This article, including but not limited to all text and diagrams, is the intellectual property of Rod Elliott, and is © 2012.  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.
Page Created and Copyright © Rod Elliott 06 July 2012./ Updated Oct 2016 - added 3-phase version + linear supply.