An Industry 4.0 predictive maintenance system that uses Sensor Fusion, Edge DSP, Unsupervised AI (Isolation Forest), and 3D Digital Twin Visualization to detect machinery failures before they occur — without needing historical failure data.
In modern manufacturing, unplanned machinery downtime costs billions annually. Traditional IoT systems stream raw, high-frequency sensor data to the cloud — causing bandwidth exhaustion, high latency, and expensive cloud compute. And because industrial motors rarely fail, acquiring labelled failure datasets for supervised AI is nearly impossible.
Three-layer architecture:
- Edge DSP on ESP32 — processes raw vibration data locally using FFT, transmitting only Dominant Frequency and Magnitude. Reduces network payload by over 90%.
- AI Gateway — a Python backend runs an Unsupervised Isolation Forest model. It learns the machine's healthy baseline and calculates an anomaly score from reconstruction error — no failure labels needed.
- 3D Digital Twin — a React dashboard with live 3D mesh rendering dynamically reflects the real-time health status of each machine.
- Bare-Metal I2C — bypasses standard libraries to prevent microcontroller panics during heavy physical vibration
- Hardware-Accelerated FFT — converts time-domain acceleration into frequency-domain data (Hz) directly on the ESP32
- Unsupervised Anomaly Detection — Isolation Forest detects subtle shifts in vibration frequencies and temperature correlations
- 3D Digital Twin HUD — React Three Fiber with conditional mesh rendering: Green = Healthy, Yellow = Warning, Red = Critical
- Real-time Telemetry — live Recharts graphs for motor temperature, vibration magnitude, dominant frequency, and anomaly score
- Multi-machine Support — monitors 6 machines simultaneously (Compressor, Motor Drive, Pump, Conveyor, Robot Arm, Turbine)
- FastAPI Backend — SSE-based streaming API for real-time data push to the frontend
- CSV Data Logger — PySerial logger captures and stores all sensor readings with timestamps
| Layer | Tech |
|---|---|
| Hardware | ESP32-WROOM · MPU6050 · DS18B20 · DHT22 |
| Firmware | C++ / Arduino Core · arduinoFFT · OneWire |
| AI & Backend | Python 3 · Scikit-learn (Isolation Forest) · FastAPI · PySerial · Pandas · NumPy |
| Frontend | React.js · Vite · Tailwind CSS · Recharts · React Three Fiber (WebGL 3D) |
| Sensor | ESP32 Pin | Protocol | Notes |
|---|---|---|---|
| MPU6050 | GPIO 21 (SDA), GPIO 22 (SCL) | I2C | Must be rigidly mounted to motor |
| DS18B20 | GPIO 4 | 1-Wire | Requires 4.7kΩ pull-up resistor |
| DHT22 | GPIO 5 | Digital | Measures ambient temperature & humidity |
Do not power a heavy-vibration DC motor directly from ESP32 pins — use an external isolated power supply to prevent brownouts.
Smart-Industrial-Monitoring/
├── sketch_mar17b.ino # ESP32 firmware — FFT + sensor fusion
├── main.py # FastAPI server + SSE streaming + machine state
├── ai_engine.py # Isolation Forest anomaly detection engine
├── logger.py # PySerial CSV data logger
├── machine_data_log.csv # Recorded sensor telemetry dataset
├── App.jsx # React 3D Digital Twin dashboard
├── requirements.txt # Python dependencies
└── *.glb # 3D model for Digital Twin visualization
- Designed the overall system architecture (Edge DSP → AI Gateway → Digital Twin)
- Wrote the ESP32 firmware — bare-metal I2C, hardware FFT, sensor fusion across MPU6050, DS18B20, and DHT22
- Built and trained the Unsupervised Isolation Forest AI engine (
ai_engine.py) - Led hardware setup, wiring, and physical testing on live motor hardware
- Assisted in building the React frontend and 3D Digital Twin dashboard (
App.jsx) — component structure, telemetry graph integration with Recharts, and real-time state updates - Helped develop the FastAPI backend (
main.py) — API route structure, CORS setup, and SSE streaming endpoint for live data push to the frontend - Assisted with the CSV data pipeline — integrating the PySerial logger output with the backend data processing flow
Project guided by Dr. Ayush Agrawal.
# Install dependencies
pip install -r requirements.txt
# Start the data logger (connect ESP32 first)
python logger.py
# Start the API server
python main.pynpm install
npm run devESP32 (FFT) → Serial → logger.py → CSV → main.py (FastAPI) → SSE → React Dashboard
↓
ai_engine.py (Anomaly Score)
↓
3D Digital Twin (Health Status)
- LSTM Autoencoder for deeper temporal anomaly detection
- Real-time hardware API integration (replace CSV polling)
- Cloud deployment with multi-plant dashboard
- Mobile alerts for critical anomaly events