Inspiration
Every year, industrial plants experience catastrophic fires, toxic gas leaks, and mechanical failures that cost billions of dollars and claim thousands of lives.
When we looked at modern safety systems, we noticed a critical flaw: they are entirely reactive. A gas alarm rings after a toxic leak reaches dangerous concentrations; a thermal sensor triggers after a machine begins to melt.
Furthermore, industrial environments are complex. A small, gradual rise in ambient temperature, a minor spike in volatile gases, and a subtle shift in machine vibration might each look perfectly normal on their own. But when combined, they form a warning sign of an impending disaster.
We were inspired to build a system that acts as a "digital nervous system" for factories—a system that integrates physical sensor data and applies predictive AI to foresee hazards before they manifest.
What it does
Our system is an AI-powered Cyber-Physical System (CPS) that shifts industrial safety from reactive warning to proactive prevention.
By continuously aggregating environmental and mechanical telemetry (gas, temperature, humidity, and vibration), the system processes multiple data streams simultaneously. Instead of waiting for a single sensor to cross a red line, our system analyzes the relationships and patterns of these variables over time. It predicts hazards minutes or hours before they happen, giving operators a window of opportunity to intervene, shut down machines safely, or evacuate the premises.
How we built it
Our solution is built on a three-tier architecture:
- Physical Sensing Layer: We deployed an IoT sensor node utilizing MQ series gas sensors for toxic fumes, DHT11 sensors for micro-climate shifts, and SW-420 sensors for structural vibration telemetry.
- Communication Protocol: The sensor data is published using the MQTT protocol. MQTT's lightweight publish-subscribe model ensures high data throughput with minimal bandwidth overhead, which is critical in noisy industrial environments.
- LSTM Predictive Engine: At the core of the system lies a Long Short-Term Memory (LSTM) Recurrent Neural Network. Because industrial telemetry is sequential, standard feedforward networks fail to capture temporal dependencies.
Let the multi-sensor input vector at time step $t$ be defined as:
[X_t = \begin{bmatrix} x_{\text{gas}} \ x_{\text{temp}} \ x_{\text{humid}} \ x_{\text{vib}} \end{bmatrix}]
The LSTM network processes a sequence of historical vectors ({X_{t-k}, \dots, X_t}) through gate mechanisms (forget gate $f_t$, input gate $i_t$, and output gate $o_t$) to update its internal cell state $C_t$ and hidden state $h_t$:
[f_t = \sigma(W_f \cdot [h_{t-1}, X_t] + b_f)] [i_t = \sigma(W_i \cdot [h_{t-1}, X_t] + b_i)] [C_t = f_t * C_{t-1} + i_t * \tanh(W_c \cdot [h_{t-1}, X_t] + b_c)] [o_t = \sigma(W_o \cdot [h_{t-1}, X_t] + b_o)] [h_t = o_t * \tanh(C_t)]
The hidden state $h_t$, representing the temporal context, is mapped to a real-time Hazard Index $H_t \in [0, 1]$:
[H_t = \sigma(W_y h_t + b_y)]
If $H_t > \theta_{\text{threshold}}$, the system proactively issues warnings or triggers automated safety shutdown actuators.
Challenges we ran into
Handling Sensor Noise and Environmental Drift: Low-cost sensors like the DHT11 and MQ series can suffer from high noise and calibration drift. We solved this by implementing an exponential moving average (EMA) filter directly on the edge microcontroller before transmitting data: [y_t = \alpha \cdot x_t + (1 - \alpha) \cdot y_{t-1}] Where $\alpha = 0.15$ smoothed out transient spikes without introducing latency.
Temporal Alignment of Async Telemetry: The MQ, DHT11, and SW-420 sensors operate at different polling frequencies. Aligning these asynchronous data streams into a single sequence vector $X_t$ was a major challenge. We designed a timestamp-interpolation buffer on our broker gateway to align and normalize the inputs before feeding them to the LSTM model.
Edge Deployment Limitations: Training and running deep learning models on resource-constrained industrial edges can lead to high latency. We optimized our LSTM architecture by reducing the hidden unit size and performing post-training quantization, allowing the predictive engine to output hazard forecasts in under 12 milliseconds.
Accomplishments that we're proud of
- End-to-End Telemetry Pipeline: Successfully developed an end-to-end data pipeline that streams multi-sensor data with near-zero packet loss over MQTT under simulated noisy network conditions.
- Robust Time-Series Prediction: Trained a highly robust LSTM model that predicts anomalous thermal and gas events up to 10 minutes before they cross typical hazard safety thresholds.
- Optimized Latency: Engineered the system to run prediction inferences with sub-15ms latency, proving it is highly viable for real-time edge hardware environments.
What we learned
- The Power of Temporal Context: We learned that absolute sensor values matter less than their temporal rates of change. The LSTM network succeeded where basic threshold checks failed because it recognized trends rather than static numbers.
- Protocol Optimization: We discovered the efficiency of MQTT's Quality of Service (QoS) levels, realizing that QoS 1 (at least once delivery) is crucial to prevent packet loss during industrial radio interference.
- End-to-End CPS Design: Designing a cyber-physical system taught us how to bridge physical electronics with high-level deep learning frameworks, creating a cohesive safety net for real-world industries.
What's next for An Ai Powered Cyber Physical System For Hazard Prediction
- TinyML Integration: Transitioning the edge code to ultra-low-power microcontrollers (like ESP32-S3 or STM32) and running TinyML for locally contained, offline predictions.
- Cloud Dashboard and Over-the-Air (OTA) Updates: Adding a secure web panel and mobile app for remote industrial monitoring and remote model weight updates.
- Live Field Testing: Testing the system in real-world environments like local factories or chemical units to gather live field training datasets.
Built With
- anomaly-detection
- arduino
- cpp
- cyber-physical-systems
- data-preprocessing
- deep-learning
- dht11
- digital-twin
- edge-computing
- embedded-systems
- esp32
- grafana
- iiot
- industrial-safety
- influxdb
- iot
- keras
- lstm
- machine-learning
- moving-average-filter
- mqtt
- mqtt-broker
- nosql
- postgresql
- predictive-maintenance
- publish-subscribe
- python
- real-time-analytics
- recurrent-neural-networks
- sensor-fusion
- sensor-telemetry
- signal-processing
- sqlite
- sw-420
- tensorflow
- time-series
- time-series-forecasting
- timeseries-database
- tinyml
- twilio
Log in or sign up for Devpost to join the conversation.