PrintRite - Tensorflow for 3D Printing

Use PrintRite to watch your printer so you can sleep/work/etc without worry of failures destroying your equipment

Public Chat
Similar projects worth following
PrintRite will of course run on it's own, but I've integrated it with OctoPrint to make an easy to use comprehensive interface that controls and monitors your printer in one place. PrintRite has a lot of future potential to dynamically adjust your printer to counteract problems it sees on your print bed. Right now, it looks for catastrophic failures such as a globbed up nozzle, or fire. So far I've found it to be very reliable and accurate, it PAUSES, RETRACTS, and RAISES the printhead upon a detected failure. So you can maybe salvage a long print that's gone astray. Retraction, Z raise, and failure threshold are ALL adjustable in the settings. It also looks for "smoke", which is enabled if you have a TP-Link (HS100 or HS110). You can also control the plug directly.
If you find PrintRite's classification of your print was incorrect, you can add the (user selectable) number of images to the dataset and RETRAIN. So the more you use it the smarter it g

PrintRite has much potential beyond detecting and avoiding catastrophic failures; 

Governed by possible adjustments available, such as print speed, bed & tool temp, cooling, ambient temp of enclosure, time spent on layers, etc So you get a GOOD print every time.

Eventually, images captured while you print can be uploaded and merged into the dataset, and these constantly improving models would be pushed down with updates. So the dataset will be trained on a vast assortment of print jobs and their particular possible failures. 

Although this is integrated into OctoPrint as a Plugin, there's much more to it than that. Maybe PrintRite could be distributed as a plugin at some future point, but at the moment a single SD card image is the easiest way. Updates won't require a new image, some kind of delta change package yet to be developed is my guess.

I've standardized on the Official Raspberry Pi Camera, I bought 2 from Amazon for $15. So they are cheap enough. PrintRite needs to fit in a hobbyist budget, that's typically an inexpensive printer. Also, a certain camera view is necessary and a standard camera eases the mount design. Every model of printer will need a camera mount design. 

You can't run OctoPrint, Mjpegstreamer, and Tensorflow on a Raspberry Pi 3B+ at the same time. It crashes while printing, every which way I've tested. So I've offloaded Mjpegstreamer to a PiZero, which mounts to the printhead so a long camera cable isn't necessary. The PiZero boots from the 3B+ in gadget mode, and gets it's file system from the 3B+ as well, so no SD card is needed for the PiZero. An ethernet bridge on the 3B+ puts the PiZero on your network. Presumably, you already have a Pi3B+, a decent power supply, and micro USB cables. You can start using PrintRite for less than $20

py - 156.00 bytes - 02/17/2019 at 19:43


resetpi0 - 92.00 bytes - 02/17/2019 at 19:43


py - 3.26 kB - 02/17/2019 at 19:43


py - 3.26 kB - 02/17/2019 at 19:42


extruder (78).stl

Pieces separate like you would print them

Standard Tesselated Geometry - 420.20 kB - 02/17/2019 at 18:15


View all 6 files

  • 1 × RaspBerry Pi 3B + Runs OctoPrint, Tensorflow and boots the PiZero
  • 1 × RaspBerry Pi Zero Runs MjpegStreamer for the camera. You can't run MjpegStreamer, OctoPrint and Tensorflow while printing
  • 1 × 32 GB sdcard Reccomended size this is for the Pi3B+, PiZero boots from Pi3B+ and does not need storage
  • 1 × Official Pi camera, either version The older camera is cheap ($7) and works as good as any. Helps to standardize for the mount.
  • 1 × Pi camera cable for Pi Zero SHort one is fine

View all 7 components

  • Spring is here and I am buried in work

    eric04/03/2019 at 21:34 0 comments

    Doing POS upgrades in multiple Target stores, Walmart keybox? (haven't been there yet), FedEx, and McDonalds DMB's. 

    McD + Target on the same day = no sleep. Maybe this weekend.....

    I did however get a new nozzle, steel instead of brass. I need to do some re-training, I think it's too shiny. 

    The good news is it's not hard to re-train. 1-2 prints in training mode will incorporate the shiny nozzle into the model, from what I've experienced so far anyway. 

  • Working on the camera mount...

    eric03/15/2019 at 16:17 0 comments

    The Maker Select V2 camera mount had quite a few versions, some using an endoscope camera, and some using a large squirrel cage fan with a tube down to the hotend. 

    While functional, I'm not really happy with it so I'm doing it over. I think if it's simpler more will be inclined to try it. 

    I'm also working on an "installable package, separating the Octprint plugin from everything else. Since the pizero filesystem is accessible on the 3B+ , I intend to move everything else to the Pizero image. Then you would just need the plugin, image, and a little setup on the 3B+ to serve the image. 

    Stay Tuned

  • Added a setting for X number of bad images b4 failing:

    eric03/05/2019 at 19:12 0 comments

    Thanks to everyone following this project!

    I'll try to keep the updates coming, I have work too so some might be very incremental. Like this one: 

    I had the script set to NOT FAIL until 3 images were classified as a failure in the posted youtube demo video. I figured this is a value someone may want to change, although I found 3 to be just about right. Might be it's just right for that particular model. So I added a setting for this, defaults to "3".  Should I reset the count to zero after a certain amount of time?  Maybe the printer gets past a tough spot and almost used up all it's chances, and deserves a reset on it's "lives". 

    I'm open to suggestions. Maybe another setting that "After X many layers reset count" or "after X min" or "X fails during X time" ?

    Here's how it stands now: 

  • Moved Tensorflow to the Pi0

    eric02/17/2019 at 19:37 0 comments

    I noticed some serial communication lag between the Pi3B+ and the printer. Further investigation revealed Tensorflow + OctoPrint on a Pi3B+ is still too much. Printing from SD is just fine, but it's back to sneakernet that OctoPrint is supposed to avoid. Tried a wireless SD, but the "good"  hackable Transcend ones are not to be had. Tried setting processor affinity, spreading out the process a little so it doesn't hammer the thing all at once, launching the script separately. 

    I doubted I could run TF on a Pi0, but it wasn't too bad. (I had nightmares of compiling numpy for 8 hrs)

    I think it's actually better now, TF runs on the Pi0, as does the stream. It continuously streams, analyses images, and puts the results in a file. Since the Pi0 filesystem is served by the 3B+  it's easy to get the info up on the OctoPrint navbar. I've ran it like this for 12+ hrs of combined prints and so far so good. 

    I added the ability to restart the Pi0 from the system menu, so you can bounce the zero even while printing. This uses to control the USB power to the Zero. Other configurations may work, but I have the Zero in the bottom USB next to the ethernet jack and the printer in the USB above it. This does not cycle the USB connection to the printer. 

    I wrote a little shell script that automates the power cycle, and repeats the rpiboot sending of the file system. OctoPrint seems to req python for everything so the shell script is launched from python. (this should be simplified in the future).

    Now that that's out of the way I can get back to "prints that fail on purpose"

  • PrintRite was created by me, but was built upon other's work

    eric02/17/2019 at 18:55 0 comments

    So here's a list of what resources I used to put it all together:  User friendly 3DPrinter interface with large user base  How to control the TP-Link  Use this Octoprint plugin for TP-Link control etc  Used some code from this to help write the plugin    How to boot a Pi0 in gadget with no SD  How to control Pi3B+  USB power & reset a Pi0 gadget   Tensorflow  Remixed as part of camera mount

View all 5 project logs

Enjoy this project?



Jibril wrote 02/28/2020 at 14:43 point


  Are you sure? yes | no

Sophi Kravitz wrote 02/28/2020 at 14:01 point

Would love to see more on this! 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates