IoT-Based Energy Management System for Buildings with Real-Time Monitoring and Adaptive Efficiency
Multi-Channel Energy Monitoring with ESP32, Triple PZEM-004T Sensors, Overload Protection, and Firebase
Cloud Integration
Category: IoT, Embedded Systems, Energy Management, Smart Building
Tools & Technologies: ESP32, 3× PZEM-004T v3.0, 20x4 LCD Display (I2C), Relay Modules (Fan, Socket,
Light), Firebase Realtime Database, Arduino IDE
Status: Completed
Introduction
This project implements an IoT-enabled energy management system designed for buildings that monitors
energy consumption across multiple appliances and circuits. Using three independent PZEM-004T
sensors, the system tracks voltage, current, power, and energy consumption for separate devices—Fan,
Socket, and Light—providing granular visibility into where energy is being used. The system includes
adaptive efficiency controls with per-device overload detection, automatic relay disconnection for
protection, and Firebase cloud integration for comprehensive remote monitoring.
System Overview
Aim and Objectives
Aim:
Design and develop an IoT-based energy management system for buildings
that provides real-time multi-channel energy monitoring with adaptive efficiency and overload
protection.
Objectives:
- Monitor energy consumption across three independent circuits simultaneously using dedicated
PZEM-004T sensors.
- Implement per-device overload detection with automatic relay disconnection for safety.
- Display real-time energy metrics on a 20x4 LCD for local monitoring.
- Log all energy data to Firebase Realtime Database for remote access and analysis.
- Enable individual device control through relay switching for energy optimization.
- Provide configurable current and power thresholds for each monitored circuit.
Features & Deliverables
- Triple-Channel Monitoring: Three independent PZEM-004T sensors for simultaneous
monitoring of Fan, Socket, and Light circuits.
- Overload Protection: Per-device current and power thresholds with automatic
relay disconnection.
- Real-Time Display: 20x4 LCD shows live voltage, current, power, and energy for
each device.
- Cloud Integration: Firebase Realtime Database for remote monitoring and data
logging.
- Individual Device Control: Relay-based switching for independent control of
each circuit.
- Adaptive Efficiency: Intelligent load management to optimize energy usage
across the building.
- WiFi Connectivity: ESP32 provides wireless communication for cloud data
synchronization.
Process / Methodology
Hardware Assembly
Components: ESP32, 3× PZEM-004T v3.0, 20x4 LCD Display (I2C), 3× Relay Modules, LED Indicators,
Buzzer, Jumper Wires, Power Supply.
- Configured three PZEM-004T sensors with individual serial addresses for multi-channel
monitoring.
- Connected relay modules for independent control of Fan, Socket, and Light circuits.
- Integrated 20x4 LCD via I2C for compact local display.
Software Development
- Developed firmware in Arduino IDE with multi-sensor data acquisition on separate serial
channels.
- Implemented per-device overload detection with configurable current and power thresholds.
- Programmed automatic relay disconnection upon overload conditions.
- Integrated WiFi connectivity and Firebase Realtime Database for cloud data logging.
Testing & Calibration
- Tested each PZEM channel independently for accurate readings.
- Validated overload protection by simulating excessive current draw on each circuit.
- Verified Firebase data synchronization for real-time remote access.
Challenges & Solutions
- Challenge: Addressing multiple PZEM-004T sensors on the same ESP32.
Solution: Configured unique serial addresses for each sensor and used separate
software serial instances.
- Challenge: Maintaining accurate readings across all three channels
simultaneously.
Solution: Implemented sequential polling with appropriate timing intervals to
avoid data collision.
- Challenge: LCD display space for three devices' data.
Solution: Implemented rotating display screens that cycle through each device's
metrics.
Results & Impact
- Granular Monitoring: Achieved independent energy tracking for three circuits
with high accuracy.
- Safety: Overload protection successfully disconnected devices within
milliseconds of threshold breach.
- Energy Savings: Detailed per-device data enabled identification of energy waste
patterns.
- Remote Access: Firebase dashboard provided comprehensive building energy
overview from any location.
Future Enhancements
- Expand to support more circuits for whole-building energy mapping.
- Add scheduling functionality for automated device control based on time or occupancy.
- Implement energy cost calculation and billing estimation features.
- Develop a dedicated mobile app for real-time alerts and control.
Demonstration / Access
- GitHub Repository: Coming
soon
- Live Demonstration Video: Coming
soon