AI-Driven CNC Failure Detection
Project Github repository
Leveraging Neural Networks for Predictive Maintenance in CNC Milling Machines
Overview
In the realm of advanced manufacturing, predictive maintenance is an invaluable tool for ensuring operational efficiency and minimizing downtime. My recent project focuses on developing a neural network to predict failures in CNC milling machines by analyzing discrepancies between actual and commanded machine states. By leveraging time-series data, Fourier transformations, and recurrent neural networks (RNNs), the project demonstrates my capabilities in data engineering, machine learning, and the practical application of advanced analytics to manufacturing challenges.
Dataset and Context
The dataset, sourced from machining experiments at the University of Michigan’s SMART lab, comprises time-series measurements from CNC milling operations on wax blocks. Each experiment varied tool condition, feed rate, and clamping pressure, producing detailed motor data across X, Y, Z axes, and the spindle. This included:
Position, velocity, and acceleration data (both commanded and actual)
DC bus voltage, output power, and current measurements
Labels indicating tool condition, clamping adequacy, and visual inspection results.
Sampling occurred every 100ms across 18 experiments, enabling robust time-series analysis for tasks such as tool wear detection and clamping failure prediction.
Methodology
Data Engineering
Data preprocessing was a cornerstone of this project, ensuring clean and actionable inputs for the neural network:
Chunking Time-Series Data: Each dataset was divided into overlapping windows (400 samples with a 70% overlap), creating uniform input dimensions for the RNN while preserving temporal relationships.
Error Calculation: I computed the difference between actual and commanded positions, velocities, and accelerations for all axes to uncover machine performance deviations.
Example:
3. Fourier Transformations: For each error metric, real and imaginary components of the Fourier transform were computed to capture frequency-domain characteristics, which often reveal subtle wear or anomalies.
Example:
Visualization and Insights
Throughout preprocessing, I utilized Python libraries like Matplotlib to visualize machine paths, error trends, and Fourier components, ensuring the validity of the data and the transformations. These visualizations highlighted patterns such as increasing high-frequency components in worn tools, indicative of instability or wear.
Neural Network Architecture
For predictive maintenance, I implemented an RNN-based model using TensorFlow:
Input Dimensions: The network accepted 3D tensors representing time-series data, with features derived from the preprocessing steps.
Architecture:
Multiple stacked LSTM layers to capture temporal dependencies.
Fully connected layers with ReLU activation to map extracted features to binary classification outputs (e.g., "Tool Worn" or "Pass Visual Inspection").
Regularization: Incorporated Dropout layers to mitigate overfitting given the relatively small dataset.
Key code snippet:
Training and Validation
Data Splits: I used an 80-20 split for training and validation, with the data shuffled to ensure temporal order did not bias the splits.
Optimizer: The RMSprop optimizer was chosen for its ability to handle the noisy gradients typical in time-series data.
Performance Metrics: Monitored Binary Crossentropy Loss and AUC (Area Under Curve) to evaluate model robustness.
Results and Strengths Demonstrated
Results
The model achieved high accuracy in predicting tool wear and identifying machining issues, with validation AUC exceeding 0.85 after 150 epochs.
Visual inspection of predictions indicated the model's ability to detect failures before they manifested in the machining process.
Skills Highlighted
Data Engineering: Expert-level manipulation and preprocessing of time-series data, including chunking, feature engineering, and Fourier transformations.
Tools: Python, Pandas, NumPy, SciPy.
Visualization: Effective use of Matplotlib for exploratory data analysis, trend identification, and reporting.
Machine Learning: Proficiency in building and training RNNs for time-series classification using TensorFlow/Keras.
Domain Knowledge: Understanding of CNC machine dynamics and their impact on predictive maintenance strategies.
Future Applications
This project has broad implications for predictive maintenance in manufacturing:
Scalability: The approach can extend to real-time monitoring of industrial CNCs.
Adaptability: Techniques like Fourier analysis and RNNs can generalize to other equipment, such as lathes or injection molding machines.
Business Value: Predicting failures proactively reduces downtime, increases operational efficiency, and prevents costly breakdowns.
Conclusion
This project showcases my ability to integrate data engineering, machine learning, and domain expertise to address real-world challenges. My hands-on experience with Python libraries like TensorFlow, Pandas, and SciPy positions me strongly for roles in data engineering, data science, and predictive maintenance. By delivering actionable insights from complex datasets, I am ready to drive value in any organization leveraging data for decision-making.