AI-driven failure prediction, automated diagnostics, and real-time maintenance alerting for Industrial IoT systems.
The Industrial Predictive Maintenance Platform predicts industrial machine failures before they happen and automates the entire maintenance response โ from sensor reading to technician alert โ using a modern data engineering and machine learning stack.
Instead of reactive repairs or fixed maintenance schedules, this system continuously evaluates live sensor data, predicts whether a machine will fail within the next 24 hours, classifies the expected failure type, generates AI-powered maintenance recommendations, and pushes real-time alerts to maintenance teams โ with results visualized in a Power BI dashboard.
- โ Predict whether a machine will fail within 24 hours
- โ Identify the expected failure type
- โ Generate automated maintenance recommendations
- โ Send real-time alerts to maintenance teams
- โ Provide operational insights through dashboards
โโโโโโโโโโโโโโโโโโโโโโ
โ Industrial Sensors โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ Google Sheets โ โ Data Source
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ n8n Workflow โ โ Orchestration
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Service โ โ Model Serving (via ngrok)
โ โโโโโโโโโโโโโโโโโโ โ
โ โ Model 1: โ โ Failure Prediction (0/1)
โ โ Random Forest โ โ
โ โโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโ โ
โ โ Model 2: โ โ Failure Type Classification
โ โ Random Forest โ โ
โ โโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ (if failure predicted)
โโโโโโโโโโโโโโโโโโโโโโ
โ Gemini AI Agent โ โ Condition analysis + recommendation
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ Telegram Bot โ โ Real-time alert to maintenance team
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ Power BI Dashboard โ โ Operational insights & KPIs
โโโโโโโโโโโโโโโโโโโโโโ
| Layer | Technology |
|---|---|
| Data Source | Google Sheets |
| Workflow Orchestration | n8n |
| Machine Learning | Python, scikit-learn (Random Forest) |
| API Layer | FastAPI |
| API Exposure | ngrok |
| AI Analysis | Google Gemini AI Agent |
| Notifications | Telegram Bot API |
| Visualization | Power BI |
Industrial IoT sensor dataset โ 24,042 records across four machine types.
Machine types: CNC ยท Pump ยท Compressor ยท Robotic Arm
| Feature | Description |
|---|---|
machine_type |
Type of industrial machine |
vibration_rms |
Root-mean-square vibration amplitude |
temperature_motor |
Motor temperature reading (ยฐC) |
current_phase_avg |
Average electrical phase current |
pressure_level |
Operating pressure |
rpm |
Rotational speed |
operating_mode |
Current operational state |
hours_since_maintenance |
Hours elapsed since last maintenance |
ambient_temp |
Ambient environmental temperature |
| Target | Type | Values |
|---|---|---|
failure_within_24h |
Binary | 0 = Normal, 1 = Failure |
failure_type |
Multi-class | bearing, electrical, hydraulic, motor_overheat, none |
- Data Cleaning โ duplicate removal, missing value imputation, outlier handling
- Feature Engineering โ thermal delta, vibration-to-RPM ratio, maintenance urgency ratio
- Label Encoding โ categorical variables encoded for tree-based models
- Train-Test Split โ 80/20 stratified split
- Model Training โ Random Forest Classifier (two stages)
- Model Evaluation โ accuracy, precision, recall, F1-score, ROC-AUC
- Model Deployment โ served via FastAPI, exposed through ngrok
- Model 1 โ Failure Prediction: binary classifier โ
failure_within_24h - Model 2 โ Failure Type Classification: multi-class classifier โ
failure_type(invoked only when Model 1 predicts failure)
โน๏ธ Metrics are illustrative of the evaluation methodology โ replace with your actual training results.
| Endpoint | Method | Description |
|---|---|---|
/predict/failure |
POST |
Returns failure_within_24h prediction + probability |
/predict/failure-type |
POST |
Returns predicted failure_type + class probabilities |
/health |
GET |
Service health check |
/model-info |
GET |
Model version & feature schema |
- Google Sheets Trigger โ polls for new sensor rows
- HTTP Request โ
/predict/failure - IF Node โ branches on
failure_within_24h == 1 - HTTP Request โ
/predict/failure-type(failure branch only) - Gemini AI Agent Node โ generates condition analysis & recommendation
- Telegram Node โ sends alert to maintenance team
- Write Node โ logs results for Power BI reporting
ALERT: Predictive Maintenance System
Machine: CNC-14 | Type: CNC
Status: FAILURE PREDICTED (Probability: 0.91)
Failure Type: Bearing Wear
Recommendation: Replace spindle bearing within 12
hours. Reduce load to 60% until serviced.
Time: 2026-07-19 09:42
- KPI cards โ machines monitored, active alerts, failures (24h)
- Failure trend line chart by machine type
- Failure type distribution (pie chart)
- Machine health heatmap
- Recent alerts & recommendations table
industrial-predictive-maintenance/
โโโ data/
โ โโโ sensor_data.csv
โโโ notebooks/
โ โโโ 01_data_cleaning.ipynb
โ โโโ 02_feature_engineering.ipynb
โ โโโ 03_model_training.ipynb
โโโ models/
โ โโโ failure_prediction_rf.pkl
โ โโโ failure_type_rf.pkl
โโโ api/
โ โโโ main.py
โ โโโ schemas.py
โ โโโ preprocessing.py
โโโ n8n/
โ โโโ workflow.json
โโโ dashboard/
โ โโโ powerbi_report.pbix
โโโ requirements.txt
โโโ README.md
git clone https://github.com/<your-username>/industrial-predictive-maintenance.git
cd industrial-predictive-maintenancepip install -r requirements.txtuvicorn api.main:app --reload --port 8000ngrok http 8000Import My workflow.json into your n8n instance and configure:
- Google Sheets credentials
- FastAPI (ngrok) endpoint URL
- Gemini AI API key
- Telegram Bot token & chat ID
Open dashboard/powerbi_report.pbix and point it to your results data source.
- Replace Google Sheets with a real streaming source (MQTT/Kafka)
- Deploy FastAPI to a persistent cloud host (AWS/Azure/GCP)
- Add model drift detection & automatic retraining
- Support multiple prediction horizons (6h, 24h, 72h)
- Explore LSTM/TCN models for time-series degradation trends
- Add authentication & role-based access control
- Build a technician feedback loop to improve model accuracy