Inspiration

Unplanned industrial machinery downtime costs the manufacturing sector billions annually. Traditional predictive maintenance relies heavily on streaming raw, high-frequency sensor data to the cloud. This approach introduces unacceptable latency, demands massive bandwidth, and creates a single point of failure if the factory network drops. I realized the bottleneck wasn't the data, but the architecture. I wanted to build an autonomous system that brings the intelligence directly to the edge—catching mechanical and electrical faults the millisecond they occur without relying on a cloud server.

What it does

This project is an Edge-AI Industrial IoT (IIoT) predictive maintenance node. It acts as an autonomous hardware supervisor. Instead of monitoring a single metric, it performs multi-modal sensor fusion: analyzing tri-axial vibration, temperature, and current draw simultaneously. By executing lightweight machine learning directly on the microcontroller, it classifies the machinery's operational state (Normal vs. Anomaly) in real-time, operating completely offline.

How we built it

The hardware centers around an ESP32-S3 microcontroller, interfaced with an MPU6050 (6-axis IMU) for vibration, alongside thermal and current sensors.

The software stack is built in C/C++ utilizing the ESP-IDF framework. To handle the strict timing constraints, I architected the firmware using FreeRTOS. I heavily relied on RTOS task management to decouple the high-frequency I2C sensor acquisition from the computationally heavy inference task, utilizing queues to safely pass data without dropping samples.

For the TinyML pipeline, I used the Edge Impulse SDK. The DSP block performs localized feature extraction (like FFT for mechanical harmonics), which is then fed into an anomaly detection model via K-Means clustering. The clustering objective minimized during inference can be mathematically represented as:

$$J = \sum_{i=1}^{k} \sum_{x \in S_i} || x - \mu_i ||^2$$

This allows the node to rapidly calculate the Euclidean distance of incoming multi-modal feature vectors against the known "normal" operational cluster, flagging anomalies instantly.

Challenges we ran into

The primary challenge was managing the ESP32's SRAM and execution blocking. Capturing high-frequency mechanical data over I2C fast enough to catch meaningful harmonics—without overflowing the memory buffers before the inference task could run—required precise tuning of the FreeRTOS scheduler and interrupt priorities. Balancing the mathematical weight of the DSP extraction against the limited clock cycles of the MCU was a continuous trial-and-error process.

Accomplishments that we're proud of

I am incredibly proud of achieving a true localized edge architecture. Successfully fusing three distinct sensor modalities (vibration, temp, current) and executing the DSP and inference pipeline locally without a single byte of raw data needing to hit a cloud server is a massive validation of the system's efficiency.

What we learned

This project forced a deep dive into the realities of hardware-constrained machine learning. I learned the critical differences between designing models in Python versus optimizing them for C/C++ compilation on edge silicon. It also drastically improved my understanding of concurrency, memory mapping, and IPC (Inter-Process Communication) within FreeRTOS.

What's next

With the local anomaly detection functional, the next phase on the scalability roadmap is implementing lightweight telemetry. Instead of raw data, the ESP32 will package the classified anomaly states and broadcast them via MQTT to a central, fleet-wide dashboard, allowing plant managers to monitor hundreds of these nodes simultaneously.

Built With

  • c
  • c++
  • edge-impulse-sdk
  • esp-idf
  • esp32
  • freertos
  • i2c
  • mpu6050
  • tinyml
Share this project:

Updates

Submission history