Smart energy meter for a hostel room or shop
Bills arrive once a month, so people cannot see which appliance wastes power. A meter that shows live watts and units used, and the cost in rupees at the local tariff, makes savings visible.
- Parts
- ₹2,875
- Build
- 14 weeks
- Board
- ESP32
- Objectives
- 6
Block diagram
- PZEM-004T moduleMeasures voltage, current, power and energy safely
- ESP32Reads the meter and works out cost
- OLED displayShows watts, units and rupees
- RelayCuts a load above a limit
- Cloud dashboardStores readings, plots trends and sends alerts+
- Data loggerStores timestamped readings for analysis+
Objectives
- To measure voltage, current, power, power factor and energy of a single-phase load.
- To show the cost in rupees using the local tariff slabs.
- To compare the readings with the electricity board meter over a week (error below 2%).
- To cut supply to a load above a set power (up to 2 kW with the 10 A relay).
- To publish readings over MQTT and show them on a live dashboard with threshold alerts.
- To log timestamped data and analyse it to support the conclusions with evidence.
Parts and specifications
- ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)₹450Buy
- PZEM-004T v3 with CT coil80 to 260 V, 0 to 100 A with split CT, V, I, P, energy, PF and frequency over Modbus-RTU UART, isolated₹900Buy
- 5 V relay module (1 channel)10 A 250 V AC contacts, coil 70 to 80 mA, optocoupled input; many trigger at 3.3 V, check yours₹70Buy
- Enclosed switchboard box, sockets and 6 A MCB₹450
- 5 V USB charger for the ESP32₹150
- DS3231 RTC moduleTemperature-compensated, ±2 ppm (about 1 minute a year), I²C 0x68, CR2032 backup₹150Buy
Total about ₹2,875 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
P = V × I × PF. 230 V × 4.2 A × 0.9 = 869 W.
Energy (kWh) = P × hours / 1000. 869 W for 5 hours = 4.35 units.
Example tariff: ₹3 for the first 100 units, ₹4.50 for 101 to 200. 150 units cost 100 × 3 + 50 × 4.5 = ₹525, plus fixed charge.
The relay contacts are rated 10 A, so the cut-off must stay below 230 × 8 = 1840 W, about 80% of rating.
Pin map
| Signal | Pin or connection |
|---|---|
| PZEM TX → ESP32 RX2 | GPIO 16 |
| PZEM RX ← ESP32 TX2 | GPIO 17 |
| PZEM VCC | 5 V (module TTL side is isolated) |
| OLED SDA / SCL | GPIO 21 / 22 |
| Relay IN | GPIO 26 |
Firmware outline
- Poll the PZEM over Modbus-RTU every 1 s: voltage, current, power, energy, frequency and PF.
- Keep today's and this month's units in flash, saved every 10 minutes.
- Work out the bill with the slab table stored in code.
- If power stays above the set limit for 5 s, open the relay and show why.
- Show live watts, units today and rupees on the OLED; serve a web page with the same.
Test plan
| Test | Expected result |
|---|---|
| 100 W bulb | About 100 W, PF near 1.0 |
| CFL or phone charger | PF well below 1 (reactive and non-linear load) |
| One week against the board meter | Difference below 2% |
| Load above the limit | Relay opens within 5 s |
| Power cut and restart | Energy total kept |
These rows start your results table when you plan the project.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 6.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
Build these first
Datasheets and sources to cite
- Peacefair PZEM-004T v3 manual
- IS 13779 (AC static watthour meters)
- Your state electricity regulatory commission tariff order
About this project
How much does the smart energy meter for a hostel room or shop project cost?
About ₹2,265 for the parts in the base list: ESP32 DevKit V1, PZEM-004T v3 with CT coil, 0.96 inch OLED (SSD1306, I²C), 5 V relay module (1 channel), 5 A glass fuse with holder, Enclosed switchboard box, sockets and 6 A MCB, 5 V USB charger for the ESP32.
How long does it take?
About 10 weeks for the base project, built on an ESP32. Each upgrade adds time.
Which branches is it suitable for?
Electrical and Electronics, Electronics and Communication, Instrumentation, as a mini or major project.
Which pins and design calculations does it use?
PZEM TX → ESP32 RX2 on GPIO 16; PZEM RX ← ESP32 TX2 on GPIO 17; PZEM VCC on 5 V (module TTL side is isolated). Worked calculations on this page: real power, energy and units, cost with slabs, relay limit.
How do I test it?
100 W bulb: About 100 W, PF near 1.0. CFL or phone charger: PF well below 1 (reactive and non-linear load). One week against the board meter: Difference below 2%. Load above the limit: Relay opens within 5 s. Power cut and restart: Energy total kept.
What are the objectives?
To measure voltage, current, power, power factor and energy of a single-phase load. To show the cost in rupees using the local tariff slabs. To compare the readings with the electricity board meter over a week (error below 2%). To cut supply to a load above a set power (up to 2 kW with the 10 A relay).
