Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

Smart Power Strip: Monitor Each Socket with ESP32 India

Smart Power Strip: Monitor Each Socket with ESP32 India

March 11, 2026 /Posted byJayesh Jain / 0

Building a smart power strip to monitor each socket with ESP32 gives you granular control and real-time energy data for every appliance in your home. Unlike commercial smart plugs that monitor one device at a time, a DIY ESP32 smart power strip monitors 4-6 sockets simultaneously — tracking power consumption, setting per-socket schedules, and detecting abnormal energy draw. This is especially valuable in Indian homes where electricity tariffs are tiered and tracking individual appliance consumption can save thousands of rupees annually.

Table of Contents

  • Project Overview and Benefits
  • Required Components
  • High-Voltage Safety Guidelines
  • Circuit Design and Wiring
  • Energy Monitoring with PZEM-004T
  • ESP32 Firmware with MQTT
  • Home Assistant Dashboard
  • Frequently Asked Questions

Project Overview and Benefits

A 4-socket smart power strip with ESP32 offers:

  • Per-socket ON/OFF control via app or voice
  • Real-time power consumption per socket (watts, amps, voltage)
  • Energy usage history and daily/monthly kWh tracking
  • Overcurrent protection (software cutoff + hardware fuse)
  • Schedule-based automation
  • Home Assistant integration via MQTT or ESPHome

For Indian homes where peak-hour electricity rates are 2-3x higher (most state DISCOMs have time-of-use tariffs in 2026), knowing exactly which device consumes what power is invaluable.

Recommended: 8 Channel SSR Module (OMRON) — Solid State Relays are preferred for smart power strips over mechanical relays because they switch silently, have no contact wear, and handle the repeated switching cycles smart automation requires.

Required Components

  • ESP32 DevKit V1
  • 4x 5V relay modules (or 1x 4-channel relay board)
  • PZEM-004T V3.0 energy monitoring module (one per socket, or shared with multiplexing)
  • Hindalco or Finolex 6A extension board (as base – strip and reuse)
  • 4x 6A fuses + fuse holders
  • HiLink HLK-PM05 5V power supply module (for ESP32 power)
  • Metal or ABS project enclosure (larger than standard extension box)
  • Terminal blocks and appropriate 10A wire

Budget: Rs 1,500-2,500 for a 4-socket smart power strip.

High-Voltage Safety Guidelines

Working with 230V AC mains is dangerous and potentially fatal. Follow these guidelines strictly:

  • Always work with power disconnected from mains
  • Use properly insulated wire rated for 10A minimum
  • All mains-side connections must be inside a grounded metal or UL94 V0 rated plastic enclosure
  • Use proper 6A fuses on each outlet leg
  • Earth (ground) all metal enclosure surfaces
  • Keep low-voltage ESP32 circuitry optically isolated from mains side via relay
  • If unsure, hire a licensed electrician to verify your wiring before powering on

This project should only be attempted by those with prior electronics experience. Do not rush the assembly.

Circuit Design and Wiring

The circuit has two completely separate sections: the mains (230V) side and the control (5V/3.3V) side.

MAINS SIDE (230V AC - DANGER):
Input Live (L) -+- Fuse 1 - Relay 1 NO - Socket 1 Live
                +- Fuse 2 - Relay 2 NO - Socket 2 Live
                +- Fuse 3 - Relay 3 NO - Socket 3 Live
                +- Fuse 4 - Relay 4 NO - Socket 4 Live
Input Neutral (N) ---- All Socket Neutrals
Input Earth (E) ------ All Socket Earths + Enclosure

PZEM-004T: Insert CT (current transformer) clamp
around the Live wire AFTER the relay,
before the socket - one per monitored socket

CONTROL SIDE (5V/3.3V - SAFE):
HiLink HLK-PM05: Input = L+N mains, Output = 5V
5V -- ESP32 VIN
5V -- Relay module VCC (each relay)
ESP32 GPIO pins -- Relay IN pins:
  GPIO 16 -> Relay 1 (Socket 1)
  GPIO 17 -> Relay 2 (Socket 2)
  GPIO 18 -> Relay 3 (Socket 3)
  GPIO 19 -> Relay 4 (Socket 4)
ESP32 GPIO 16/17 (RX2/TX2) -> PZEM-004T RX/TX
Recommended: 5V Modbus RTU 4 Channel Relay Module — This pre-built 4-channel relay module with optocoupler isolation is perfect for the switching side of your smart power strip. The Modbus interface even allows direct PZEM integration on the same RS485 bus.

Energy Monitoring with PZEM-004T

The PZEM-004T V3.0 is a popular energy monitoring module widely available in India (Rs 400-600 each). It measures:

  • Voltage (80-260V AC, accuracy 0.5%)
  • Current (0-10A with built-in CT, 0-100A with external CT)
  • Power (0-2300W)
  • Energy (kWh accumulated)
  • Frequency (45-65 Hz)
  • Power factor
#include <PZEM004Tv30.h>

// PZEM on Serial2 of ESP32
PZEM004Tv30 pzem(Serial2, 16, 17); // RX, TX

