Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Temperature control for Heating Bed

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    6
    29
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • deckingmanundefined
      deckingman @bernardomattiucci
      last edited by

      @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.

      Ian
      https://somei3deas.wordpress.com/
      https://www.youtube.com/@deckingman

      bernardomattiucciundefined 1 Reply Last reply Reply Quote 0
      • bernardomattiucciundefined
        bernardomattiucci @deckingman
        last edited by

        @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...

        deckingmanundefined 1 Reply Last reply Reply Quote 0
        • deckingmanundefined
          deckingman @bernardomattiucci
          last edited by

          @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.

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

          jay_s_ukundefined bernardomattiucciundefined 2 Replies Last reply Reply Quote 0
          • jay_s_ukundefined
            jay_s_uk @deckingman
            last edited by

            @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

            Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

            1 Reply Last reply Reply Quote 1
            • bernardomattiucciundefined
              bernardomattiucci @deckingman
              last edited by bernardomattiucci

              @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...).

              deckingmanundefined 1 Reply Last reply Reply Quote 0
              • deckingmanundefined
                deckingman @bernardomattiucci
                last edited by

                @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.

                Ian
                https://somei3deas.wordpress.com/
                https://www.youtube.com/@deckingman

                1 Reply Last reply Reply Quote 0
                • bernardomattiucciundefined
                  bernardomattiucci
                  last edited by bernardomattiucci

                  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

                  1 Reply Last reply Reply Quote 0
                  • bernardomattiucciundefined
                    bernardomattiucci
                    last edited by

                    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
                    
                    1 Reply Last reply Reply Quote 1
                    • bernardomattiucciundefined
                      bernardomattiucci
                      last edited by

                      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?

                      jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                      • jay_s_ukundefined
                        jay_s_uk @bernardomattiucci
                        last edited by

                        @bernardomattiucci you would have to calculate what 20% of job.file.numLayers is

                        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                        1 Reply Last reply Reply Quote 1
                        • bernardomattiucciundefined
                          bernardomattiucci
                          last edited by

                          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

                          1 Reply Last reply Reply Quote 1
                          • bernardomattiucciundefined
                            bernardomattiucci
                            last edited by bernardomattiucci

                            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
                            
                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Unless otherwise noted, all forum content is licensed under CC-BY-SA