An intelligent IoT-based energy monitoring solution combining hardware sensors, real-time data processing, and machine learning for device-level energy consumption analysis.
- Overview
- Key Features
- System Architecture
- Project Gallery
- Technology Stack
- Components
- Getting Started
- Deployment
- Documentation
- Contributing
- License
- Team
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.
- 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
- 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
- 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
- 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
- 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
┌─────────────────────────────────────────────────────────────┐
│ 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
![]() Breadboard Setup - Front View |
![]() Breadboard Setup - Wiring Detail |
![]() Complete Electronics Assembly |
![]() ESP32 Development Board |
![]() Testing Environment |
Live Dashboard - Real-time energy monitoring interface
![]() Team IoTeehee |
![]() Project Credentials |
- Microcontroller: ESP32 (WiFi-enabled)
- Sensors: Current Transformer (CT), Voltage Divider
- Library: EmonLib (Energy Monitoring)
- Communication: WiFi, HTTPS
- Language: Go 1.21+
- Framework: Gorilla Mux
- Database: MongoDB 7.0
- Container: Docker, Docker Compose
- Deployment: Kubernetes, Systemd
- Framework: PyTorch
- Models: LSTM, K-Means
- Libraries: NumPy, Pandas, scikit-learn
- API: FastAPI (for ML predictions)
- Framework: Next.js 15 (React 19)
- Language: TypeScript
- Styling: Tailwind CSS
- HTTP Client: Axios
- Fonts: Montserrat (Google Fonts)
- Containerization: Docker
- Orchestration: Kubernetes
- CI/CD: GitHub Actions (implied by container registry)
- Version Control: Git, GitHub
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:
FeedDeviceData.ino- Main Arduino sketch
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:
main.go- API server implementationdocker-compose.yml- Container orchestrationQUICKSTART.md- Setup guide
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:
model.py- LSTM architecturetrain.py- Model trainingpredict_live.py- Live classificationREADME_DOCKER.md- Docker setup
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:
event_detector.py- Event detectionclustering.py- K-Means clusteringenergy_calc.py- Energy analytics
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:
page.tsx- Main dashboardSidebar.tsx- Energy stats sidebarapi.ts- API integration
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:
ingress.yaml- Traffic routingapi/deployment.yaml- API podsml/deployment.yaml- ML pods
- 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)
-
Clone the repository:
git clone https://github.com/upayanmazumder/spectrawatt.git cd spectrawatt -
Start the backend API:
cd api docker-compose up -dAPI will be available at
http://localhost:8080 -
Start the ML service:
cd ../ml docker-compose up -d -
Start the frontend:
cd ../app pnpm install pnpm devDashboard will be available at
http://localhost:3000 -
Flash ESP32 firmware:
- Open
esp-32/FeedDeviceData/FeedDeviceData.inoin Arduino IDE - Update WiFi credentials and API endpoint
- Upload to ESP32
- Open
Refer to component-specific documentation:
- URL: https://api.spectrawatt.upayan.dev/api/data
- Health Check: https://api.spectrawatt.upayan.dev/health
- Infrastructure: Kubernetes cluster with MongoDB Atlas
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 |
- Kubernetes: Use manifests in
/k8sdirectory - Docker Compose: Available in each component directory
- Systemd Service: Use
deploy.shfor Linux servers
- Project Wiki: DeepWiki Documentation
- API Documentation: API README | MongoDB Setup
- ML Documentation: ML Docker Guide
- Presentation: Google Slides
- Design System: Figma Design Files
- Kubernetes Guide: K8s Deployment
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please ensure your code follows the existing style and includes appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.
Team IoTeehee