float voltage = pzem.voltage();
float current = pzem.current();
float power = pzem.power();
float energy = pzem.energy(); // kWh
float frequency = pzem.frequency();
float pf = pzem.pf(); // Power factor

// Print readings
Serial.printf("Voltage: %.1f Vn", voltage);
Serial.printf("Current: %.3f An", current);
Serial.printf("Power: %.1f Wn", power);
Serial.printf("Energy: %.3f kWhn", energy);
Serial.printf("PF: %.2fn", pf);

ESP32 Firmware with MQTT

#include <WiFi.h>
#include <PubSubClient.h>
#include <PZEM004Tv30.h>
#include <ArduinoJson.h>

const char* ssid = "YOUR_WIFI";
const char* mqttServer = "192.168.30.100"; // Home Assistant IP
const int relayPins[] = {16, 17, 18, 19};
bool socketState[] = {false, false, false, false};

WiFiClient wifiClient;
PubSubClient mqtt(wifiClient);
PZEM004Tv30 pzem(Serial2, 25, 26);

void callback(char* topic, byte* payload, unsigned int length) {
  String msg = String((char*)payload, length);
  // Parse topic: smartstrip/socket/1/set
  String topicStr = String(topic);
  int socketNum = topicStr.charAt(20) - '1'; // 0-indexed
  
  if (socketNum >= 0 && socketNum < 4) {
    bool newState = (msg == "ON");
    digitalWrite(relayPins[socketNum], newState ? LOW : HIGH);
    socketState[socketNum] = newState;
    
    // Publish state
    String stateTopic = "smartstrip/socket/" + String(socketNum+1) + "/state";
    mqtt.publish(stateTopic.c_str(), newState ? "ON" : "OFF");
  }
}

void publishEnergy() {
  StaticJsonDocument<200> doc;
  doc["voltage"] = pzem.voltage();
  doc["current"] = pzem.current();
  doc["power"] = pzem.power();
  doc["energy"] = pzem.energy();
  doc["pf"] = pzem.pf();
  
  String output;
  serializeJson(doc, output);
  mqtt.publish("smartstrip/energy", output.c_str());
}

void setup() {
  for (int i = 0; i  10000) { // Every 10s
    publishEnergy();
    lastPub = millis();
  }
}

Home Assistant Dashboard

Add these to your configuration.yaml to create full smart power strip entities in Home Assistant:

mqtt:
  switch:
    - name: "Smart Strip Socket 1"
      command_topic: "smartstrip/socket/1/set"
      state_topic: "smartstrip/socket/1/state"
      icon: mdi:power-socket-in
      
  sensor:
    - name: "Strip Power"
      state_topic: "smartstrip/energy"
      value_template: "{{ value_json.power }}"
      unit_of_measurement: W
      device_class: power
    - name: "Strip Energy Today"
      state_topic: "smartstrip/energy"
      value_template: "{{ value_json.energy }}"
      unit_of_measurement: kWh
      device_class: energy
Recommended: ESP32 with OLED Display — Mount this ESP32+OLED module on the smart power strip enclosure. Display real-time total power consumption and individual socket states directly on the strip without needing to open an app.
Recommended: Waveshare 30-Ch Ethernet Relay Module — For commercial or office setups needing to monitor and control many outlets (6-30 sockets), this industrial Ethernet relay module with Modbus TCP provides the ideal backbone for a large smart power management system.

Frequently Asked Questions

Is it safe to build a mains-connected device at home?

It can be safe if you follow proper guidelines. Use quality components rated for 10A+, use proper insulation, include fuses on each outlet, and have a licensed electrician review your wiring before first power-on. If you are not comfortable with mains wiring, purchase a commercial smart power strip and use it alongside an ESP32 for monitoring only.

How accurate is PZEM-004T for electricity billing?

The PZEM-004T has a stated accuracy of 0.5% for voltage and 1% for power — sufficient for practical energy monitoring. It will not match your DISCOM smart meter exactly due to CT placement and calibration differences, but is accurate enough for tracking relative appliance consumption and identifying energy hogs.

Can I monitor surge protector power strip without opening it?

Not easily. The PZEM CT clamp must encircle the live wire after the relay. However, you can use a commercial smart plug (TP-Link Kasa, Shelly PM) on individual sockets for non-invasive monitoring, and integrate those with Home Assistant for energy tracking without any 230V DIY work.

What is the maximum load per socket?

Design your smart strip for 6A per socket (1,380W at 230V Indian mains). This covers most home appliances: laptop chargers (65-100W), phone chargers (20-65W), desk fans (30-75W), LED TVs (50-150W). Do not use it for high-load appliances like geysers, ACs, or induction cooktops – those need dedicated smart plugs with appropriate ratings.

Shop Home Automation at Zbotic –

Tags: ESP32 energy monitor, home assistant, power monitoring india, PZEM-004T, smart home, smart power strip
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Fruit Ripeness Detector: Near ...
blog fruit ripeness detector near infrared sensor for harvest 598309
blog waterproof connector for outdoor electronics ip67 options india 598318
Waterproof Connector for Outdo...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now