Team PowerPort | EN4440 Embedded Systems and Design
University of Moratuwa | Department of Electronic and Telecommunication Engineering
Features โข Quick Start โข Architecture โข Documentation โข Team
EcoWatt is an IoT system for real-time monitoring and intelligent control of solar inverters. Built on ESP32 hardware with secure cloud connectivity, the system features adaptive data compression, secure FOTA updates, and intelligent power management for extended battery life.
Note: This implementation uses a simulated inverter over WiFi for development and testing. Production deployment would use Modbus RTU for communication with physical inverters.
- Adaptive Compression: Dictionary-based compression achieves up to 85% reduction for repetitive data patterns
- Military-Grade Security: Triple-layer upload protection with RSA-2048 signed firmware updates
- Power Optimization: Peripheral gating strategy for reduced power consumption
- Remote Configuration: Bidirectional command system for device management
- Professional Dashboard: React-based monitoring interface with live data visualization
- Comprehensive Testing: 30+ test suites covering all major components
|
|
|
|
| Component | Version | Purpose |
|---|---|---|
| Python | 3.10+ | Flask backend server |
| Node.js | 20+ | React frontend |
| PlatformIO | Latest | ESP32 firmware development |
| Just | Latest | Task automation (recommended) |
# Complete first-time setup (installs all dependencies)
just setup
# Verify installation
just status# Backend
just s # Start Flask server (localhost:5001)
# Frontend
just d # Start React dev server (localhost:5173)
# ESP32
just f # Flash firmware
just m # Monitor serial output
just fm # Flash + monitor
# Testing
just test-all # Run all test suitesgraph TB
subgraph "Edge Device"
A[Solar Inverter] -->|Modbus RTU<br/>2s poll| B[ESP32 EcoWatt]
end
subgraph "Cloud Backend"
B -->|HTTPS<br/>Compressed + Secured| C[Flask Server]
C -->|Store| D[(SQLite DB)]
C -->|Publish| E[MQTT Broker]
end
subgraph "Web Interface"
C -->|REST API| F[React Dashboard]
E -->|WebSocket| F
end
style B fill:#4CAF50,stroke:#2E7D32,stroke-width:2px
style C fill:#2196F3,stroke:#1565C0,stroke-width:2px
style F fill:#FF9800,stroke:#E65100,stroke-width:2px
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Modbus โ -> โ Ring Buffer โ -> โ Compression โ -> โ Security โ
โ 2s Poll โ โ 7 Samples โ โ 96.4% โ โ Nonce + HMAC โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
|
v
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ MQTT โ <- โ Database โ <- โ Validate โ <- โ HTTPS Upload โ
โ Publish โ โ Store โ โ Decompress โ โ 15s Batch โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
| Live Dashboard | Power Management |
|---|---|
![]() |
![]() |
| Real-time metrics and data visualization | Energy analytics and optimization |
| Device Configuration | FOTA Updates |
|---|---|
![]() |
![]() |
| Remote settings and parameter control | Secure firmware deployment |
| System Testing |
|---|
![]() |
| Comprehensive fault injection and diagnostics |
- Live Data Visualization: Real-time charts for voltage, current, power, and temperature
- Power Analytics: Energy consumption tracking and optimization metrics
- Remote Configuration: Adjust polling intervals, compression settings, and security parameters
- OTA Management: Deploy firmware updates with progress monitoring
- Fault Injection: Test system resilience with built-in diagnostic tools
- Device Status: Monitor connection health, WiFi signal, and error logs
EcoWatt_TeamPowerPort/
โโโ ๐ง PIO/ECOWATT/ # ESP32 Firmware (C++)
โ โโโ src/ # Source code
โ โ โโโ main.cpp # Petri net state machine
โ โ โโโ application/ # Core modules
โ โโโ include/ # Header files
โ โโโ test/ # Unit & integration tests
โ โโโ platformio.ini # Build configuration
โ
โโโ ๐ flask/ # Flask Backend (Python)
โ โโโ handlers/ # Business logic
โ โโโ routes/ # API endpoints
โ โโโ scripts/ # Utility scripts
โ โโโ firmware/ # OTA firmware storage
โ โโโ flask_server_modular.py # Main entry point
โ
โโโ โ๏ธ front-end/ # React Dashboard (JavaScript)
โ โโโ src/
โ โ โโโ components/ # UI components
โ โ โโโ pages/ # Page layouts
โ โ โโโ api/ # API integration
โ โโโ package.json
โ
โโโ ๐ docs/ # Documentation
โโโ ๐ผ๏ธ images/ # Screenshots & diagrams
โโโ justfile # Task automation
|
Language: C++ (Arduino) |
Language: Python 3.10+ |
Framework: React 18 |
| Metric | Value | Note |
|---|---|---|
| Compression Ratio | Up to 85% (140 โ 21 bytes) | Dictionary method, typical patterns |
| Upload Interval | 15 seconds (default) | Configurable |
| Poll Rate | 2 seconds (default) | Configurable: WiFi simulation |
| FOTA Chunk Size | 2 KB | Memory-efficient streaming |
| Power Savings | Peripheral gating only | 10% duty cycle (simulation mode) |
| Security Level | HMAC-SHA256 + RSA-2048 | Production-grade cryptography |
| Command Latency | < 1 second | Network dependent |
| Test Coverage | 30+ test suites | ESP32, Backend, Integration |
Note on Performance: Current metrics are based on simulated inverter implementation using WiFi polling. Production deployment with Modbus RTU communication will enable additional power-saving features including CPU frequency scaling and sleep modes.
The project includes 30+ comprehensive test suites:
|
ESP32 Tests
|
Backend Tests
|
System Tests
|
just test-all # Run all test suitesComprehensive documentation is available in the docs/ directory:
| Document | Description |
|---|---|
| Features Guide | In-depth feature explanations with examples |
| Architecture | System design, data flows, and state machines |
| Security Guide | Cryptographic implementations and threat model |
| Implementation Notes | Simulation vs production architecture |
| Setup Guide | Detailed installation and configuration |
| API Reference | Complete REST API documentation |




