Scripts for measuring and displaying thermal behavior on Voron 3D printers

Overview

Thermal Profiling

Measuring gantry deflection and frame expansion

This script runs a series of defined homing and probing routines designed to characterize how the perceived Z height of the printer changes as the printer frame heats up. It does this by interfacing with the Moonraker API, so you will need to ensure you have Moonraker running.

First, download the script measure_thermal_behavior.py to your printer's Pi. My favorite way to do this is to ssh into the Pi and just clone this git repository:

git clone https://github.com/tanaes/measure_thermal_behavior.git

Edit script for your printer

You'll need to edit the script (please use a vanilla text editer, such as Nano, that doesn't fuck with line endings) to include parameters appropriate for your printer. Please also fill in the META DATA section - this will help us find patterns across printer configurations!

######### META DATA #################
# For data collection organizational purposes
USER_ID = ''            # e.g. Discord handle
PRINTER_MODEL = ''      # e.g. 'voron_v2_350'
HOME_TYPE = ''          # e.g. 'nozzle_pin', 'microswitch_probe', etc.
PROBE_TYPE = ''         # e.g. 'klicky', 'omron', 'bltouch', etc.
X_RAILS = ''            # e.g. '1x_mgn12_front', '2x_mgn9'
BACKERS = ''            # e.g. 'steel_x_y', 'Ti_x-steel_y', 'mgn9_y'
NOTES = ''              # anything note-worthy about this particular run,
                        #     no "=" characters
#####################################

######### CONFIGURATION #############
BASE_URL = 'http://127.0.0.1'       # printer URL (e.g. http://192.168.1.15)
                                    # leave default if running locally
BED_TEMPERATURE = 105               # bed temperature for measurements
HE_TEMPERATURE = 100                # extruder temperature for measurements
MEASURE_INTERVAL = 1
N_SAMPLES = 3
HOT_DURATION = 3                    # time after bed temp reached to continue
                                    # measuring, in hours
COOL_DURATION = 0                   # hours to continue measuring after heaters
                                    # are disabled
SOAK_TIME = 5                       # minutes to wait for bed to heatsoak after reaching temp
MEASURE_GCODE = 'G28 Z'             # G-code called on repeated measurements, single line/macro only
QGL_CMD = "QUAD_GANTRY_LEVEL"       # command for QGL; e.g. "QUAD_GANTRY_LEVEL" or None if no QGL.
MESH_CMD = "BED_MESH_CALIBRATE"

# Full config section name of the frame temperature sensor
FRAME_SENSOR = "temperature_sensor frame"
# chamber thermistor config name. Change to match your own, or "" if none
# will also work with temperature_fan configs
CHAMBER_SENSOR = "temperature_sensor chamber"
# Extra temperature sensors to collect. Use same format as above but seperate
# quoted names with commas (if more than one).
EXTRA_SENSORS = {"frame1": "temperature_sensor frame1",
                 "z_switch": "temperature_sensor z_switch"}

#####################################

Note that if you want to calculate your printers frame expansion coefficient, you will need to include a frame temperature sensor definition.

If you haven't already, copy the modified measure_thermal_behavior.py to the Pi running Klipper/Moonraker.

Modify printer config

You may want to adjust a few elements of your printer configuration to give the most accurate results possible.

In particular, we have found that long/slow bed probing routines can influence results as the bed heats up the gantry extrusion over the course of the mesh probing! This often manifests as an apparent front-to-back slope in the mesh.

For our purposes, a quick probe is usually sufficient. Below are some suggested settings:

[probe]
##  Inductive Probe - If you use this section , please comment the [bltouch] section
##  This probe is not used for Z height, only Quad Gantry Leveling
##  In Z+ position
##  If your probe is NO instead of NC, add change pin to ^PA3
pin: ^PA3
x_offset: 0
y_offset: 18.0
z_offset: 8
speed: 10.0
lift_speed: 10.0
samples: 1
samples_result: median
sample_retract_dist: 1.5
samples_tolerance: 0.05
samples_tolerance_retries: 10


[bed_mesh]
speed: 500
horizontal_move_z: 10
mesh_min: 30,30
mesh_max: 320,320
probe_count: 7,7
mesh_pps: 2,2
relative_reference_index: 24
algorithm: bicubic
bicubic_tension: 0.2
move_check_distance: 3.0
split_delta_z: .010
fade_start: 1.0 
fade_end: 5.0

Adjust printer hardware

There are a couple hardware tips we've found that help to yield repeatable and accurate results.

Make sure nozzle is clean

If you are using a nozzle switch style endstop (as in stock Voron V1/V2), plastic boogers can ruin a profiling run. Make sure it is clean before the run!

Loosen bed screws

