Temperature control for Heating Bed
-
if {state.status} = "processing" if {heat.heaters[1].active} > 0 var bedtemp = {heat.heaters[0].current} if {job.layer} < 20 if var.bedtemp < 40 M140 S50 if var.bedtemp > 50 M140 S40 else M140 S0
Could it work like this?
-
@bernardomattiucci said in Temperature control for Heating Bed:
if {state.status} = "processing" if {heat.heaters[1].active} > 0 var bedtemp = {heat.heaters[0].current} if {job.layer} < 20 if var.bedtemp < 40 M140 S50 if var.bedtemp > 50 M140 S40 else M140 S0
Could it work like this?
Not really. For any temperature between 40 and 50, the bed will be turned off. If it drops below 40, the set point will be set to 50. But then in the next iteration, if the bed is at (say) 41 then the set point will change to zero so it will never reach 50.
-
@deckingman
my bed normally reaches 50.1 or 50.2 °C when the temperature is set to 50°C.
There are very specific conditions in the code...
IF the temperature drops below 40°, M140 S50 is set.
IF the temperature rises above 50°, M140 S40 is set.So if the temperature is between 40.1 and 49.9°C, theoretically nothing should happen.
It seems to work for me.
I'm testing it...but I'm already well past layer 20, so the bed is now off (constant temperature of 33°C until I open the doors).Mostly I'm interested in whether or not the IF sequence makes the code too heavy...
-
@bernardomattiucci ........but you've got else M140 S0. If temp is below 40, then M140 S50. It temp is above 50, then M140 S40. So if temp is between 40 and 50, then neither of those conditions will be met so the "else" will apply (M140 S0). Which means that the bed will be turned off at any temperature above 40, and on at temperature below 40 effectively controlling it at 40. If that's what you want to do then simply use M140 S40 and be done with it.
-
@deckingman the else is part of the job layer check, not the temperature check so it will only be turned off when the job is equal to or above 20 layers
-
@deckingman As @jay_s_uk said, That M140 S0 is related to layer control and is activated from layer 20 and up. This is because, after 3 hours of printing, the bed temperature is stable at 30°C and is more than enough to maintain the part. So there is no need, at the moment, to have the bed heater on (in winter we will see...).
-
@bernardomattiucci said in Temperature control for Heating Bed:
@deckingman As @jay_s_uk said, That M140 S0 is related to layer control and is activated from layer 20 and up. This is because, after 3 hours of printing, the bed temperature is stable at 30°C and is more than enough to maintain the part. So there is no need, at the moment, to have the bed heater on (in winter we will see...).
Ahh - apologies for missing that "else" being related to the layer value. So, yes, I'd have thought your proposal should work.
-
I modified the code slightly to keep the heater on at the set temperature of 50° for the first 5 layers.
if {state.status} = "processing" if {heat.heaters[1].active} > 0 if {job.layer} > 5 if {job.layer} < 20 if {heat.heaters[0].current} < 40 M140 S50 if {heat.heaters[0].current} > 50 M140 S40 else M140 S0 else M140 S50
the problem is that, at the beginning of printing, I get the following error:
Error: in file macro line 3 column 27: meta command: cannot convert operands to same type
The error occurs when I manually activate the heaters (hotend and bed) and then run the press
-
I fixed the errors in the code.
if job.build != null if job.layer != null && job.layer <= 5 M140 S50 elif job.layer != null && job.layer > 5 if job.layer < 20 if heat.heaters[0].current < 40 M140 S50 if heat.heaters[0].current > 50 M140 S40 else M140 S0
-
I would like to make a change to the code, but I don't know how to do it.
if job.layer < 20
I would like to consider 20% and not layer number 20.
How should I modify the code? -
@bernardomattiucci you would have to calculate what 20% of job.file.numLayers is
-
if job.build != null if job.layer != null && job.layer <= 5 M140 S50 elif job.layer != null && job.layer > 5 if ((job.file.numLayers*20)/100) < 20 if heat.heaters[0].current < 40 M140 S50 if heat.heaters[0].current > 50 M140 S40 else M140 S0
seems to be working
-
More update
if job.build != null if job.layer != null && job.layer < 5 M140 S50 if job.layer != null && job.layer >= 5 && job.layer < (job.file.numLayers*20)/100 if heat.heaters[0].current < 40 M140 S50 if heat.heaters[0].current > 50 M140 S40 if job.layer != null && job.layer > (job.file.numLayers*20)/100 M140 S0