Built to order

Mains Failure Alarm with Battery Backup and SMS Alert

This project builds a mains failure alarm that detects a power cut, switches to a 12 V battery backup, sounds a buzzer, lights an indicator, and sends an SMS alert through a SIM800L GSM module. Mains presence is sensed through an isolated step-down transformer and PC817 optocoupler, so no mains voltage ever reaches the Arduino controller. On mains return it sends a restoration SMS and returns to mains power. Suitable for B.E./B.Tech final-year projects in Electrical Engineering and Electronics.

Chat on WhatsApp — get a quotation

Electrical Arduino UnoArduino IDESIM800L GSM moduleRelay moduleStep-down transformerPC817 optocouplerAT commandsHardware
Mains Failure Alarm with Battery Backup and SMS Alert — project thumbnail preview
More project photos (2)

The problem

A mains failure alarm with battery backup and SMS alert is an Arduino-based monitor that watches the AC mains supply, and when the supply fails it raises a local buzzer and LED alarm and sends an SMS to configured phone numbers, all while running from a 12 V battery. Mains presence is sensed through a step-down transformer and a PC817 optocoupler, so the mains side and the controller share no copper connection. This project builds that alarm as a working prototype: an Arduino Uno reads the optocoupler output, drives a buzzer and indicators, and commands a SIM800L GSM module to send power-cut and restoration SMS alerts. Homes, shops and laboratories often learn about an outage only when someone walks in, by which time freezers, incubators and water pumps may have suffered. A buzzer alone helps only people in the room, so this build adds the SMS channel that reaches the owner anywhere with mobile coverage.

How it compares:
| Alarm type | Local alert | Remote alert | Works during a power cut |
| Plain buzzer alarm | Buzzer only | None | Only with its own battery |
| UPS or inverter | No alarm | None | Yes, powers the load |
| This project | Buzzer + LED | SMS alert | Yes, battery-backed alarm and SMS |

SYSTEM FLOW

6 components 5 connections

Live flow
Drag to explore
100%
powerAC Mains 230 V

The supply being watched for a power cut.

Follow the working sequence

How it works

The alarm works as a sense, decide, alarm and restore loop. A step-down transformer takes a small sample of the mains and a rectifier turns it into low-voltage DC that drives the input LED of a PC817 optocoupler; the optocoupler's phototransistor hands the Arduino a clean logic signal that simply says mains present or mains absent, with 5000 Vrms of optical isolation between the two sides. The Arduino watches that signal and, once it stays absent for the confirmation delay, declares a failure: it switches the relay to the 12 V battery, sounds the buzzer, lights the red LED, and orders the SIM800L to text the configured numbers. When the mains returns, the optocoupler signal goes high again, the unit sends a restoration SMS, switches back to mains power and resumes charging the battery.

  1. A step-down transformer samples the 230 V AC mains and a rectifier converts the secondary output to low-voltage DC for the sensing stage.
  2. The rectified signal drives the LED inside a PC817 optocoupler; its phototransistor passes a safe logic level to the Arduino, keeping the mains and the controller electrically separate.
  3. The Arduino reads the optocoupler output and applies a confirmation delay (design target approximately 2 seconds) so brief flicker does not count as a failure.
  4. On confirmed failure the relay switches the controller, buzzer, indicators and GSM module to the 12 V battery, the buzzer sounds and the red LED lights.
  5. The Arduino sends AT commands to the SIM800L, which texts a power-cut alert to the configured phone numbers.
  6. The green LED stays off and the red LED stays on while the mains is absent; the acknowledge button silences the buzzer without cancelling the alert state.
  7. When the mains returns, the optocoupler output goes high, the unit sends a restoration SMS, switches back to mains power and resumes battery charging.

Tech stack:

  • Arduino Uno (ATmega328P)
  • SIM800L GSM module
  • PC817 optocoupler · step-down transformer
  • 12 V sealed lead-acid battery
  • Relay module · buzzer · LED indicators
  • LM2596 buck converter (4.0 V GSM supply)
  • Arduino IDE (C/C++ firmware)
  • AT commands (SMS text mode)
Parameter Value
Controller Arduino Uno (ATmega328P, 16 MHz)
Mains input 230 V AC, 50 Hz (design input)
Mains sensing Step-down transformer + rectifier + PC817 optocoupler, isolation 5000 Vrms (datasheet)
GSM module SIM800L, quad-band 850/900/1800/1900 MHz (datasheet)
GSM supply 3.4–4.4 V, 4.0 V recommended, up to 2 A peak bursts (datasheet)
Backup battery 12 V, 1.3 Ah sealed lead-acid (design choice)
Backup runtime Approximately 6–10 hours at design load (expected, battery-dependent)
Detection delay Approximately 2 s confirmation delay (design target, configurable)
Alert outputs Buzzer + red fault LED + green mains LED
SMS recipients Up to 3 phone numbers (configurable in firmware)
SMS method Text-mode SMS via AT+CMGF and AT+CMGS commands
Operating use Indoor use, approximately 0–40 °C (expected)

Project features

