A robust, AI-driven application designed to predict equipment failures before they occur. This project leverages machine learning (Random Forest) to analyze sensor data in real-time, helping industries optimize maintenance schedules, reduce downtime, and cut operational costs.
๐ด Live Demo: Click Here
- Quadruple Operation Modes:
- ๐ Historical Analytics (v4): NEW - Interactive Plotly dashboards charting massive historical timelines of sensor logs and offering direct CSV dataset exports.
- ๐ก Live IoT Sensor (v3): Connects directly to hardware (ESP32) via a local FastAPI backend. Ingests real-time physical telemetry.
- ๐ญ Simulation Diagnostics (v2): Real-time dashboard simulating a fleet of 9+ industrial machines. Tracks live telemetry, failure risks, and operational status simultaneously.
- ๐ ๏ธ Manual Diagnostics (v1): Deep-dive analysis for single units. Input sensor parameters manually to stress-test specific scenarios and visualize failure probabilities.
- Intelligent Prediction Engine: Powered by a trained Random Forest Classifier (
models/model.joblib), achieving consistently high accuracy (>98%) in detecting potential failures. - Real-time Feature Engineering: Automatically calculates critical derived metrics like Temperature Difference and Mechanical Power on the fly.
- Professional UI/UX: Dark-mode enabled, responsive design built with Streamlit, featuring interactive metric cards, visual health indicators, and dynamic alerts.
The predictive model is trained on a synthetic dataset mirroring real-world industrial sensor data (based on the AI4I 2020 Predictive Maintenance Dataset).
| Feature | Unit | Description |
|---|---|---|
| Air Temperature | [K] | Ambient room temperature. |
| Process Temperature | [K] | Temperature of the manufacturing process. |
| Rotational Speed | [rpm] | Speed of the spindle/drive. |
| Torque | [Nm] | Torque applied during operation. |
| Tool Wear | [min] | Cumulative tool wear time. |
| Type | L/M/H | Quality variant (Low, Medium, High). |
- No Failure: โ System Healthy
- Failure: ๐จ Maintenance Required (Probability > 50%)
Follow these steps to set up the project locally.
git clone https://github.com/ShivamMaurya14/Predictive-Maintenance-System.git
cd Predictive-Maintenance-Systempython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateEnsure you have Python 3.8+ installed.
pip install -r requirements.txtNote: If
requirements.txtis missing, install the core libraries:pip install streamlit pandas numpy scikit-learn joblib
The project comes with a pre-trained model (models/model.joblib). If you wish to retrain it:
python train.pyThis will create a fresh model.joblib file in your models/ directory.
The application now features a decoupled microservice architecture (Backend + Frontend). You will need two terminal windows.
Terminal 1 (Backend API):
uvicorn api:app --reloadTerminal 2 (Frontend Dashboard):
streamlit run app.pyโโโ api.py # FastAPI Backend Server (IoT Data Ingestion)
โโโ app.py # Main Streamlit Application (Frontend)
โโโ esp32_firmware/ # C++ firmware for the ESP32 microcontroller
โโโ train.py # ML Model Training Script (Backend logic)
โโโ models/
โ โโโ model.joblib # Serialized Random Forest Model
โโโ dataset/
โ โโโ ai4i2020.csv # Training Dataset
โโโ nb/
โ โโโ ml-powered-maintenance-smarter-proactive.ipynb # exploration
โโโ resources/ # Preview images & assets
โโโ requirements.txt # Python Dependencies
โโโ Makefile # Automation commands
โโโ LICENSE # MIT License
โโโ README.md # Project Documentation
This predictive maintenance solution is versatile and can be adapted across various high-stakes industries:
- Manufacturing & Assembly Lines: Monitor robotic arms, conveyor motors, and CNC machines to prevent production bottlenecks.
- Energy & Utilities: Track turbine health in wind farms or pumps in hydroelectric plants to avoid catastrophic failures.
- Transportation & Logistics: Fleet management for heavy trucks or railway rolling stock, ensuring safety and reliability.
- Oil & Gas: Predictive analytics for drilling equipment and pipeline pressure valves in remote locations.
- Data Centers: Monitor cooling systems and power generators to maintain 99.9% uptime.
We are constantly evolving to meet Industry 4.0 standards. Here is our vision for the future:
- IoT & MQTT Connectivity: Direct integration with industrial IoT standards (MQTT/OPC UA) to ingest live sensor streams from PLC controllers.
- Edge Deployment: Optimizing the model to run on edge devices (Raspberry Pi/Jetson Nano) for ultra-low latency predictions without cloud dependency.
- Time-Series Database (InfluxDB): High-performance storage for historical sensor data to enable long-term trend analysis.
- API Gateway: Expose prediction results via a RESTful API for integration with existing ERP (SAP/Oracle) or MES systems.
- Deep Learning (LSTM/GRU): Experimenting with Recurrent Neural Networks to capture complex temporal dependencies in sensor patterns.
- Root Cause Analysis: Automatic identification of which sensor triggered the failure alert (e.g., "High vibrations caused bearing failure").
- Digital Twin: Creating a fully interactive 3D digital twin of the factory floor using Unity or Three.js linked to this backend.
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements, bug fixes, or new feature ideas.
Developed with โค๏ธ by Shivam Maurya

