Klipper lower the bed temperature by 5° at the end of a print

Hi, I’m having some trouble with the PETG at the end of the print.

I would like to make a macro that allows to lower the temperature from 5° to 5° at the end of the printing.
So I asked chatGTP for help but obviously it’s not that good. So I ask to humans.

[gcode_macro 5DTO5D]
gcode:
    # Wait for the hotend to cool down to 60°C
    M109 S60
    # Wait for the bed to cool down to 50°C
    M190 S50
    # Reduce the temperature by 5°C every 10 seconds until it reaches 0°C
    {% set BED_TEMP = params.BED_TEMP|float %}
    {% set new_bed_temp = BED_TEMP %}
    {% for i in range(0, int(BED_TEMP / 5)) %}
        {% set new_bed_temp = new_bed_temp - 5 %}
        M140 S{{ new_bed_temp }}  ; Set new bed temperature
        G4 S10 ; Wait 10 seconds
    {% endfor %}
    # Turn off the bed and hotend heaters
    M140 S0
    M104 S0

Klipper reports: ERROR

Error loading template ‘gcode_macro 5DTO5D:gcode’: TemplateSyntaxError: expected token ‘:’, got ‘}’

Once the underlying issue is corrected, use the “RESTART”
command to reload the config and restart the host software.
Printer is halted`

Thank you in advance

At least this is wrong in syntax:

It only needs a single pair of {}.
However I don’t know whether this works or if are you just trapped inside this loop but exclude any further gcode processing in the meantime.

The whole macro firstly cools down the hotend to 60°C and then the bed to 50°C only to then decrease the bed temp in steps of 5°C until 0°C to finally turn of hotend and bed?

What exactly are you wanting to do end when exactly during the print?

Hi, thanks for the correction.

I just asked ChatGPT and copy and paste.

Now that you fixed it, I’ll start testing and editing. I have a problem with a part that warps a lot. I’ve tried quite a few things, and the goal is to get the bed temperature down more gently.

I wanted to test, but if it doesn’t work, I’ll modify the piece.

According to my experience this does unfortunately not help at all because you already “preserved” the wrapping during the print.

What helped me (depending on the material) was actually to do the opposite: Increase bed temperature to 80°C or even over, cover the part and let it sit for 30 mins or longer

1 Like

Thanks for the tip, but I think it’s going to be hard to implement because I’m printing a small run of 100 pieces on three machines.
I wanted to avoid post print manipulations, but I feel like the easiest way would be to try 2 rounds of Brim and then a cutter cut.

Well it depends on material and kind of warping you are experiencing. I have printed large format ASA parts that warped so strongly that it lifted the spring-steel-surface from its magnetic sheet and I had to clamp it down.
So according to my experience you have two types of warps:

Warping during printing

  • Typically leads to bed adhesion problems during printing
  • Curling up of one or more edges during printing
  • Countermeasures:
    • Brim
    • Glue sticks / Printing adhesives
    • Printer with enclosure

Warping after printing

  • Part will start warping once you take it off the bed
  • Warping is basically “baked” into the part
  • Countermeasures
    • Printer with enclosure and high chamber temperatures
    • Let it sitting with heat bed turned on and covered for quite a while. You should reach temperatures at or above the glass transition temperature of the given material

Just my experience. Of course both types might mix and all depends on the material you are printing.

Thanks for the information, I am printing PETG. I just discovered another problem.
I print on Artillery X1 modify at the extruder level but stock at the tray level. With a thermometer, I notice that the center is 10° cooler.
So I will try to place the piece differently on the board.
I hope I can find the time to do this macro at the endprint of the printing process

What type of thermometer are you using to measure the temperature as what you are describing is really strange?

I use a thermal camera I picked up years ago to get images like

image

and, the worst case deviation I get at the edges is 2C. The color mapping is decidedly non-linear with the red/orange perimeter is 54C while the center is 55.5C. After it runs for a bit, the edges will probably be within 0.5C of the center - I just turned on a bed to take the image.

If there was a break in the heating coils of the bed, you would expect stripes of lower temperature for a few minutes (literally) before the heat from adjacent areas heated it up and you would measure a fairly homogenous temperature across the entire bed.

Indeed, reading you, I think there is a problem with taking measurements. I’m going to take a closer look at it.

It is this device that does not give the same result with your device. link

This is the current model of what I have:

Mine has an SD Card for storing images instead of the USB connector but otherwise it’s identical.

PETG is the most easy material directly after PLA. If you experience strong warping issues, I fully agree with the observations here: Something is wrong with your setup

Side note: When printing PETG I use 80°C bed temperature

Yes, I do print at 80, always have, but more on glass with Dimafix. I have gone up to 90° following the installation of this construction plate set
link

piece is not easy to hang on the bed, nor even the rest with heterogeneous material pressures



Hi, after some tests and observation, it is very clear to me, that PETG prints perfectly well on glass + Dimafix. I have no more warping on this part.

1 Like