⚡ Introduction
Electricity bills are increasing rapidly. Most users do not know:
- Real-time power consumption
- Appliance load impact
- Estimated bill before month-end
- Overload risk
Traditional meters only show total units consumed.
To solve this, we developed:
🔥 Smart Electricity Bill Saver & Real-Time Power Monitor
An IoT-based energy monitoring system that tracks real-time voltage, current, power, energy (kWh), and calculates estimated electricity bill instantly.
🔥 Problem Statement
❌ No real-time monitoring
❌ Unexpected high bills
❌ No overload alert
❌ No energy analytics
Energy waste continues silently.
💡 Solution Overview
✔ Real-time Voltage Monitoring
✔ Real-time Current Monitoring
✔ Power (Watt) Calculation
✔ Energy (kWh) Tracking
✔ Live Bill Estimation
✔ Overload Protection
✔ MQTT Cloud Monitoring
✔ Optional Relay Load Cut
🧰 Required Hardware
1️⃣ ESP32 Development Board




Role:
- WiFi communication
- Data processing
- IoT connectivity
2️⃣ PZEM-004T v3.0 Energy Monitor




Role:
- Voltage measurement
- Current measurement
- Power calculation
- Energy tracking
3️⃣ 5V SMPS Power Supply




Provides stable power to ESP32.
4️⃣ Optional Relay Module


Used for overload-based automatic power cut.
🔌 Circuit Diagram




