Skip to content

A post processing script for OrcaSlicer that demonstrates how automatically adjusting Nozzle Temperature and Flow rate (Print Speed) can significantly improve both print time and quality, while also simplifying slicer settings.

License

Notifications You must be signed in to change notification settings

sb53systems/G-Code-Flow-Temperature-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

G-Code Flow and Temperature Controller

A free and open-source post-processing script for OrcaSlicer to simplify 3D printing.

This script dynamically adjusts nozzle temperature and print speed (flow rate) to significantly improve print quality and reduce print time, all while simplifying slicer settings. By optimizing these parameters, it makes 3D printing more accessible and less complex.

How Does It Work?
Filament gradually absorbs heat as it travels through the hotend, requiring extrusion at an optimal final temperature. This script calculates the average flow rate every second and dynamically adjusts the nozzle temperature accordingly. It also modifies print speed in the G-code to match the ideal flow rate, considering layer height and line width.

Why This Script?
Inspired by my personal approach and developed with basic Delphi programming skills, this is a proof of concept demonstrating the potential of integrating such features into slicer software. Doing so could unlock even greater efficiency and advanced capabilities for 3D printing.

What’s Next?
I now rely on this script for all my prints, even with my old Klipper-based printer and low-cost filament. I keep 90% of my slicer settings unchanged, proving this method’s reliability and flexibility. I believe this approach—or something similar—could shape the future of 3D printing and make it truly accessible to everyone.

Test, Share, Improve!
Your feedback and ideas are welcome. Let’s innovate and push the boundaries of 3D printing together:
"Alone we go faster; together we go further."

IMG20240927152206

⚠️ Please use this script responsibly and with caution, applying reasonable values and closely monitoring your printer's behavior.

Happy Smart 3D Printing :)

See my OrcaSlicer Settings ⚙️
See the Print Samples Discussion, Share yours 💡

If you find my work worthy, Bay me a image and give this project a ⭐. Thank you 🌹

About this Repository

By Salim BELAYEL.

Discord: sb53systems
Email : [email protected]

This project began in June 2024.
Compiled with Delphi 12 Community Edition (Free for windows, MacOS, and Android).
I thank everyone who participated in this project even indirectly ❤️

SB53-Systems~1

Latest Release (Download Link)

image
(Updated in November 03 2024)

Addons:

  • Compatibility with All Firmwares.
  • Arcs moves support.
  • Improve GCode reading and generation time with a Custom Klipper Estimator script.

Note

You can retain your old script configuration after an update by using your old "/Config" folder from the previous version. Simply replace the files "SB53-Systems.exe" and "Klipper_estimator.exe.". Note that the final version 1.1 include a different Klipper_Estimator script.

Next Features

  • Allow more advanced optimization for different printing features (Overhangs, Outer wall, Bridges, ...more).
  • ... Add an explainer video on youtube and instructions on how to use it.

Video that speak about the project on Youtube

By PRINTING PERSPECTIVE

  • Variable Temperature 3D Printing – The FUTURE of 3D Printing?
    Sans titre
  • World’s First INDUCTIVE Hotend – How Crazy IS IT?
    image