We have seen that over-constraint of the bed can severely impact mesh reliability at different temperatures. For optimal results, we suggest only having a single tight bed screw during profiling.

Run data collection

For accurate results, ensure the entire printer is at ambient temp. It can take a couple hours for the frame to cool down completely after a run!

Run the script with Python3:

python3 measure_thermal_behavior.py

You may want to run it using nohup so that closing your ssh connection doesn't kill the process:

nohup python3 measure_thermal_behavior.py > out.txt &

The script will run for about 3 hours. It will home, QGL, home again, then heat the bed up.

While the bed is heating, the toolhead will move up to 80% of maximum Z height. This is to reduce the influence of the bed heater on the X gantry extrusion as much as possible while the bed heats.

Once the bed is at temp, it will take the first mesh. Then it will collect z expansion data once per minute for the next two hours. Finally, it will do one more mesh and then cooldown.

Processing data

The script will write the data to the folder from which it is run.

You have two options to generate plots: run the plotting scripts on the Pi, or run them on your PC.

Running on the RPi

You'll need to install some additional libraries to run the plotting scripts on the Pi. First, use apt-get to install pip for python3 and libatlas, which is a requirement for Numpy:

sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install libatlas-base-dev

Then, you can use pip via python3 to install the plotting script dependencies using the requirements.txt file from this repository:

python3 -m pip install -r requirements.txt

Finally, to generate the plots, just call:

process_meshes.py thermal_quant_{}.json.

You can include as many json-formatted datafiles as you want as positional arguments.

Running on the PC

To run on your PC, download the thermal_quant_{}.json results file.

The rest is left as an exercise to the reader.

You might also like...
This repository contains all the code and files needed to simulate the notspot quadrupedal robot using Gazebo and ROS.
This repository contains all the code and files needed to simulate the notspot quadrupedal robot using Gazebo and ROS.

Notspot robot simulation - Python version This repository contains all the files and code needed to simulate the notspot quadrupedal robot using Gazeb

This allows you to record keyboard and mouse input, and play it back using pynput.

Record and Play with Python! This allows you to record keyboard and mouse input, and play it back (with looping) using pynput. It allows for automatio

Example code and projects for FeatherS2 and FeatherS2 Neo
Example code and projects for FeatherS2 and FeatherS2 Neo

FeatherS2 & FeatherS2 Neo This repo is a collection of code, firmware, and files

This is the remake of the program PYOBD. It works on Python3 and all new libraries. It was tested on Linux, Windows, and it should work on MAC too.
This is the remake of the program PYOBD. It works on Python3 and all new libraries. It was tested on Linux, Windows, and it should work on MAC too.

This is the remake of the program PYOBD. It works on Python3 and all new libraries. It was tested on Linux, Windows, and it should work on MAC too. You just need an ELM327 USB or bluetooth device and a PC(laptop preferably).

This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.
This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

I made this so I can control my Tapo L510 light bulb and Govee H6159 light strip using the PyP100 module and the Govee public API

TAPO-And-Govee-Controller I made this so I can control my Tapo L510 light bulb and Govee H6159 light strip using the PyP100 module and the Govee publi

It is a program that displays the current temperature of the GPU and CPU in real time and stores the temperature history.
It is a program that displays the current temperature of the GPU and CPU in real time and stores the temperature history.

HWLogger It is a program that displays the current temperature of the GPU and CPU in real time and stores the temperature history. Sample Usage Run HW

An IoT Trivia app that shows you how to take a JSON web API such as the opentdb.com API and stream and display it on a FeatherS2 in an OLED display.
An IoT Trivia app that shows you how to take a JSON web API such as the opentdb.com API and stream and display it on a FeatherS2 in an OLED display.

CircuitPython IoT Trivia ESP32-S2 OLED Version An IoT Trivia app that shows you how to take a JSON web API such as the opentdb.com API and stream and

Small Robot, with LIDAR and DepthCamera. Using ROS for Maping and Navigation
Small Robot, with LIDAR and DepthCamera. Using ROS for Maping and Navigation

🤖 RoboCop 🤖 Small Robot, with LIDAR and DepthCamera. Using ROS for Maping and Navigation Made by Clemente Donoso, 📍 Chile 🇨🇱 RoboCop Lateral Fron

