IoT Electricity Monitoring
A real-time electricity monitoring platform connecting ESP32 embedded energy metering hardware to AWS IoT Core, time-series storage, and a live web dashboard.
PRODUCT & DOMAIN CONTEXT
Smart power monitoring enables commercial and residential facilities to track real-time voltage, current, active power, and cumulative kWh consumption. ESP32 microcontroller units measure electrical parameters via current sensors and transmit high-frequency telemetry over MQTT to a backend ingestion pipeline.
THE CORE ENGINEERING PROBLEM
High-frequency hardware sensor streams can easily overwhelm standard REST backends. The system needed an asynchronous message broker, efficient data ingestion and downsampling, threshold alert triggers, and real-time visualization APIs.
SYSTEM ARCHITECTURE MAP
Data Flow & Boundary Topology
ESP32 microcontrollers measure voltage and current, broadcasting JSON payloads via MQTT over TLS to AWS IoT Core. An ingestion worker validates packets, stores time-series data, and broadcasts live metrics to dashboard clients over WebSockets.
Hardware Current/Voltage Sensor
TLS MQTT Message Broker
Node.js MQTT Consumer
Aggregated Sensor Readings
Real-Time Energy Dashboard
Integration Boundaries & Protocols
SYSTEMS & SERVICES BUILT
Core Backend Modules & Responsibility
MQTT Telemetry Ingestion Service
Lightweight background service consuming hardware payloads, validating sensor ranges, and writing downsampled power metrics to the database.
Real-Time Power Usage Dashboard API
WebSocket and REST endpoints providing instant voltage/current updates and hourly/daily/monthly consumption aggregation.
Over-Current & Anomaly Threshold Alert Engine
Evaluates incoming telemetry packets against user-configured safety thresholds, dispatching real-time notifications on abnormal spikes.
Detailed Technical Responsibilities
- •Configured ESP32 firmware network protocols and MQTT message topic hierarchies for hardware telemetry transmission.
- •Engineered Node.js telemetry ingestion microservices connected to AWS IoT Core MQTT message broker.
- •Designed time-series data storage schemas in PostgreSQL optimized for rapid range queries and aggregated consumption reporting.
- •Built REST APIs and WebSocket streams delivering live power usage metrics to dashboard clients.
ENGINEERING DECISIONS & TRADE-OFFS
Architectural Choices & Rationale
Data Batching & Downsampling on Ingestion
Fine-grained per-sample granularity is reduced for steady-state power operations, which is acceptable for this monitoring workflow.
RELIABILITY & SAFETY MECHANISMS
- •Mutual TLS certificate authentication for hardware devices publishing to MQTT topics.
- •Hardware watchdog timers on ESP32 ensuring automatic reconnection upon network dropouts.
CHALLENGES & RESOLUTION
Sensor noise occasionally produced negative current values or NaN floats. Built validation middleware filtering out invalid readings before database insertion.
VERIFIED OUTCOMES
- •Connected hardware smart meters to cloud ingestion and dashboard infrastructure.
- •Delivered near-real-time sensor updates from the ingestion pipeline to dashboard clients.
NEXT SYSTEM IMPROVEMENTS
- •Incorporate TimescaleDB extension for native PostgreSQL time-series hypertable auto-partitioning.
Interested in discussing this architecture or an open backend role?
Reach out via email or review my full experience on my resume.