🔗 Complete Wiring Details
ESP32 ↔ PZEM
| ESP32 Pin | PZEM Pin |
|---|---|
| GPIO17 | RX |
| GPIO16 | TX |
| 5V | VCC |
| GND | GND |
CT Coil
Install on AC phase wire only.
Optional Relay
GPIO4 → IN
5V → VCC
GND → GND
⚠ Follow proper AC safety precautions.
🧠 Software Used
- Arduino IDE
- MQTT Broker (HiveMQ / Mosquitto)
- ESP32 Core
- PZEM004Tv30 Library
- PubSubClient Library
💻 Complete ESP32 Code
#include <WiFi.h>
#include <PubSubClient.h>
#include <PZEM004Tv30.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
const char* mqtt_server = "broker.hivemq.com";
#define RELAY_PIN 4
#define PZEM_RX 16
#define PZEM_TX 17
float overloadCurrent = 10.0;
float electricityRate = 6.0;
WiFiClient espClient;
PubSubClient client(espClient);
HardwareSerial pzemSerial(2);
PZEM004Tv30 pzem(pzemSerial, PZEM_RX, PZEM_TX);
void setup_wifi() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
void reconnect() {
while (!client.connected()) {
client.connect("PowerMonitorClient");
}
}
void setup() {
Serial.begin(115200);
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW);
setup_wifi();
client.setServer(mqtt_server, 1883);
}
void loop() {
if (!client.connected()) reconnect();
client.loop();
float voltage = pzem.voltage();
float current = pzem.current();
float power = pzem.power();
float energy = pzem.energy();
float bill = energy * electricityRate;
Serial.print("Voltage: "); Serial.println(voltage);
Serial.print("Current: "); Serial.println(current);
Serial.print("Power: "); Serial.println(power);
Serial.print("Energy: "); Serial.println(energy);
Serial.print("Estimated Bill: "); Serial.println(bill);
if(current > overloadCurrent){
digitalWrite(RELAY_PIN, HIGH);
Serial.println("Overload Detected - Power Cut");
}
delay(3000);
}
⚙️ Working Logic
- Read Voltage
- Read Current
- Calculate Power
- Read Energy (kWh)
- Calculate Estimated Bill
- Detect Overload
- Publish to MQTT
🏠 Applications
- Homes
- Shops
- Offices
- Solar systems
- Energy audit projects
💼 Business Opportunity
✔ Smart home product
✔ IoT commercial device
✔ Energy audit service
✔ Rental property monitoring
📞 Project Support
For complete source code, dashboard, PCB, ready device:
📲 WhatsApp: +91 7052722734
🏁 Conclusion
This system helps:
✔ Reduce electricity bills
✔ Monitor real-time usage
✔ Prevent overload
✔ Improve energy efficiency
A scalable IoT-based energy management solution by Yarana IoT Guru.
📞 Contact YaranaIoT Guru Empowering IoT Innovation | ESP32 | Home Automation | Smart Solutions | 50K+ Community
We’d love to hear from you! Whether it’s IoT project queries, collaborations, tech support, custom PCB design, bulk orders, corporate training, college workshops, or freelance development — we’re just one message away.
✉️ Email (Official)
For detailed inquiries, project support, business collaboration, sponsorships, or documentation: 📩 contact@yaranaiotguru.in 📧 Alternate: support@yaranaiotguru.in ⏳ Response: Within 24 hours (Mon–Sat) 💡 Best for attachments (code, schematics, logs, etc.)
📱 Phone / WhatsApp (24×7 Support)
Instant live help, troubleshooting, project consultation, or order updates: 📞 +91 70527 22734 💬 WhatsApp: Chat Now ⏰ Call Hours: Mon–Sat, 10 AM – 7 PM IST 🚀 Emergency? WhatsApp anytime — reply within 1 hour
▶️ YouTube Channel
Step-by-step IoT builds, live coding, ESP32, Blynk, Node-RED, MQTT, Home Assistant & more: 🔗 Yarana IoT Guru 📺 1,200+ Videos | 52K+ Subs | 5.5M+ Views | 4.8★ Rating 🎥 New Video Every Week — 🔔 Subscribe & Turn On Notifications
🛠 GitHub (100% Open Source)
All codes, Arduino sketches, PlatformIO projects, Node-RED flows, MQTT configs & docs: 🔗 github.com/YaranaIotGuru ⭐ 50+ Repos | 10K+ Stars & Forks
🔥 Top Projects:
- ESP32 WebSocket Real-Time Dashboard
- Smart Home with Blynk & Alexa
- IoT Irrigation System with Soil Moisture
- MQTT + Node-RED + MySQL Logging
- OLED Weather Station with API
Daily reels, quick tips, live builds, student showcases & giveaways: 🔗 @YaranaIoTGuru 📱 10K+ Followers | Reels | Stories | Live Sessions
💼 LinkedIn (Professional Network)
B2B, IoT consulting, training, hiring & partnerships: 🔗 Yarana IoT Guru
🤝 Services Offered:
- Custom IoT Product Development
- Embedded Systems Training
- College Workshops & FDPs
- PCB Design & Prototyping
🐦 Twitter / X
Real-time updates, polls, project launches & community Q&A: 🔗 @YaranaIoTGuru 📢 Follow for instant alerts
🛠 Hackster.io (Project Showcases)
In-depth write-ups, circuits, BOM, code & ratings: 🔗 hackster.io/yaranaiotguru 🏆 50+ Projects | 100K+ Views | Top 5% Creator
🌟 Community Platforms
| Platform | Link | Purpose |
|---|---|---|
| Telegram Channel | t.me/YaranaIoTGuru | Project files, PDFs, updates |
| Telegram Group | t.me/YaranaIoTCommunity | Peer support, doubts |
| Discord Server | discord.gg/yarana-iot | Live voice help, coding rooms |
| WhatsApp Community | Join Here | Announcements & polls |
🏢 Office & Studio Address
Yarana Studio & Software (Yarana IoT Guru HQ) 📍 Near Rookh Baba Mandir, Umariya Badal Urf Gainda, Allahabad (Prayagraj), Uttar Pradesh – 212507, India ⭐ Google Rating: 5.0 ★ (100+ Reviews)
🕒 Opening Hours: Mon–Sat: 10:00 AM – 5:00 PM Sunday: Closed
🌐 Associated Website: yaranawebtech.i