Mains Power Failure Detection

The objective of this project is to allow our Home Control System (HCS) to know if the mains power has failed, so that it can raise an alarm and act accordingly. The type of alarm raised will depend upon the alarm status and the house status. Our Home Control System (HCS) can only do this because we use a 12V dc uninterruptable power supply (UPS) to keep essential elements of our smart home going in the event of a power cut.

Warning: This project involves mains voltages and these can kill you.

Design

There are lots of ways to detect mains power and translate the presence or absence into a safe and meaningful level, to feed into an I/O board. Optical isolation is essential as you don't want to risk putting 240Vac onto a computer circuit board or yourself!

Since early 2010 we have been using a really simple solution to this problem by piggy-backing off of another project. Our 12V UPS project uses a mains PSU to provide a 16Vdc power source and we have taken a feed off of this supply and fed it into our optically-isolated input board, to detect both failure of the mains supply and failure of the UPS power supply unit. This has worked really well but it has one slight problem. The capacitors in the PSU keep the signal high for 5-6 seconds after the mains power has failed and this means we cannot detect loss of power for short periods of time.

neon bulb
In July 2014 we moved to a new system with much lower latency. We have the mains supply powering a neon lamp and this shines onto a Light Dependent Resistors (LDR). There is a ~10mm air gap between them providing a very high level of electrical isolation. The components are mounted inside a sealed enclosure, to ensure no external or ambient light gets in. There are numerous LDR devices with varying specifications. The ones we are using vary in resistance from about 150Ω in direct sunlight, to around 1.2MΩ in complete darkness.

Connection to the mains is achieved using an old power lead with the figure-8 plug cut off to expose the live and neutral wires. We use a terminal block to connect the cable ends to the neon bulb. It is best to add strain relief on the mains cable entry to the enclosure, to ensure it can't be pulled out by accident. The fuse in the cable plug has been replaced with a 1A fuse and it is simply plugged in to a suitable, local power socket.

Neon and LDRs

Our circuit to detect the variation in LDR resistance is really quite simple. We use two LDRs in parallel (which halves their resistance) to connect 12Vdc directly to an inputs on our optically isolated input board. These are mounted on a piece of conduit and the whole thing is enclosed in a black ABS plastic case. The case stops any ambient light having an effect and also covers all of the mains power connections, improving safety.

Optically isolated input board
Our tests show that with the mains power on (neon lamp on), approximately 3mA is supplied, enough to operate the ILQ74 input stage. With the mains power off (neon lamp off), the resistance of the LDRs is greater than 10MΩ and no current is supplied. This solution is very simple, reliable, uses minimal power and is extremely fast reacting.

This is the completed sensor in an ABS plastic case.

completed sensor

Summary

Our latest solution works really well and is extremely responsive. The newer design has excellent isolation from the mains power network and actually employs two layers of optical isolation (one in our input board).

When the mains power fails and is restored in our house, we get an audio announcement spoken out over the internal speakers and an SMS message is sent.

Further Reading

Share ...
We are on ...
Facebook Twitter
YouTube Flickr Follow us on Pinterest