Skip to content

Repository files navigation

๐Ÿ”Œ DCRM Fault Detection System

AI-Powered Circuit Breaker Monitoring & Analysis Platform

Smart India Hackathon 2025 Python Flask AI Powered


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Problem Statement

Circuit breaker faults in electrical distribution systems lead to:

  • โŒ Unplanned power outages
  • โŒ Equipment damage and safety hazards
  • โŒ High maintenance costs
  • โŒ Lack of predictive maintenance capabilities

Traditional DCRM (Direct Contact Resistance Measurement) testing is manual, time-consuming, and reactive rather than proactive.


๐Ÿ’ก Solution Overview

Our AI-Powered DCRM Fault Detection System revolutionizes circuit breaker monitoring by:

โœ… Automated Analysis - Instant fault detection using machine learning
โœ… Real-Time Monitoring - 24/7 continuous surveillance with live dashboards
โœ… Predictive Maintenance - Early fault detection before failures occur
โœ… Multiple Interfaces - Web-based analysis + Live monitoring dashboard
โœ… High Accuracy - 100% accuracy on test datasets with confidence scoring


โœจ Key Features

๐Ÿ” Analysis Module

  • CSV File Upload - Drag & drop support for historical data analysis
  • Manual Data Input - Paste comma-separated resistance values
  • Test Sample Generation - Generate synthetic waveforms for testing
  • Instant Results - Fault detection with confidence scores and extracted features

๐Ÿ“ก Real-Time Monitoring Dashboard

  • Live Waveform Visualization - Chart.js powered real-time graphs
  • Animated Circuit Breaker - Visual representation with state indicators
  • Fault Detection Display - Color-coded alerts with confidence metrics
  • Statistics Panel - Total scans, faults detected, uptime, health rate
  • Alert History - Comprehensive log of all detected anomalies
  • Adjustable Monitoring Speed - Configurable update intervals (0.5s - 5s)
  • Fault Simulation - Test with Normal, Spike, Plateau, Unstable signals

๐Ÿค– AI/ML Capabilities

  • Random Forest Classifier - 200 estimators with optimized parameters
  • Feature Extraction - 9 key features including peaks, slopes, plateaus
  • Multi-Class Classification - Detects Normal, Spike, Plateau, Unstable faults
  • Confidence Scoring - Probability distribution for all fault types
  • Trained on Synthetic Data - 300 samples with noise and variations

๐ŸŽจ User Interface

  • Modern Glassmorphism Design - Frosted glass effects with backdrop blur
  • Animated Backgrounds - Floating gradient orbs and moving grid patterns
  • Color-Coded Themes - Purple/Pink for analysis, Teal/Cyan for monitoring
  • Responsive Design - Mobile, tablet, and desktop optimized
  • Smooth Animations - Hover effects, transitions, loading states

๐Ÿ› ๏ธ Technology Stack

Backend

  • Python 3.8+ - Core programming language
  • Flask 2.3+ - Web framework for REST API
  • Flask-CORS - Cross-origin resource sharing
  • Scikit-learn - Machine learning library
  • NumPy - Numerical computations
  • SciPy - Signal processing
  • Joblib - Model persistence

Frontend

  • HTML5 - Semantic markup
  • CSS3 - Modern styling with animations
  • JavaScript (ES6+) - Dynamic functionality
  • Chart.js - Real-time waveform visualization

AI/ML

  • Random Forest Classifier - Ensemble learning method
  • Feature Engineering - Peak detection, statistical analysis
  • Signal Processing - Savitzky-Golay filtering

Future Integration

  • ESP32 Microcontroller - Hardware data acquisition
  • IoT Sensors - Real-time DCRM measurements
  • Cloud Deployment - Heroku, Vercel, Railway

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    User Interface Layer                  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Analysis Page      โ”‚   Monitoring Dashboard           โ”‚
โ”‚   (index_v2.html)    โ”‚   (monitor_v2.html)             โ”‚
โ”‚   - Upload CSV       โ”‚   - Live Waveform Chart         โ”‚
โ”‚   - Manual Input     โ”‚   - Circuit Breaker Visual      โ”‚
โ”‚   - Test Generation  โ”‚   - Real-time Statistics        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                          โ”‚
           โ–ผ                          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Flask REST API                        โ”‚
โ”‚                 (dcrm_flask_api.py)                     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Endpoints:                                             โ”‚
โ”‚  - POST /predict   โ†’ Analyze waveform                   โ”‚
โ”‚  - GET  /health    โ†’ API health check                   โ”‚
โ”‚  - GET  /          โ†’ API information                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              AI Processing Layer                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1. Feature Extraction                                  โ”‚
โ”‚     - Peak detection (SciPy)                            โ”‚
โ”‚     - Statistical metrics (NumPy)                       โ”‚
โ”‚     - Plateau duration analysis                         โ”‚
โ”‚     - Slope calculations                                โ”‚
โ”‚                                                          โ”‚
โ”‚  2. ML Model (Random Forest)                            โ”‚
โ”‚     - 200 decision trees                                โ”‚
โ”‚     - 9 input features                                  โ”‚
โ”‚     - 4 output classes                                  โ”‚
โ”‚     - Confidence scoring                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Data Sources                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Current: Synthetic Data Generation                     โ”‚
โ”‚  Future:  ESP32 โ†’ DCRM Sensors โ†’ WiFi โ†’ API            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฆ Installation Guide

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • Modern web browser (Chrome, Firefox, Edge)

