DEV Community

Cameron Palmer
Cameron Palmer

Posted on Originally published at cameronmpalmer.com on

Teaching Manufacturing Machines to See: How AI Could Solve 3D Printing Failures

Introduction

In the last decade, desktop 3D printing has transformed from an expensive industrial technology into an accessible tool for creators and makers worldwide. As a computer engineering student at Clarkson University, I became fascinated with this technology's potential to revolutionize manufacturing, prototyping, and design. However, I quickly discovered a frustrating reality: 3D printing remains plagued by frequent print failures that waste time, materials, and money.

Therefore, in April of 2023, I set out to tackle one of 3D printing's most persistent challenges: automated error detection. Using computer vision and artificial intelligence, I developed a system that could detect layer shifts, a common print failure, without human supervision. This project represents not just a technical solution, but a step toward bringing the power of digital fabrication to everyone by reducing the expertise required to use these remarkable machines successfully.

You can find this project's full report and code below, in the Appendix.

The Desktop 3D Printing Challenge

Desktop fused filament fabrication (D-FFF) 3D printers work by melting plastic filament and depositing it in two-dimensional layers, layer by layer, to build three-dimensional objects. While the expiry of patents in the last fifteen years has dramatically reduced barriers to running your own machine at home, they still require significant technical knowledge to operate successfully.

One particularly frustrating failure is the "layer shift," occurring when the machine's rubber belts slip over the stepper motor's drive gears during fast movements. Because these printers use open-loop control systems, they don't know when this happens. The result is a visible misalignment in the printed object, often rendering the entire print useless after hours of printing and wasted material.

The impact of layer shifts. (a): The correct model. (b)-(f): Models containing a layer shift error

Currently, the only reliable method for detecting these failures is human observation, requiring users to constantly monitor their prints or risk wasting resources. This creates a significant issue for newcomers and limits the technology's practical applications in settings where constant supervision isn't feasible.

A Solution

To address this challenge, I developed a system using computer vision that could automatically detect layer shifts during the printing process. The first obstacle was the lack of relevant data, since no readily-available dataset of 3D printing failures existed for training an AI model such as this.

I created a custom dataset by capturing thousands of images of printing objects using a Raspberry Pi and camera mounted to an Ender 3 V2 printer. To generate examples of layer shifts without waiting for random failures, I developed a "G-code injection" method, a technique that programmatically modifies the printer's instructions to create deliberate layer shifts at random heights, directions, and distances.

Ender 3 V2 and camera experimental setup

With this dataset, I implemented a ResNet18 convolutional neural network using PyTorch Lightning. This deep learning architecture has shown excellent performance in image classification tasks and could be trained to distinguish between images of normal prints and those containing layer shifts.

Experiment Results

After training for 36 hours on an NVIDIA RTX 3090 GPU, the model achieved a validation accuracy of 91% on individual images. When implemented in a real-time detection system, it successfully identified layer shifts in 5 out of 6 test prints, an 83% accuracy rate with a maximum detection delay of 70 seconds.

The system revealed an inherent trade off: increasing the detection delay tolerance improved detection rates but reduced the timeliness of alerts. Analysis of misclassified images showed the network struggled most with small layer shifts occurring at lower layer heights, situations where even human observers would have difficulty making accurate judgments.

Despite these limitations, the system demonstrated that computer vision could reliably detect print failures without human supervision, potentially saving significant time and material for 3D printing enthusiasts and professionals alike.

Images of shifted prints, with failures detected (left) and undetected (right)

Broader Applications

Automated error detection systems could significantly lower the barrier to entry for desktop-based 3D printing machines. By eliminating the need for constant supervision, these tools make 3D printing more accessible for beginners and more practical across the board.

In education, schools could implement 3D printers with less concern about wasted materials or failed prints disrupting classroom activities. For rapid prototyping, engineers could run multiple printers simultaneously with fewer resources dedicated to monitoring. In small-scale manufacturing, overnight or unattended production becomes more viable without risking substantial material waste.

Beyond 3D printing, the computer vision approach demonstrated in this project has applications in quality control for manufacturing, agricultural crop monitoring, medical image analysis, and other fields where visual inspection traditionally requires human expertise. These technologies point towards a future where complex visual tasks can be automated reliably.

The Future of Intelligent 3D Printing

The field of automated 3D print monitoring has numerous promising directions for advancement. One compelling approach would be projecting the original 3D model's expected geometry onto camera images of the build plate, creating a digital overlay to detect discrepancies in real-time. This computer vision technique could identify not just layer shifts but theoretically any geometric deviation from the intended design, especially when used with camera images from multiple angles.

LiDAR technology presents another exciting possibility. By scanning the print's actual geometry during manufacturing and comparing it to the expected 3D model, a system could detect sub-millimeter deviations across the entire object's surface. Such technology is becoming more affordable and compact, making these systems less theoretical and more practical. In fact, LiDAR is already being used in some commercial FFF printers, albeit not for print failure detection (yet).

Other possibilities include thermal imaging to detect improper layer adhesion, acoustic monitoring to identify mechanical issues before they cause failures, and even machine learning models that learn from fleet-wide data to predict failures before they occur. These technologies collectively point toward a future of fully autonomous 3D printing systems that reliably produce useful models with minimal human oversight.

The Path Forward

This experiment demonstrated the significant potential of computer vision and AI to solve fundamental challenges not only in 3D printing, but in manufacturing in general. By addressing the problem of print failures, this work contributes to a future where desktop manufacturing machines can become reliable tools rather than finicky hobby devices requiring constant attention and expertise.

This vision continues through my work on the Hydrogen compact 3D printer, which incorporates AI-based failure detection alongside automatic build plate tramming and first layer height adjustment. By combining high-quality components with intelligent monitoring systems in a desktop-friendly form factor, Hydrogen represents the next step toward truly accessible 3D printing.

Hydrogen 3D printer prototype

The broader lesson is powerful: applying AI to practical engineering challenges can break through long-standing barriers that traditional approaches have failed to overcome. As these technologies mature, they promise to revolutionize not just personal manufacturing but entire supply chains. Imagine a world where critical components can be produced locally during disruptions, where remote communities aren't dependent on complex supply chain logistics for essential items, and where production becomes decentralized and resilient. By making intelligent manufacturing accessible to all, we're not just improving a technology, we're democratizing access to physical goods in ways that could fundamentally reshape how we produce and distribute the things we need.

Appendix

Top comments (0)