A smart meter with Blynk and ESP8266 lets you monitor your home’s real-time power consumption in India from your smartphone. Using the PZEM-004T energy monitoring module (accurate to 0.5%, supports Indian 230V 50Hz mains), this project gives you live wattage, monthly kWh consumption, MSEDCL/BESCOM bill estimates, and automatic alerts when usage exceeds your daily budget – all for under Rs 800 total build cost.
Table of Contents
- Why Monitor Home Power in India?
- PZEM-004T Energy Monitor: Specs and Wiring
- ESP8266 Firmware with PZEM Library
- Blynk IoT Dashboard Setup
- India Electricity Tariff Calculator in Firmware
- Bill Alerts and Daily Consumption Reports
- Home Assistant and InfluxDB Integration
- Frequently Asked Questions
Why Monitor Home Power in India?
India’s electricity tariffs are tiered and confusing – MSEDCL (Maharashtra), BESCOM (Karnataka), TPDDL (Delhi), and TANGEDCO (Tamil Nadu) all have different slab rates. Without a smart meter, most Indian households discover they have crossed into a higher slab only when the monthly bill arrives.
- MSEDCL residential rates (2025): 0-100 units Rs 1.53/unit, 101-300 units Rs 5.22/unit, 301-500 units Rs 9.31/unit, above 500 units Rs 10.59/unit
- BESCOM residential (2025): 0-30 units Rs 3.15/unit, 31-100 units Rs 5.65/unit, above 100 units Rs 7.10/unit
- Savings potential: Households using 350 units/month could save Rs 200-400 by shifting heavy loads (geyser, washing machine, AC) to avoid the highest slab
Recommended: UNO WiFi R3 (ATmega328P + ESP8266)
The UNO WiFi R3 with built-in ESP8266 combines perfectly with the PZEM-004T. The ATmega328P handles PZEM UART communication while the ESP8266 manages WiFi, Blynk cloud, and MQTT reporting simultaneously.
PZEM-004T Energy Monitor: Specs and Wiring
The PZEM-004T V3.0 (Rs 350-400 from Robu.in) measures voltage, current, power, energy, frequency, and power factor on Indian 230V 50Hz single-phase mains:
- Voltage range: 80-260V AC (covers Indian grid variations 180V-250V)
- Current: 0-100A (with split-core CT clamp, non-invasive installation)
- Power: 0-22,000W (handles any Indian home load)
- Communication: UART (3.3V TTL, 9600 baud)
- Accuracy: +-0.5% voltage, +-0.5% current, +-0.5% power
PZEM-004T V3 -> ESP8266 (NodeMCU)
VCC -> 5V (from USB or HLK-PM01)
GND -> GND
TX -> GPIO D7 (RX of SoftwareSerial)
RX -> GPIO D8 (TX of SoftwareSerial)
CT Clamp -> wraps around one mains live wire (non-destructive)
Do not cut mains wire. Simply pass one wire through CT clamp opening.
Safety: The PZEM-004T is NOT isolated from mains. The CT clamp is non-invasive (magnetic induction only), but the voltage input terminals connect directly to live and neutral. Ensure enclosure prevents contact with mains terminals.
ESP8266 Firmware with PZEM Library
#include <PZEM004Tv30.h>
#include <BlynkSimpleEsp8266.h>
SoftwareSerial pzemSerial(D7, D8); // RX, TX
PZEM004Tv30 pzem(pzemSerial);
BlynkTimer timer;
void sendPowerData() {
float voltage = pzem.voltage(); // Volts
float current = pzem.current(); // Amps
float power = pzem.power(); // Watts
float energy = pzem.energy(); // kWh (cumulative)
float freq = pzem.frequency(); // Hz (should be ~50 for India)
float pf = pzem.pf(); // Power Factor
if (isnan(voltage)) return; // sensor not ready
Blynk.virtualWrite(V1, voltage);
Blynk.virtualWrite(V2, current);
Blynk.virtualWrite(V3, power);
Blynk.virtualWrite(V4, energy);
Blynk.virtualWrite(V5, freq);
Blynk.virtualWrite(V6, pf);
// Calculate estimated bill
float monthlykWh = energy / getDaysIntoMonth() * 30;
float estimatedBill = calcMSEDCLBill(monthlykWh);
Blynk.virtualWrite(V7, estimatedBill);
// Alert if daily usage exceeds threshold
if (getDailyUsage() > 15.0) { // 15 kWh/day limit
Blynk.logEvent("high_usage", "Daily usage exceeds 15 kWh!");
}
}
void setup() {
Blynk.begin(BLYNK_AUTH, ssid, pass);
timer.setInterval(10000L, sendPowerData); // every 10 seconds
}
Blynk IoT Dashboard Setup
In the Blynk IoT console (blynk.cloud):
- Create a new Template: “Home Smart Meter” – device type ESP8266
- Add Datastreams: V1 (Voltage, V), V2 (Current, A), V3 (Power, W), V4 (Energy, kWh), V7 (Est. Bill, Rs)
- Create a Dashboard with: Gauge (live wattage), Chart (24h power trend), Value display (bill estimate), LED indicator (high usage alert)
- Add an Event: “high_usage” with Email/push notification
- Download the Blynk app (Android/iOS, free) and access your dashboard
Recommended: Mega WiFi R3 (ATmega2560 + ESP8266)
Scale your smart meter project across a 3-phase Indian home connection with the Mega WiFi R3. Use three PZEM-004T modules (one per phase) and report aggregate kWh and per-phase power factor.
India Electricity Tariff Calculator in Firmware
// MSEDCL Residential Slab (2025 rates)
float calcMSEDCLBill(float units) {
float bill = 0;
float fixedCharge = 135.0; // Fixed charge per month
if (units <= 100) {
bill = units * 1.53;
} else if (units <= 300) {
bill = 100 * 1.53 + (units - 100) * 5.22;
} else if (units <= 500) {
bill = 100 * 1.53 + 200 * 5.22 + (units - 300) * 9.31;
} else {
bill = 100 * 1.53 + 200 * 5.22 + 200 * 9.31 + (units - 500) * 10.59;
}
return bill + fixedCharge;
}
// Store utility in EEPROM for easy updates
// 0 = MSEDCL, 1 = BESCOM, 2 = TPDDL, 3 = TANGEDCO
int utility = EEPROM.read(0);
Bill Alerts and Daily Consumption Reports
Set up daily 8 AM IST consumption reports via Blynk’s automation feature:
// Blynk Automation (in console):
// Trigger: Time - every day at 08:00
// Action: Send email with template:
// "Good morning! Yesterday's consumption: {V4} kWh
// Estimated monthly bill: Rs {V7}
// Daily average this month: X kWh"
Add Telegram alerts for anomalies: if current power suddenly drops to 0W (supply cut) or spikes above 4000W (AC + geyser + iron running together, near the main fuse limit).
Home Assistant and InfluxDB Integration
For historical analysis and Grafana dashboards:
# configuration.yaml - MQTT sensors from ESP8266
mqtt:
sensor:
- name: Power Consumption
state_topic: home/power/data
value_template: "{{ value_json.power }}"
unit_of_measurement: W
device_class: power
- name: Daily Energy
state_topic: home/power/data
value_template: "{{ value_json.energy }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
HA’s Energy Dashboard (built-in since HA 2021.8) automatically calculates daily/monthly kWh costs when you configure your utility tariff. This gives you a professional energy monitoring dashboard without any extra setup.
Recommended: 12V 1-Channel Relay Module (RS485/Modbus)
Complete your energy monitoring system with load control. This relay module lets your smart meter data automatically trigger load-shedding decisions, such as switching off the water heater when consumption approaches the daily budget threshold.
Frequently Asked Questions
- Is the PZEM-004T accurate enough for DIY billing verification?
- Yes, at +-0.5% accuracy it is suitable for trend monitoring and anomaly detection, though not for official billing disputes. For comparison, commercial Indian sub-meters certified for billing are accurate to +-1%. The PZEM is better than most commercial sub-meters at this price point.
- Can I monitor a 3-phase connection?
- Yes, use three PZEM-004T modules (one per phase). Connect each CT clamp to one phase wire and each voltage input to the respective phase. Total 3-phase power = sum of three PZEM readings. Each PZEM has a configurable MODBUS address (0x01-0xF7) for multi-device on one UART bus.
- What happens to energy counter after ESP8266 power cycle?
- The PZEM-004T has internal non-volatile memory for energy accumulation. It retains the kWh count across power cycles independently of the ESP8266. Reset the PZEM counter on the 1st of each month via firmware: call pzem.resetEnergy() at midnight IST on the 1st.
- Can I detect which appliance is consuming power?
- Whole-home PZEM monitoring cannot identify individual appliances. For appliance-level monitoring, use separate PZEM modules per circuit or install smart plugs (Wipro SmartHome, Rs 800-1,200) on major appliances. Energy disaggregation algorithms exist but require training data and cloud compute.
- Does Blynk free plan support the needed virtual pins?
- Blynk free plan allows 2 devices and basic functionality. For 7 virtual pins plus events plus charts, you need Blynk Plus (US$4.99/month) or Blynk Pro. Alternatively, self-host Blynk Legacy on a free Oracle Cloud ARM instance and use it without any subscription fees.
Add comment