Comments
  • handle gear_ratio config changes

    handle gear_ratio config changes

    Handle gear_ratio config changes resulting in list rather than string. Also arbitrarily long gear ratios, e.g. 19:21:69...etc. https://github.com/KevinOConnor/klipper/commit/e37d2dee908229fb0f9477cf30ce77834d77f998

    opened by alchemyEngine 0
  • measure_thermal_behavior: temp_data restructure, tweaks

    measure_thermal_behavior: temp_data restructure, tweaks

    Reformat temp_data data structure as e.g:

        "temp_data": {
            "2021/08/02-18:09:24": {
                "ambient_t": 25.045069874183582,
                "bed_target": 105.0,
                "bed_temp": 70.55504880410373,
                "chamber_temp": 28.64916624748446,
                "frame_temp": 25.01276217159301,
                "he_target": 100.0,
                "he_temp": 100.10888741760135,
                "mcu_z": -5587,
                "sample_index": 0
            },
            "2021/08/02-18:09:28": {
                "ambient_t": 25.01276217159301,
                "bed_target": 105.0,
                "bed_temp": 70.96215755085439,
                "chamber_temp": 28.462018360494767,
                "frame_temp": 24.899409750362793,
                "he_target": 100.0,
                "he_temp": 99.61074527343162,
                "mcu_z": -5586,
                "sample_index": 0
            }
       }
    

    Move start_time to after bed is heated, remove extra start_time from before cold measurements.

    opened by alchemyEngine 0
  • KeyError: 'result' when script is run

    KeyError: 'result' when script is run

    I get the following error when trying to run the script image

    Software Versions: image

    Here is what i have in the config and meta data section:

    ######### CONFIGURATION ############# BASE_URL = 'http://127.0.0.1:7125' # printer URL (e.g. http://192.168.1.15) # leave default if running locally BED_TEMPERATURE = 105 # bed temperature for measurements HE_TEMPERATURE = 100 # extruder temperature for measurements MEASURE_INTERVAL = 1 N_SAMPLES = 3 HOT_DURATION = 3 # time after bed temp reached to continue # measuring, in hours COOL_DURATION = 0 # hours to continue measuring after heaters # are disabled SOAK_TIME = 5 # minutes to wait for bed to heatsoak after reaching temp MEASURE_GCODE = 'G28 Z' # G-code called on repeated measurements, single line/macro only QGL_CMD = "QUAD_GANTRY_LEVEL" # command for QGL; e.g. "QUAD_GANTRY_LEVEL" or None if no QGL. MESH_CMD = "BED_MESH_CALIBRATE"

    Full config section name of the frame temperature sensor

    FRAME_SENSOR = ""

    chamber thermistor config name. Change to match your own, or "" if none

    will also work with temperature_fan configs

    CHAMBER_SENSOR = ""

    Extra temperature sensors to collect. Use same format as above but seperate

    quoted names with commas (if more than one).

    EXTRA_SENSORS = {}

    #####################################

    opened by gecko779 0
  • Fix error when [stepper_z] gear ratio undefined

    Fix error when [stepper_z] gear ratio undefined

    Using ['configfile']['settings'] returns all defaults, therefore there is always a ['gear_ratio'] key. Check for empty list instead of checking for the key.

    opened by alchemyEngine 0
Owner
Jon Sanders
Jon Sanders
Parametric open source reconstructions of Voron printed parts

The Parametric Voron This repository contains Fusion 360 reconstructions of various printed parts from the Voron printers

Matthew Lloyd 26 Dec 19, 2022
Python application, displaying currently played track from Spotify on OLED display connected via I2C

RaspberryPi Spotify OLED Display This application will display currently played track on SSD1306 OLED display connected to RaspberryPi. Displayed stuf

Wojciech Olech 2 Dec 30, 2021
🐱🖨Cat printer is a portable thermal printer sold on AliExpress for around $20.

Cat printer is a portable thermal printer sold on AliExpress for around $20. This repository contains Python code for talking to the cat printer over

null 671 Jan 5, 2023
Python library for the Phomemo m02s bluetooth thermal printer

Phomemo M02S Python library This is a basic Python library for controlling the Phomemo M02S bluetooth thermal printer. It probably only works on Mac &

Stargirl Flowers 28 Nov 7, 2022
A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

Jérôme W. 75 Jan 7, 2023
Testing additional addon devices, and their working scripts

ESP32-addon-devices-potpurri Testing additional addon devices, and their micropython working scripts ?? List of device addons tested so far Ethernet P

f-caro 0 Nov 26, 2022
This application works with serial communication. Use a simple gui to send and receive serial data from arduino and control leds and motor direction

This application works with serial communication. Use a simple gui to send and receive serial data from arduino and control leds and motor direction

ThyagoKZKR 2 Jul 18, 2022
A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost.

distance sensor cube timer A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost. How to

null 3 Feb 21, 2022
Hook and simulate global keyboard events on Windows and Linux.

keyboard Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.

BoppreH 3.2k Dec 30, 2022
A module for cross-platform control of the mouse and keyboard in python that is simple to install and use.

PyUserInput PyUserInput is a group project so we've moved the project over to a group organization: https://github.com/PyUserInput/PyUserInput . That

Paul Barton 1k Dec 27, 2022