Instructions and Prerequisites

  1. The script can be used as a standard program by running the SB53-Systems.exe file and manually opening a G-Code file, or by integrating it into the slicer as a post-processing script.

    D:\SB53_G-Code_Flow_Temperature_Controller_V1.1\SB53-Systems.exe;
    

    image

  2. Included a Custom version of Klipper_Estimator V 3.7.3. An accurate tool that uses Klipper Look-Ahead kinematics to estimate the time and average flow rate for each move in the G-Code. (+/- 1s total time for Klipper Firmware). The mechanism is very close to other Firmwares (+/- 5% if used correctly).
    Note that the file \Klipper_estimator.exe (already included) is required and must be in the same Folder with this Script.
    image

  3. Editing the First Layer Temperature is important, the script can :

    • Edit the specified "Start Print" Macro (Klipper).
      image
      image

    • Edit the "M109 S" G-Code command, provided that:

      • It is preceded by the comment "; Temp_To_Edit"
       ; Temp_To_Edit
      

      image

      • And add the comment "; PRINT_END" at the start of the Machine End G-Code, this will allow the script to avoid the print end Moves.
       ; PRINT_END
      

      image

  4. The Initial Temperature estimated by the Script depends on the speed of the first moves of the G-Code, you can adjust it by fixing the speed of the Purge Line or the speed of the First layer Perimeters.

  5. To have a best Speed/Quality Optemization, the Slicer Profil must be set for Max Moves and Max Volumetric Speed. The Nozzle temperature is not important because it will be reset in the script, and the speed will be reduced (not increased) to the Recommended Flow.
    Example below with my max 200mm/s Printer speed : (Same profil for PLA, PETG and ABS)

    image

    The speed of Overhangs and small Internal/External Bridges should be set to the maximum speed, this will ensure that the filament is extruded at the recommended flow rate and that it is not too hot and falls off, or too cold and shrinks, also avoiding sudden flow changes and unnecessary temperature drops caused by the average flow calculated by the script.
    image
    See my overhangs test examples.

    For larger bridges, I use Thick Bridges in Orca Slicer and a single 5015 radial fan for part cooling, there is not much deference between a 60mm bridge at 30mm/s and another at 100mm/s, and since I don't print a lot of wide bridges, I prefer to keep an automatic speed.
    See my Bridge test examples.

    You can use a modifier (or more) in the slicer that changes the speed of a few lower layers to the bridge, the temperature and speed should gradually decrease to the desired bridge speed. Example bellow for 50mm/s External Bridge speed. (This approach can only be optimized when it is integrated into the Slicer)
    image
    image

  6. You have to set your filament settings:

    • The maximum recommended volumetric speed at the maximum temperature that your Hotend or Filament can handle.
    • The Fan Cooling perdiode and the Min print speed, according to the Filament and your cooling configuration.

    You can reduce the speed of the Cooling Fan (Except for Bridges and Ovehangs), the Min Print Speed, and the Min Layer Time.
    image
    image

Note that :

  • The script is specifically programmed to reduce speeds only when they exceed the recommended flow rate, while lower speeds will remain as set in the G-Code (Slicer speed).

  • The script does not display the temperature curve in the generated G-Code Chart if Arcs moves are used. This is due to the integration and interpretation of the Klipper_Estimator output.

  • PA can be adjusted based on temperature only for Klipper firmware. For other firmwares you need to uncheck the Adjust PA option.

  • Changing PA while printing can cause bubbles in the walls. The script is programmed to adjust PA only in sparse infill, internal solid infill, support, and internal bridges.
    351913375-991fe2b8-3935-46ff-816e-5b0aee981b4d

  • This script doesn't support Multi-Tool or Multi-Material printing.

  • For a Bambu Lab 3D printer, you need to Avoid Flow Calibration and First Layer Inspection used at the beginning of the print.

  • Ironing is not recommended with this script, as it can affect the desired results and increase printing time.

  • Adaptive Pressure Advance is not recommended with this script.

  • Delta Printers kinematic limits are not supported with the current version of Klipper Estimator.

  • Reading or generating large G-Code files with this Script can takes up to 2 minutes, depending in your CPU.

  • Processing G-Code with Arcs Moves will take longer, because the Klipper Estimator script will cut them into small segments based on the parameter "mm_per_arc_segment": 0.1.

  • The generated G-Code is 10% to 30% larger than the original one due to Temp and Speed adjustment.

  • This script is currently only available for Windows OS. With Delphi 12 and some changes to the source code, it can be compiled for other operating systems (I can help with this or do it later!).

Ideal Flow/Temperature Calibration

The visual calibration method (effective for PETG, PLA, etc.) involves selecting the desired appearance (closest to the original filament) over 3 to 5 prints:

  1. For high flow rates (>3mm³/s), print a Cylinder in Vase Mode (You can use the maximum layer height and maximum line width), while limiting the maximum volumetric speed to the desired test flow rate. Start with the maximum recommended temperature, then manually and gradually reduce the temperature during printing. (This step should be done without the script)
  2. For flow rates below 5 or 3 mm³/s, print small object like a 3DBenchy at 20% or 30% scale. (This step should be done with the script)

