Skip to content
This repository was archived by the owner on Feb 22, 2026. It is now read-only.
upayanmazumderPublic archive

About

An intelligent IoT-based energy monitoring solution combining hardware sensors, real-time data processing, and machine learning for device-level energy consumption analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

Repository files navigation

SpectraWatt

Real-Time Energy Monitoring & Non-Intrusive Load Monitoring System

License API Status Documentation

An intelligent IoT-based energy monitoring solution combining hardware sensors, real-time data processing, and machine learning for device-level energy consumption analysis.

Live Demo • Documentation • Presentation • Design


Table of Contents


Overview

SpectraWatt is an advanced energy monitoring ecosystem that leverages Internet of Things (IoT) technology, cloud computing, and machine learning to provide real-time insights into electrical energy consumption. The system enables users to monitor individual appliance usage, detect anomalies, and optimize energy consumption through an intuitive web dashboard.

Core Capabilities

  • Real-Time Monitoring: Track voltage, current, power, and energy consumption with sub-second latency
  • Device Classification: AI-powered Non-Intrusive Load Monitoring (NILM) identifies individual appliances
  • Historical Analytics: Comprehensive data storage and visualization of consumption patterns
  • Scalable Architecture: Containerized microservices deployable on cloud infrastructure
  • Cross-Platform Access: Responsive web interface accessible from any device

Key Features

Hardware Integration

  • ESP32-based energy monitoring using EmonLib
  • Current transformers for non-invasive current measurement
  • Real-time voltage and current RMS calculations
  • Batched data transmission with configurable sampling rates

Backend Services

  • RESTful API built with Go (Golang) for high-performance data ingestion
  • MongoDB persistence layer for reliable time-series data storage
  • Device-specific data retrieval and aggregation
  • Health monitoring and automatic indexing
  • CORS-enabled for web client integration

Machine Learning Pipeline

  • LSTM Neural Networks for appliance fingerprinting
  • Event-based NILM with delta power analysis
  • Clustering algorithms for unsupervised device detection
  • Live classification with windowed feature extraction

Frontend Dashboard

  • Next.js-powered responsive web application
  • Real-time energy usage visualization
  • Active device monitoring
  • Cost estimation and analytics
  • Particle effects and modern UI/UX design

System Architecture

┌─────────────────────────────────────────────────────────────┐
│                        SpectraWatt                           │
└─────────────────────────────────────────────────────────────┘
        │
        ├─── Hardware Layer
        │    └── ESP32 + Current Transformer + EmonLib
        │        └── WiFi → HTTPS
        │
        ├─── Backend Layer (Go API)
        │    ├── REST Endpoints (/api/data, /health)
        │    ├── MongoDB Persistence
        │    └── Deployed: api.spectrawatt.upayan.dev
        │
        ├─── ML Layer (Python + PyTorch)
        │    ├── NILM Event Detection
        │    ├── LSTM Device Classification
        │    ├── K-Means Clustering
        │    └── Live Monitoring Service
        │
        └─── Frontend Layer (Next.js)
             ├── Real-time Dashboard
             ├── Device Monitoring
             └── Energy Analytics

Infrastructure:

  • Kubernetes orchestration (manifests in /k8s)
  • Docker containerization for all services
  • MongoDB Atlas for production database
  • HTTPS/TLS encryption for data transmission

Project Gallery

Hardware Setup

Breadboard Connections 1
Breadboard Setup - Front View
Breadboard Connections 2
Breadboard Setup - Wiring Detail
Electronics
Complete Electronics Assembly

ESP32 Microcontroller

ESP-32 Bottom View
ESP32 Development Board
Testing Setup
Testing Environment

Dashboard Interface

SpectraWatt Dashboard Live Dashboard - Real-time energy monitoring interface

Team

Team IoTeehee
Team IoTeehee
Team ID Cards
Project Credentials

Technology Stack

Hardware

  • Microcontroller: ESP32 (WiFi-enabled)
  • Sensors: Current Transformer (CT), Voltage Divider
  • Library: EmonLib (Energy Monitoring)
  • Communication: WiFi, HTTPS

