MechaPulse is an Industrial IoT system that uses acoustic (sound) and thermal analysis to detect faults in rotating machinery in real time. An array of ESP32 embedded devices is deployed across industrial machines; each device continuously monitors machine sound and temperature and applies a TinyML inference model to predict potential faults. Alerts and sensor data are forwarded to a central dashboard for fleet-wide monitoring.
---Developed for SLIoT Challane 2024.
- Project Overview
- System Architecture
- Repository Structure
- Quick Start
- Components
- Documentation
- License
The current prototype demonstrates the full end-to-end pipeline:
- An ESP32 module records audio from a machine and publishes sensor data over MQTT.
- A Raspberry Pi (gateway) receives the data, runs the ML inference model, and exposes results via a FastAPI REST API.
- A Streamlit desktop application provides a graphical interface for model training, testing, validation, and live prediction.
The next stage of the prototype will move ML inference directly onto the ESP32 (TinyML), with the Raspberry Pi serving only as a protocol gateway to a cloud-based dashboard.
┌─────────────────────────────────────────────────────────────────┐
│ Industrial Floor │
│ │
│ ┌──────────┐ Audio ┌──────────────┐ MQTT ┌─────────┐ │
│ │ Machine │──────────▶│ ESP32 │─────────▶│ MQTT │ │
│ │(Rotating │ │ (Firmware) │ │ Broker │ │
│ │Machinery)│ │ WiFi + Mic │ └────┬────┘ │
│ └──────────┘ └──────────────┘ │ │
└───────────────────────────────────────────────────────────────-┘
│ MQTT
┌──────────▼──────────┐
│ Raspberry Pi │
│ (Gateway / Server) │
│ FastAPI | ML Model│
└──────────┬──────────┘
│ REST API
┌──────────▼──────────┐
│ Desktop Application │
│ Streamlit Frontend │
└─────────────────────┘
For detailed architecture documentation see docs/ARCHITECTURE.md.
MechaPulse/
├── desktop-app/ # Desktop monitoring & ML application
│ ├── backend/ # FastAPI inference server
│ │ ├── api/app.py # Full API with audio recording + ML inference
│ │ └── main.py # Lightweight prediction-only API
│ ├── frontend/ # Streamlit multi-page web UI
│ │ ├── main.py # App entry point & navigation
│ │ └── pages/ # Individual workflow pages
│ │ ├── 1_Train.py # Model training interface
│ │ ├── 2_Test.py # Model testing interface
│ │ ├── 3_Validate.py # Model validation interface
│ │ └── 4_Predict.py # Live prediction interface
│ └── trained_models/ # Serialised scikit-learn models (.pkl)
├── device-firmware/ # ESP32 embedded firmware (PlatformIO)
│ ├── src/main.cpp # Main firmware source
│ ├── include/ # Project header files
│ ├── lib/ # Private project libraries
│ ├── legacy-sketches/ # Earlier Arduino prototype sketches
│ │ ├── mqtt/ # Basic MQTT publish sketch
│ │ └── mqttjson/ # MQTT + JSON publish sketch
│ └── platformio.ini # PlatformIO build configuration
├── notebooks/ # Jupyter notebooks for ML development
│ ├── anomaly_detection.ipynb # Unsupervised anomaly detection
│ ├── data_collection.ipynb # Raw data capture & labelling
│ ├── failure_classification.ipynb # Multi-class fault classification
│ ├── machine_failure_prediction.ipynb # Binary failure prediction
│ ├── assets/ # Images & audio samples
│ └── data/ # Training & validation CSV datasets
├── docs/ # Detailed technical documentation
│ ├── ARCHITECTURE.md # System architecture
│ ├── API_REFERENCE.md # REST API reference
│ ├── SETUP_GUIDE.md # Installation & configuration
│ ├── DATA_PIPELINE.md # Data & ML pipeline
│ └── CONTRIBUTING.md # Contribution guidelines
└── README.md # This file
| Component | Requirement |
|---|---|
| Python | ≥ 3.9 |
| PlatformIO CLI | latest |
| MQTT Broker (Mosquitto) | any version |
| ESP32 DevKit | any variant |
git clone https://github.com/AkinduID/MechaPulse.git
cd MechaPulsecd desktop-app
# Install Python dependencies
pip install fastapi uvicorn pydantic numpy pandas scikit-learn \
streamlit sounddevice soundfile scipy
# Start the backend API server
python backend/main.py # runs on http://localhost:8000
# In a separate terminal, start the Streamlit frontend
streamlit run frontend/main.py # runs on http://localhost:8501cd device-firmware
# Edit WiFi & MQTT credentials in src/main.cpp, then build & upload
pio run --target uploadcd notebooks
pip install jupyter scikit-learn pandas numpy matplotlib scipy
jupyter notebookSee docs/SETUP_GUIDE.md for full environment setup and configuration options.
| Component | Technology | Description |
|---|---|---|
| Desktop App | FastAPI · Streamlit | Backend inference API and ML management UI |
| Device Firmware | C++ · Arduino · PlatformIO | ESP32 audio capture and MQTT telemetry |
| ML Notebooks | Python · Jupyter · scikit-learn | Model development, training and evaluation |
| Document | Description |
|---|---|
docs/ARCHITECTURE.md |
End-to-end system architecture |
docs/API_REFERENCE.md |
REST API endpoint reference |
docs/SETUP_GUIDE.md |
Installation & configuration guide |
docs/DATA_PIPELINE.md |
Data collection & ML pipeline |
docs/CONTRIBUTING.md |
How to contribute |
This project is maintained by the MechaPulse team. See repository settings for license details.