This alarm combines four capabilities that a plain buzzer cannot offer: optically isolated mains sensing, battery-backed operation, an SMS alert that reaches the owner anywhere with mobile coverage, and a restoration message when power returns. The sensing stage uses a step-down transformer with a rectifier feeding a PC817 optocoupler, giving 5000 Vrms of isolation between the mains side and the controller. A 12 V sealed lead-acid battery takes over through a relay the instant the mains fails, so the buzzer, indicators and GSM module keep working through the outage. The SIM800L module sends a text alert to the configured numbers and repeats the process in reverse on restoration, while a confirmation delay in firmware stops brief flicker from triggering false alarms. The acknowledge button silences the buzzer without cancelling the alert, and every number in the design carries its source: datasheet values for the optocoupler and the GSM module, and design targets for detection delay and backup runtime.

  • [Optically isolated mains sensing] A small step-down transformer and rectifier feed a PC817 optocoupler, whose 5000 Vrms isolation (datasheet) means the mains side and the Arduino share no copper connection. The controller reads a safe low-voltage logic signal, never the mains itself.
  • [Automatic battery backup] On mains failure a relay switches the controller, buzzer, indicators and GSM module to a 12 V sealed lead-acid battery, so the alarm keeps working through the outage. A charger module keeps the battery topped up while the mains is present.
  • [SMS power-cut alert] The SIM800L GSM module sends a text message to up to 3 configurable phone numbers when the mains fails, using standard AT commands in text mode. The numbers are set in the firmware before delivery.
  • [Restoration SMS] When the mains returns, the unit sends a second SMS reporting that power is restored, then switches back to mains power. The owner therefore learns both ends of the outage without visiting the site.
  • [Local buzzer and LED alarm] A buzzer sounds and a red fault LED lights on failure, while a green LED shows healthy mains. An acknowledge push-button silences the buzzer while the LED and SMS alert stay active.
  • [False-alarm confirmation delay] Firmware waits for a configurable confirmation delay (design target approximately 2 seconds) before declaring a failure, so a momentary flicker does not trigger a buzzer or an SMS.
  • [Battery and GSM power design] The SIM800L runs from a dedicated buck converter set to 4.0 V, because the module needs 3.4–4.4 V and draws up to 2 A in transmit bursts (datasheet). Powering it from the Arduino 5 V pin causes resets, so the build gives it its own regulated supply with a bulk capacitor.

What is included

  • Working mains failure alarm prototype with battery backup
  • Arduino firmware source code with configurable phone numbers and delay
  • Circuit diagram and wiring documentation
  • Component list with part values
  • Test procedure: simulated mains cut, buzzer and LED check, SMS receipt check, restoration check
  • Project report covering isolation, power design and GSM alerting
  • PPT presentation for final review
  • Viva Q&A preparation document (optocoupler isolation, GSM power supply, relay switching)
  • Project abstract PDF

Timeline

  • Typical build timeline: approximately 2–3 weeks from order confirmation, including component sourcing, assembly, SMS-alert testing and documentation.

Support

  • Support includes setup guidance over WhatsApp, help with the SMS-alert test procedure, and corrections to the report and PPT for college-format requirements.

Limitations & prerequisites

  • This is an alarm, not a changeover switch or inverter: it reports a power cut and keeps itself running, but it does not supply power to appliances or switch loads.
  • The SIM800L is a 2G GSM module, so SMS alerts need 2G network coverage and an active SIM with SMS balance; no message is sent where there is no coverage.
  • SMS delivery time depends on the mobile network, and delivery cannot be guaranteed by the prototype.
  • The detection delay is a design target of approximately 2 seconds, so very brief flicker below the delay is intentionally ignored.
  • Backup runtime of approximately 6–10 hours is an expected value that depends on battery age, charge state and buzzer duty.
  • Mains-side wiring must be done with the supply isolated and by a competent person; this prototype is not a certified alarm panel and must not be presented as one.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes — for Electrical Engineering and Electronics students. It demonstrates optically isolated mains sensing, relay switching, battery backup design, GSM communication with AT commands and embedded firmware logic, all in one working prototype with a clear demonstration: cut the mains and the buzzer, LED and SMS all respond. The report explains the isolation, the relay switching and the GSM power design in viva-ready detail.

How does it sense the mains without connecting 230 V to the Arduino?

It never connects mains to the controller: a small step-down transformer takes a low-voltage sample of the mains, a rectifier turns it into DC, and a PC817 optocoupler passes the signal across as light, with 5000 Vrms of isolation (datasheet) so no copper path exists between the mains side and the Arduino. The isolation can be demonstrated on the bench with the two sides on separate supplies.

What exactly happens when the power goes out?

The buzzer sounds, the red fault LED lights, and the SIM800L sends a power-cut SMS to the configured numbers, all powered by the 12 V battery, while the green mains LED goes off and pressing the acknowledge button silences the buzzer without cancelling the alert state. The battery keeps the whole unit alive, so the alarm does not go silent at the moment it is needed most.

Does it need internet or Wi-Fi?

No — alerts travel as ordinary text messages over the 2G GSM network, so the unit needs only an active SIM card with SMS balance and mobile coverage at the installation site, with no cloud account, app or Wi-Fi configuration involved. That makes the unit usable in workshops, farms and small shops where Wi-Fi may not exist at all.

Can it switch on a generator or an inverter when power fails?

No — this project is a failure alarm, not a changeover switch or inverter: it detects the outage, raises a local alarm and notifies the owner by SMS, but it does not switch any load, and automatic changeover switching is a different project that can be discussed as a separate customization. Detection and notification only, which keeps the build safe to demonstrate in a college lab.

Can more phone numbers or a call alert be added?

Yes — the firmware holds up to 3 numbers as delivered, and more numbers can be added by editing the list in the code, while a voice-call alert instead of, or in addition to, the SMS is available as a customization since the SIM800L supports calls as well as text messages. The report documents the number list and the AT commands used for the viva.

Get this project: message Projectech on WhatsApp for a quotation — share your branch, the scope you need and your submission deadline, and the build is prepared to order with the prototype, firmware and documentation.

Components & software requirements
  • Arduino Uno (ATmega328P)
  • SIM800L GSM module
  • PC817 optocoupler · step-down transformer
  • 12 V sealed lead-acid battery
  • Relay module · buzzer · LED indicators
  • LM2596 buck converter (4.0 V GSM supply)
  • Arduino IDE (C/C++ firmware)
  • AT commands (SMS text mode)
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation