# Altering the print bed temperature at different layers

I am using Cura for slicing, and OctoPrint for the actual printing.

On small pieces with roughly one square cm of surface area prints over about 6 mm have a risk of coming off at 60 °C.

In fact, I have had to use 71 °C so it stick properly. However, I don't want the print bed that hot all the time. I would like to try a different number of layers at different bed temperatures till I get it right.

Gradually, over the course of 1-3 mm, for the bed temperature to decrease back to 60 °C to save on electricity. Possibly even 50 °C as the layers get higher.

Cura only support the initial layer having a different temperature and that isn't enough.

Apparently you can have custom user events with OctoPrint, one of them being ZChange which is great.

{__currentZ}: the current Z position of the head if known, -1 if not available


I need on the ZChange event to check the __currentZ and execute anM140 with a temperature varying with layer height. Normally I would use a simple if command or etc., but how do I implement this here.

However, its seems you can execute a command or a G-code.

I can't seem to find any examples where I can test the Z height in layers or mm and execute a different temperature for different layers.

An additional problem is the increased temps cause the model to melt so that the opening is smaller nearest to the glass than most of the rest of the model.

I am height of the raft, which helps, but I am hoping for a compromise.

The print bed shouldn't need to be 70 °C for the whole vertical height of the model.

Any suggestions?

• Did you try heating the bed to 70 then starting the print job with a file that has the heat bed at 50? By the time the first layer is done, the bed should have cooled back down to 50. – user77232 Jan 9 '20 at 17:47

The actual problem you are facing is bed adhesion, the proposed solution (in your question) shouldn't be the preferred solution to get your parts to stick to the plate/glass as plastic shrinks as it cools down. Note that a 5 °C temperature drop after the first layer usually isn't a problem, but larger temperature differences or shutting off the heat completely will cause your parts to come off the glass.

Note that PLA requires a temperature of about 60 °C (for adhesion as this is close to the glass temperature where the plastic is soft; however, note that PLA can be printed on cold bed surfaces on suitable bed surfaces). The slate of glass is an insulator, so it is perfectly possible that you need to set the bed at a higher temperature to get 60 °C at the surface of the glass plate. When the lower layer deforms the bed temperature is too high.

As you are using Cura, there is a plugin available called TweakAtZ, nowadays this is a default plugin. How to use this is described in this anser (on question "How does one use a heat tower?"); instead of changing the hotend temperature you will need to modify the bed temperature instead (using M140).

To solve the actual problem, you need to prepare the glass by cleaning it properly, use a level bed with a correct initial nozzle to bed distance for Z=0 (usually thickness of a plain paper sheet A4/Letter) and an adhesive like hairspray, glue stick or a dedicated adhesion spray like 3DLAC or Dimafix. I'm using 3DLAC for several years (for PLA and PETG; Dimafix is supposed to be more sticky at higher temperatures, so for ABS for instance) and never had any problems with adhesion on properly levelled beds. See this answer for another user's experience.

An OctoPrint solution using event as you suggest is not recommended. This is the config.yaml, e.i. the configuration of the print server, not a print instance option file. Furthermore, there are yet no plugins that can handle additional code when the head reaches a certain (layer)height. This is pretty tricky if you use Z position detection when the head also can hop, such code should be inserted by the slicer instead.

Related to your question are the answers on question: "Why keep the bed heated after initial layer(s) with PLA (or PETG)?".

• You can manually edit the file. Look for the line that has the Z height of your choice, and insert the temp change g-code right above it.
• Upgrade to a real slicer like Simplify3D with has an options to set a heater temp at different layers.
• Preheat the bed before you print, then print with a bed temp set lower than the temp you preheated at. This will give the illusion of a temp change.

(I for one turn off my bed after the first layer, when I'm printing PLA. I also don't have proper cooling (at this time), my environment is humid (59.9%) and the ambient air temp is 31C.) - just for context