blackcout alert circuit

Intelligent Blackout Notifier

The intelligent blackout notifier is a mains supply monitoring device that will trigger a distinct alarm when the mains supply cuts off. The system, based on a tiny microcontroller module and a handful of other discrete components, has been designed to provide a simple plug-and-play setup that requires no special installation and no intervention in the existing electric wiring. The portable system is ideal for temporary or permanent installation in any desired loaction as it runs happily on a 9-V battery supply.

System Description

The circuit consists of an ac 230-V electromagnetic relay which is, in fact, a typical 12-V electromagnetic relay driven by the AC 230-V input through a 12-V low-current capacitive power supply unit. The relay (RL1) used here is a Single-Pole Double-Throw (SPDT) type where the common (P) contact is connected to the positive terminal (+9 V) of the battery (BAT). This common contact is attached to the normally closed (O) contact if the relay is not in energized condition. Once energized, the common contact is moved to the normally open (S) contact.

The next part of the circuit is a Digispark Attiny85 module configured to work as an alarm generator with the help of a simple code. The first pulse-width modulated (PWM) output (P0/D0) of the uC module is used here to drive the 12.5-mm passive (not self-drive) piezo-buzzer (PZ1). As can be seen from the circuit diagram, +9 V from the battery is routed to the Digispark module through an on-off-on rocker switch (S1). This special switch allows two modes of operation. If the switch is in “failure” position, the system works as a mains failure alarm, and if it is in “resumption” position, you can use the system as a mains resumption alarm.

System Function

Assume that the system is connected to an ac 230-V outlet and that the selector is in “failure” position. Since the relay is energized now, +9-V supply will not be available to the alarm section and, hence, it remains in silent state. When the mains supply fails, the alarm gets +9 V through the relay contacts. As a result, (after an initial delay of 5 seconds) the buzzer quickly beeps three times, and after a six-second silence, it continues beeping but with a different alarm pattern. To stop the alarm, you can either flip the selector to the “off” or “resumption” position. If “resumption” mode is selected, the alarm wakes up again when the ac mains supply resumes. After this, you can again move the selector to “off” or “failure” mode, according to your own liking. You might be wondering why I used a microcontroller as the alarm generator. Just note that any circuit based on a microcontroller would give you far more options down the road!

Circuit Diagram

blackcout alert circuit


uC Code

void setup() {
    pinMode(0, OUTPUT);

void loop() {

void beep(unsigned char delayms) {
    analogWrite(0, 60);
    analogWrite(0, 0);

Construction Guide

You can use a 6”x4” plastic enclosure plugs directly into the mains outlet. Ready-to-print front panel design for such an enclosure is also included here. Since the Digispark board have an onboard power indicator, remember to fit the module aright so that it can deliver the light output unimpeded to the external world through the window on front panel. Finally, ensure that all parts of the internal circuitry are completely insulated and cannot be accidentally handled. It is important to ensure that any similar enclosure used for this project provides adequate insulation, mains voltage is lethal!
Black_Alert_Prototype_Front Panel

Lab Notes

  • Prototype was tested with a 12V/600R SPDT sugar-cube relay
  • Oscilloscope capture of the unloaded pwm output from P0/D0 is shown below
  • For more details about Digispark module, refer “usb xmas candle” project published recently in this website


No Comments

Join the conversation!

Error! Please fill all fields.
Looking for the latest from TI?