Final Project Grade: Full-Stack MLOps
This project demonstrates a production-ready Digital Twin system that integrates Machine Learning (ML) and Optimization to proactively manage power consumption on embedded hardware. It bridges Electronics and Communication Engineering (ECE) hardware design with modern MLOps deployment practices.
In smart home and microgrid applications, power control is typically reactive—responding only after overloads occur. This results in wasted energy, increased peak-hour costs, and system instability.
The objective was to develop a distributed AI system that performs predictive load balancing and optimized control, utilizing simple edge hardware for execution.
- Designed an ESP12F PCB Actuator for load switching.
- Deployed a Dockerized LSTM and Linear Programming (LP) Solver via FastAPI to manage grid stability.
- Achieved 0.0335 Test RMSE on load prediction.
- Enabled a 25% projected reduction in peak-hour energy costs through proactive load balancing.
The system follows a Hybrid Edge-Cloud Architecture composed of three decoupled microservices.
Component: Custom-designed ESP12F 4-Relay PCB (Digital Twin).
Function:
- Acts as the actuator.
- Sends real-time load telemetry data via HTTP POST.
- Receives optimized action commands (e.g., “Toggle Relay 3 OFF”) from the central API.
Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip (simulates hardware behavior and fault resilience).
Component: High-performance REST API built using FastAPI and containerized via Docker.
Function:
- Prediction: Uses a trained LSTM model (
lstm_forecaster.h5) to forecast power demand 60 minutes ahead. - Optimization: Employs a Linear Programming Solver (PuLP) to minimize relay switching while avoiding predicted peaks.
- Serving: Exposes endpoints for actuator control such as
/api/v1/control/optimize.
Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip, Dockerfile, https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip.
Component: Real-time dashboard built using Streamlit and Plotly.
Function:
- Consumes the FastAPI metrics endpoint
/api/v1/dashboard/metrics. - Visualizes Predicted Load vs. Critical Threshold and logs all optimization events.
Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip.
| Feature | Technical Proof | Business Impact |
|---|---|---|
| Prediction Accuracy | LSTM achieved 0.0335 Test RMSE on unseen data. | Enables reliable forecasting for proactive load management. |
| System Resilience | Hybrid Edge/Cloud Failsafe: defaults to safe “No Action” mode on API failure. | Guarantees reliability and hardware safety, aligning with ECE standards. |
| Load Balancing | PuLP solver dynamically prioritizes relays based on predicted peaks. | 25% projected energy cost reduction through optimal scheduling. |
| Deployment & Visualization | Fully containerized with real-time dashboard visualization. | Demonstrates end-to-end production-grade implementation. |
- Python 3.10+
- Git
- Docker and Docker Compose (recommended)
1. Clone the repository
git clone https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip
cd ai_microgrid_predictive_load_balancing_system2. Build and Run the FastAPI Microservice
docker-compose up --build -d
# The API will run at http://localhost:80003. Run the Embedded Simulator (Actuator)
# In a separate terminal
.\.venv\Scripts\activate # Windows
# python https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip4. Run the Streamlit Dashboard
# In a third terminal
.\.venv\Scripts\activate
streamlit run https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip- Hardware: ESP12F (Wi-Fi SoC) with 4-Relay PCB
- Backend: FastAPI, Docker, PuLP Solver
- Machine Learning: LSTM (TensorFlow/Keras)
- Visualization: Streamlit, Plotly
- DevOps: Docker Compose, RESTful APIs
- Integrated MLOps principles in embedded ECE systems.
- Achieved seamless edge-cloud orchestration.
- Demonstrated predictive analytics, optimization, and real-time visualization in one unified platform.
Author: Ansu Raj Project Title: AI Microgrid Predictive Load Balancing System Category: Embedded ML | Smart Energy | MLOps |