Home Energy Monitoring System with Automatic Generator Control
Smart Power Management with ESP32, PZEM-004T, GSM Alerts, and Firebase Cloud Monitoring
Category: IoT, Embedded Systems, Energy Monitoring, Automation
Tools & Technologies: ESP32, PZEM-004T v3.0, SIM800L GSM Module, MCP9808 Temperature Sensor, 20x4 LCD
Display, Relay Modules, Fuel Level Sensor, Firebase Realtime Database, Arduino IDE
Status: Completed
Introduction
This project addresses the challenge of uninterrupted power supply management in residential
settings. The system automatically monitors grid power availability and seamlessly switches to a
backup diesel generator when the grid fails. It integrates real-time energy monitoring via the
PZEM-004T sensor, fuel level tracking, temperature monitoring, and GSM-based SMS notifications for
critical events such as low fuel warnings and generator faults. All data is logged to Firebase for
remote monitoring through a web dashboard.
System Overview
Aim and Objectives
Aim:
Design and develop a smart home energy monitoring system with automatic
generator control for seamless power supply management.
Objectives:
- Monitor real-time electrical parameters (voltage, current, power, energy, frequency, power
factor) using PZEM-004T.
- Detect grid power failure and automatically start the backup generator.
- Track fuel level and send SMS alerts when fuel is low or insufficient.
- Monitor generator temperature for overheat protection.
- Log all data to Firebase Realtime Database for remote monitoring.
- Support both Automatic and Manual operating modes.
Features & Deliverables
- Automatic Generator Control: Detects grid failure and starts the generator
automatically with starter motor relay control.
- Real-Time Energy Monitoring: Tracks voltage, current, power, energy, frequency,
and power factor via PZEM-004T.
- Fuel Level Monitoring: Analog fuel sensor tracks diesel level with low-fuel and
insufficient-fuel alerts.
- Temperature Monitoring: MCP9808 sensor monitors generator temperature to
prevent overheating.
- SMS Notifications: SIM800L GSM module sends critical alerts for low fuel,
generator faults, and status updates.
- Cloud Dashboard: Firebase Realtime Database enables remote monitoring through a
web interface.
- LCD Display: 20x4 LCD provides local real-time status display.
- Dual Mode Operation: Supports Automatic and Manual switching modes.
Process / Methodology
Hardware Assembly
Components: ESP32, PZEM-004T v3.0, SIM800L GSM, MCP9808 Temperature Sensor, 20x4 LCD (I2C), Relay
Modules (Generator ON/OFF, Starter Motor), Fuel Level Sensor, LED Indicators, Buzzer.
- Assembled and integrated all sensors with the ESP32 microcontroller.
- Configured relay circuits for generator starter motor and main power switching.
- Connected grid input and generator output voltage sensing circuits.
Software Development
- Developed firmware in Arduino IDE with WiFi connectivity and Firebase integration.
- Implemented automatic grid failure detection and generator startup sequence.
- Programmed fuel level monitoring with configurable threshold alerts.
- Integrated SIM800L GSM module for SMS notification system.
Testing & Calibration
- Tested grid-to-generator switchover timing and reliability.
- Calibrated fuel level sensor readings for accurate percentage display.
- Validated SMS delivery for all critical alert scenarios.
Challenges & Solutions
- Challenge: Reliable grid failure detection without false triggers.
Solution: Implemented voltage threshold monitoring with debounce timing to
avoid false positives from momentary fluctuations.
- Challenge: Generator startup sequencing with proper relay timing.
Solution: Programmed sequential relay activation with appropriate delays for
fuel pump priming and starter motor engagement.
- Challenge: GSM module power requirements causing system instability.
Solution: Used dedicated power regulation for the SIM800L module with adequate
capacitor filtering.
Results & Impact
- Seamless Switchover: Achieved reliable automatic switching between grid and
generator power.
- Real-Time Alerts: SMS notifications delivered within seconds of critical
events.
- Remote Monitoring: Firebase dashboard provided comprehensive real-time system
status.
- Energy Awareness: Detailed energy consumption data helped optimize power usage
patterns.
Future Enhancements
- Add mobile app for remote generator control and monitoring.
- Integrate solar panel input as a third power source option.
- Implement predictive maintenance alerts based on generator runtime hours.
- Add historical energy consumption analytics and cost estimation.
Demonstration / Access
- GitHub Repository: Coming
soon
- Live Demonstration Video: Coming
soon