Backend

  • Language: Go 1.21+
  • Framework: Gorilla Mux
  • Database: MongoDB 7.0
  • Container: Docker, Docker Compose
  • Deployment: Kubernetes, Systemd

Machine Learning

  • Framework: PyTorch
  • Models: LSTM, K-Means
  • Libraries: NumPy, Pandas, scikit-learn
  • API: FastAPI (for ML predictions)

Frontend

  • Framework: Next.js 15 (React 19)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • HTTP Client: Axios
  • Fonts: Montserrat (Google Fonts)

DevOps

  • Containerization: Docker
  • Orchestration: Kubernetes
  • CI/CD: GitHub Actions (implied by container registry)
  • Version Control: Git, GitHub

Components

1. ESP32 Firmware (/esp-32)

Energy monitoring firmware that:

  • Reads voltage and current using EmonLib
  • Calculates power and cumulative energy (Wh)
  • Batches readings for efficient transmission
  • Sends HTTPS POST requests to backend API
  • Integrates with Blynk for remote monitoring

Key Files:

2. Backend API (/api)

High-performance Go-based REST API:

  • Receives energy data from ESP32 devices
  • Stores time-series data in MongoDB
  • Provides endpoints for data retrieval and aggregation
  • Implements health checks and monitoring
  • Deployed at api.spectrawatt.upayan.dev

Docker Image: ghcr.io/upayanmazumder/spectrawatt/api

Key Files:

3. Machine Learning Engine (/ml)

PyTorch-based NILM system:

  • Training: LSTM network for device classification
  • Prediction: Real-time appliance identification
  • Live Monitoring: Continuous classification loop
  • API Service: FastAPI endpoint for predictions

Docker Image: ghcr.io/upayanmazumder/spectrawatt/ml

Key Files:

4. Event-Based NILM (/AI_ML/NILM-Event-Based)

Advanced analytics pipeline:

  • Event detection from power deltas
  • Clustering for unsupervised device discovery
  • Energy consumption calculation per device
  • Label assignment and state tracking

Key Files:

5. Frontend Dashboard (/app)

Modern Next.js web application:

  • Real-time energy monitoring dashboard
  • Live device status display
  • Historical data visualization
  • Responsive design for mobile and desktop

Docker Image: ghcr.io/upayanmazumder/spectrawatt/app

Key Files:

6. Kubernetes Deployment (/k8s)

Production-ready Kubernetes manifests:

  • API deployment with secrets and service
  • ML service deployment
  • Ingress configuration with TLS
  • Namespace isolation

Key Files:


Getting Started

Prerequisites

  • Hardware: ESP32, Current Transformer, resistors, breadboard
  • Software:
    • Go 1.21+ (for API)
    • Python 3.9+ (for ML)
    • Node.js 18+ & pnpm (for frontend)
    • Docker & Docker Compose (recommended)
    • MongoDB 7.0+ (or use Docker)

Quick Setup with Docker

  1. Clone the repository:

    git clone https://github.com/upayanmazumder/spectrawatt.git
    cd spectrawatt
  2. Start the backend API:

    cd api
    docker-compose up -d

    API will be available at http://localhost:8080

  3. Start the ML service:

    cd ../ml
    docker-compose up -d
  4. Start the frontend:

    cd ../app
    pnpm install
    pnpm dev

    Dashboard will be available at http://localhost:3000

  5. Flash ESP32 firmware:

Manual Setup

Refer to component-specific documentation:


Deployment

Production API

Container Registry

All services are containerized and available on GitHub Container Registry:

Service Image Description
API ghcr.io/upayanmazumder/spectrawatt/api Go backend API
Frontend ghcr.io/upayanmazumder/spectrawatt/app Next.js dashboard
ML ghcr.io/upayanmazumder/spectrawatt/ml PyTorch ML service

Deployment Options

  1. Kubernetes: Use manifests in /k8s directory
  2. Docker Compose: Available in each component directory
  3. Systemd Service: Use deploy.sh for Linux servers

Documentation


Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please ensure your code follows the existing style and includes appropriate tests.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Team

Team IoTeehee


About

An intelligent IoT-based energy monitoring solution combining hardware sensors, real-time data processing, and machine learning for device-level energy consumption analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Used by

Contributors

Languages