Bridging the Gap Between Grid and Grassroots
A Smart Energy Monitoring Platform for Rural India
Gram Meter is an enterprise-grade smart energy monitoring solution designed specifically for rural India. It empowers farmers, village leaders (Sarpanch), and utility providers with real-time insights into electricity consumption, quality, and efficiency.
By combining IoT data, Machine Learning, and Multilingual support, Gram Meter addresses critical challenges like voltage fluctuations, power theft, and inefficient usage patterns.
- Mobile-First Authentication: OTP-based login (no passwords required).
- Device Fingerprinting: Tracks user devices and prevents session hijacking.
- Role-Based Access Control (RBAC):
- 👨🌾 Farmer: View personal consumption, bills, and alerts.
- 🏛️ Sarpanch: Village-level overview and critical infrastructure monitoring.
- ⚡ Utility Provider: Grid load balancing and theft detection.
- 🇮🇳 Government: Policy planning and subsidy management.
- Real-Time Monitoring: Live tracking of Voltage, Current, Power, and Frequency.
- Anomaly Detection: AI-powered detection of:
- ⚡ Voltage Spikes/Drops
- 🔌 Phantom Loads
⚠️ Power Theft/Tampering- 🌑 Power Outages
- Smart Forecasting: 7-day energy consumption predictions using LSTM models.
- Efficiency Scoring: A-F grading system for energy usage with actionable recommendations.
- Multilingual Interface: Full support for English, Hindi, and Gujarati.
- Offline Capabilities: Works reliably on low-bandwidth networks.
- Multi-Channel Alerts: Notifications via SMS, WhatsApp, and Email.
The platform follows a modern microservices-inspired architecture:
- Backend Core: Django 6.0 (User management, Billing, Notifications).
- ML Gateway: FastAPI (High-performance inference for Forecasting & Anomalies).
- Frontend: React + Vite (Responsive, PWA-ready UI).
- Database: SQLite (Dev) / PostgreSQL (Prod).
- Real-Time Layer: Redis + Django Channels (WebSockets).
- Python 3.10+
- Node.js 16+
- Redis (for WebSockets and Caching)
-
Clone the Repository
git clone https://github.com/Jaimin2687/gram-meter.git cd gram-meter -
Setup Backend
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r backend/requirements.txt # Initialize Database cd backend python manage.py migrate python scripts/populate_sample_data.py # Generates test users & data cd ..
-
Setup Frontend
cd frontend npm install cd ..
We provide a unified script to start the Backend, Frontend, and Admin Console simultaneously.
Mac/Linux:
./start_platform.shWindows:
start_platform.batTerminal 1: Django Backend
source .venv/bin/activate
cd backend
python manage.py runserverTerminal 2: Frontend Application
cd frontend
npm run devTerminal 3: ML Gateway (Optional)
source .venv/bin/activate
cd backend
uvicorn ml_gateway.main:app --reload --port 8001Use these accounts to explore different roles:
| Role | Username | Password | Phone |
|---|---|---|---|
| Farmer | farmer_ramesh |
password123 |
+917012345678 |
| Sarpanch | sarpanch_kumar |
password123 |
+919876543210 |
Note: In development mode, the OTP will be printed in the backend console.
The backend provides a comprehensive REST API. Once the server is running, access the interactive documentation:
- Swagger UI: http://localhost:8000/api/docs/
- ReDoc: http://localhost:8000/api/redoc/
POST /api/v1/auth/login/- Request OTPGET /api/v1/meters/- List smart metersGET /api/v1/analytics/forecast/- Get energy predictionsPOST /api/v1/analytics/ml/detect_anomaly/- Real-time anomaly check
gram-meter/
├── backend/ # Django Project Root
│ ├── analytics/ # ML & Data Analysis App
│ ├── billing/ # Invoicing & Payments
│ ├── core/ # User Auth & Role Management
│ ├── meters/ # Smart Meter Management
│ ├── ml_gateway/ # FastAPI Microservice
│ └── scripts/ # Data Generators & Utilities
├── frontend/ # React + Vite Application
│ ├── src/
│ │ ├── components/ # Reusable UI Components
│ │ ├── pages/ # Application Views
│ │ └── services/ # API Integration
├── ML/ # Machine Learning Models (.pkl)
└── Admin console/ # Government/Utility Admin Panel
- Fork the repository
- Create your 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
Built with ❤️ for Square Hacks 2025