Note:

  • This method is not suitable for non-shiny filaments or those that do not change color. To determine the ideal values, other advanced solutions will be necessary, particularly for assessing layer adhesion, dimensional accuracy, or the final temperature of the extruded filament.
  • This script allows to play with only three Flow/Temperature values, which means it will adjust them linearly.

The ideal would be to obtain the final temperature of the extruded filament using a more accurate and automated solution that gives a curve closer to reality!
This will also be useful with Filaments that cannot be visually calibrated.

I challenge makers to find a precise, cost-effective, and user-friendly solution for the majority of 3D printers 🚀

Observations and Tips

  • I recommend that you calibrate your PID values ​​for a temperature between 70% and 90% of the maximum temperature.
  • A printer with higher accelerations and lower hotend heating/cooling time, will have a better result with this approach because it allows for better flow stabilization (Quality) and Higher Max/Average Flow (Speed).
  • With a resonable Edeal Flow/Temperature calibration, the same good quality is achieved with the majority of filament brands without any changes in the script.
  • With some prints, changing the Max/Average Smoothing value may affect the result and print time, you have to experiment yourself (I recommend values between 10 and 30).
  • Aim for Speed Optimization as long as it doesn't affect the desired quality, usually the printing time will only vary by a few minutes.
  • If your filament is very sensitive and you need to reduce the speed for overhangs or small features in between large features, aim for Quality Optimization to reduce flow variation.
  • Fuzzy Skin, Variable_Layer_Height and Scarf_Joint_Seam can cause print delay due to frequent flow changes.
  • The outer wall speed is greater than the inner wall speed due to a deferent line width. This script will adapt the speed to any line width and layer height, making it very effective for Variable_Layer_Height and Precise_Z_Height.
    371310408-26026ed0-d97e-4423-9d84-68c5b2a863e8
    image

Usage

The script will popup once you Print or Export the G-Code from the Slicer, ask the user whether the script will be applied or not.

image

If yes, the first execution:

  • You have to set the appropriate Extruder/Printer values.
  • Klipper Estimator script requires a file containing the maximum limits of the printer (config .json).
    • For Klipper, you can get this file by entering the printer's IP address or by selecting a local file.
    • For other firmware, you'll need to edit the file manually and input the equivalent values.
      Config.json file Example:
    {
    "max_velocity": 400.0,
    "max_acceleration": 10000.0,
    "minimum_cruise_ratio": 0.5,
    "square_corner_velocity": 5.0,
    "instant_corner_velocity": 1.0,
    "mm_per_arc_segment": 0.1,
    "move_checkers": [
      {
        "axis_limiter": {
          "axis": [
            0.0,
            0.0,
            1.0
          ],
          "max_velocity": 5.0,
          "max_accel": 200.0
        }
      },
      {
        "extruder_limiter": {
          "max_velocity": 106.43243214765772,
          "max_accel": 2660.8108036914427
        }
      }
    ]
    }
    
    Note that You have to set this file for each Printer/Extruder preset.
  • After saving the Extruder/Printer preset, you need to select the Filament Type, then set the filament values (start with 1mm3/2) and save with a specific name. (for each Extruder)
    image

Note that:

  • In subsequent uses, the script can recognize the Extruder/Printer and Filament used, if they are written with the same name as in the slicer (Copy and Paste).
    imageimage
    imageimage
  • If you make any changes to the script, be sure to refresh the estimation and then regenerate the G-Code.
    image

3DBenchy Example

image
image

Below is the Generated G-Code

image
a3204c69-90d5-42a7-bcb5-144e6ae8c590

About

A post processing script for OrcaSlicer that demonstrates how automatically adjusting Nozzle Temperature and Flow rate (Print Speed) can significantly improve both print time and quality, while also simplifying slicer settings.

Resources

License

Stars

Watchers

Forks

Languages