Step 1: Clone Repository

git clone https://github.com/yourusername/dcrm-fault-detection.git
cd dcrm-fault-detection

Step 2: Install Python Dependencies

cd backend
pip install flask flask-cors numpy scipy scikit-learn joblib

Or use requirements.txt:

pip install -r requirements.txt

Step 3: Train AI Model (Optional)

python train_dcrm_classifier.py

This generates dcrm_fault_classifier_v2.joblib

Step 4: Start Flask API

python dcrm_flask_api.py

API starts at http://localhost:5000

Step 5: Open Frontend

Navigate to frontend/ folder and open index_v2.html in your browser.

Or use a local server:

cd frontend
python -m http.server 8000

Then visit http://localhost:8000


๐Ÿš€ Usage

Analysis Mode

  1. Upload CSV File

    • Click browse or drag & drop your CSV file
    • File should contain resistance measurements
    • Click "Analyze CSV" button
  2. Manual Input

    • Paste comma-separated resistance values
    • Minimum 10 values required
    • Click "Analyze Data" button
  3. Generate Test Sample

    • Select fault type (Normal, Spike, Plateau, Unstable)
    • Click "Generate & Analyze"
    • System creates and analyzes synthetic waveform

Real-Time Monitoring Mode

  1. Click "๐Ÿ“ก Open Live Monitoring Dashboard" button
  2. Adjust monitoring speed (0.5s - 5s intervals)
  3. Select fault simulation type
  4. Click "๐Ÿš€ Start Monitoring"
  5. Watch live analysis with:
    • Real-time waveform chart
    • Animated circuit breaker
    • Fault detection alerts
    • Statistics updates
    • Alert history

๐Ÿ“ก API Documentation

Base URL

http://localhost:5000

Endpoints

1. Get API Information

GET /

Response:

{
  "message": "DCRM Fault Detection API",
  "version": "1.0",
  "endpoints": {
    "/predict": "POST - Analyze waveform",
    "/health": "GET - Check API health"
  }
}

2. Health Check

GET /health

Response:

{
  "status": "healthy",
  "model_loaded": true
}

3. Predict Fault

POST /predict
Content-Type: application/json

Request Body:

{
  "waveform": [2.5, 2.6, 2.4, 2.7, ...]
}

Response:

{
  "success": true,
  "predicted_fault": "spike",
  "confidence": {
    "normal": 0.00,
    "spike": 77.00,
    "plateau": 8.50,
    "unstable": 14.50
  },
  "features_extracted": {
    "num_peaks": 1,
    "max_peak_height": 1.000,
    "mean": 0.089,
    "std": 0.110,
    "plateau_duration": 10,
    "max_slope": 0.3872,
    "min_slope": -0.2341
  }
}

๐Ÿ“ธ Screenshots

Analysis Page

Analysis Page

  • Modern UI with gradient animations
  • Three upload options
  • Instant results display

Real-Time Monitoring Dashboard

Monitoring Dashboard

  • Live waveform chart
  • Animated circuit breaker
  • Statistics panel
  • Alert history

Fault Detection Results

Results

  • Confidence scores with progress bars
  • Extracted features display
  • Color-coded fault indicators

๐Ÿ”ฎ Future Scope

Short-term Enhancements

  • โœ… ESP32 hardware integration
  • โœ… WebSocket support for real-time data streaming
  • โœ… Database integration (PostgreSQL/MongoDB)
  • โœ… User authentication and multi-user support
  • โœ… Historical data analytics and trends

Long-term Vision

  • ๐Ÿš€ Mobile app (Flutter/React Native)
  • ๐Ÿš€ Advanced ML models (LSTM, Transformer)
  • ๐Ÿš€ Predictive maintenance scheduling
  • ๐Ÿš€ Multi-sensor support (temperature, vibration)
  • ๐Ÿš€ Cloud deployment with auto-scaling
  • ๐Ÿš€ Integration with SCADA systems
  • ๐Ÿš€ Anomaly detection for multiple fault types
  • ๐Ÿš€ Report generation and export features


๐Ÿ“„ License

This project is developed for Smart India Hackathon 2025.


๐Ÿ™ Acknowledgments

  • Smart India Hackathon organizing committee
  • RGIPT, Jais
  • Open-source libraries: Flask, Scikit-learn, Chart.js
  • Inspiration from modern UI design trends

๐Ÿ“ž Contact

For queries related to this project:


Made with โค๏ธ for Smart India Hackathon 2025

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages