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

    automatic switch off printer

    Scheduled Pinned Locked Moved
    General Discussion
    3
    10
    489
    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.
    • ErwinH78undefined
      ErwinH78
      last edited by ErwinH78

      Hi Guys,

      I wired an a relay and now it´s possible to switch off the printer with M42 P4 S255 via Out9 .

      Is it also possible if the temperature of heating bed, nozzle or print camber is too high to switch off automatically via the board?

      i mean to check the configurated thermistors and if they are too hot to send the command...
      like switch on hotend fan at 45 degree

      OwenDundefined 1 Reply Last reply Reply Quote 1
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by Phaedrux

        Check out M143

        https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M143_Maximum_heater_temperature

        You could also monitor temps and take actions using conditional gcode and daemon.g file that runs on loop in the background.

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD @ErwinH78
          last edited by OwenD

          @ErwinH78
          If you control your relay via the ps_on pin then I believe in later firmware versions RRF will send M81 on a heater fault
          That would also allow you to defer shutting down until the hotend is cool etc. using M81 S1
          Otherwise do it in daemon.g

          ErwinH78undefined 1 Reply Last reply Reply Quote 0
          • ErwinH78undefined
            ErwinH78
            last edited by

            thx. i´m already using M143 in my config:
            if there is an fault with the ssr the heatbed can´t be switched off by that... so i want to send command via out9 to my relais. this will power off the main switch.

            M308 S0 P"temp1" Y"thermistor" A"Heizbett" T100000 B4138 ; configure sensor 0 as thermistor on pin temp0
            M950 H0 C"out1" T0 ; create bed heater output on out0 and map it to sensor 0
            M143 H0 S135 ; set temperature limit for heater 0 to 135C
            M140 H0 ; map heated bed to heater 0
            ;M307 H0 R0.633 C343.0 D3.15 S0.6 V24.2 ; disable bang-bang mode for the nozzle heater and set PWM limit and PID settings
            M307 H0 R0.666 C300.5 D2.33 S0.60 V24.2 ;110 Grad 60% Leistung

            ;Nozzle
            M308 S1 P"temp0" Y"thermistor" A"Nozzle" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin temp1
            M950 H1 C"out0" T1 ; create nozzle heater output on out0 and map it to sensor 1
            M143 H1 S280 ; set temperature limit for heater 1 to 280C
            M307 H1 R1.360 C368.300:368.300 D5.30 S1.00 V24.1 B0 ; disable bang-bang mode for the nozzle heater and set PWM limit and PID settings

            1 Reply Last reply Reply Quote 0
            • ErwinH78undefined
              ErwinH78 @OwenD
              last edited by

              @OwenD hmmm ok. my plan is to monitoring 4 temperatures. Heatbed, nozzle, print camber and one thermistor in my electronic bay... if there is the temperature over an set limit the printer should power off.

              with M42 P4 S255 i can power off the printer but i´m not sure to handle this depending of four temperatures

              OwenDundefined 1 Reply Last reply Reply Quote 0
              • ErwinH78undefined
                ErwinH78
                last edited by

                ;Switch Off Printer
                M950 P4 C"out9"

                1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @ErwinH78
                  last edited by OwenD

                  @ErwinH78
                  I do it in daemon.g
                  It loops about once per second depending on what you have in it.

                  Note, I'm using RRF 3.3b2 which allows variables which I use to only do the check every 20 seconds or so.

                  You'd need to put your M42 commands in where I have M81

                  ; 0:/sys/daemon.g
                  ; runs continually in background at approximately 1Hz if not delayed internally
                  
                  
                  ;HEATER CHECKS
                  
                  ; this section of daemon.g checks for heater faults
                  ; RRF doesn't currently check for faults when idle but by default will shutdownduring printing if temperature excursion is > 15 degrees.
                  ; Note: temp excursion value and time  may be manually set using M570
                  ; checking if temp is rising requires a variable.  I have used a variable called global.LastCheckTime (which is created in config.g and set to zero)  for this and to do elapsed time since last check
                  ; G4 could be used but would also delay anything else in daemon.g
                  ; this way allows other checks to run more frequently if needed however the G4 delays inside the loop will affect the frequency of daemon.g
                  ; will be updated when variables are available in RRF.
                  while iterations < #heat.heaters ; loop through all configured heaters
                  	if state.upTime < 60
                  		break; If uptime is < 60 seconds, break out so all fans etc have time to stabilise.
                  	
                  	if ((global.LastCheckTime+10) > state.upTime) ; if checked in last 10 seconds escape loop and go to rest of daemon.g if present.  offset will be zero at startup via config.g
                  		;echo "skipping loop " ^ " " ^ state.upTime  ^ " " ^ global.LastCheckTime+10
                  		if global.LastCheckTime - state.upTime > 60 ; uptime must have rolled over so reset off set to zero
                  			G10 P2 Y0
                  			echo "upTime has rolled over.  Heater checking reset"
                  		break
                  	;echo "checking heater " ^ iterations ^ " " ^ state.upTime  ^ " " ^ global.LastCheckTime+10
                  	if heat.heaters[iterations].state="tuning"
                  		;echo "heater " ^ iterations ^ " is tuning - no check carried out"
                  		continue ; don't check this heater as it is PID auto tuning
                  	if (heat.heaters[iterations].current) > (heat.heaters[iterations].max) ; temp is over max so emergency shutdown required
                  		;M41 P5 S1  ; activate output connected to externally powered latching relay here to sound alarm
                  		echo "heater over max temp fault detected in daemon.g.  - shutting down"
                  		M112; emergency shutdown
                  		M81 S1 ; turn off power when fans have turned off
                  	if (heat.heaters[iterations].current > 45)  &&  (heat.heaters[iterations].active > 45); no real danger at below this temp as ambient may be close to this
                  		;echo "heater " ^ iterations ^ " is above 45 degrees"
                  		if (heat.heaters[iterations].state!="off") && (heat.heaters[iterations].current > heat.heaters[iterations].active + 15) ; temp is > 15 degrees above target.
                  		;echo "heater " ^ iterations ^ " is on or in standby - checking if temp is rising"
                  			set global.LastTemp = heat.heaters[iterations].current ; set the last check temp
                  			G4 S3 ; wait 3 seconds
                  			if (heat.heaters[iterations].current > global.LastTemp + 0.5) ; heat is rising by more than 0.5 degrees in 3 seconds
                  				echo "heater runaway fault detected in daemon.g.  - shutting down"
                  				if (state.status=="processing")
                  					M25 ; pause print so you might be able to save it using M119
                  				;M41 P5 S1  ; activate output connected to externally powered latching relay here to sound alarm
                  				M0 ; unconditional stop.  If axes are homed and a print is being canceled will run cancel.g  otherwise will run stop.g
                  				M81 S1 ; turn off power when fans have turned off
                  			else
                  				;echo "heater is on or standby but temp is falling on heater " ^ iterations ^ " - no action needed"
                  		elif (heat.heaters[iterations].state="off") && ((heat.heaters[iterations].current) >= (fans[1].thermostatic.lowTemperature+0)) ; if heater is off and temp is greater than 50 there could be an issue
                  			;echo "heater " ^ iterations ^ " is off but checking if temp is rising"
                  			set global.LastTemp = heat.heaters[iterations].current;
                  			G4 S3 ; wait 3 seconds
                  			if (heat.heaters[iterations].current > global.LastTemp + 0.5) ; heat is rising by more than 0.5 degrees in 3 seconds
                  				;echo "heater is off but temp is rising on heater " ^ iterations ^ "emergency shutdown"
                  				;M41 P5 S1  ; activate output connected to externally powered latching relay here to sound alarm
                  				echo "heater runaway fault detected in daemon.g.  - shutting down"
                  				M112; emergency shutdown
                  				M81 S1 ; turn off power when fans have turned off
                  			else
                  				;echo "heater is off & temp is falling or stable on heater " ^ iterations ^ " - no action needed"
                  	else
                  		;heater is below 45 degrees so only other fault may be an open circuit thermistor which should show -275 degrees
                  		if heat.heaters[iterations].current < 0 ; we probably have a thermistor fault if heater is less than 0 degrees
                  			M112 ; emergency shutdown
                  			M81 S1 ; turn off power when fans have turned off
                  
                  	;Check if water pump is running correctly
                  	if (iterations=1) && ((heat.heaters[1].current) > (fans[1].thermostatic.lowTemperature+0))
                  		if fans[1].rpm <= 500 ; Coolant pump RPM off or low
                  			G4 S3 ; check again in 3 seconds in case it's just spinning up
                  			if fans[1].rpm <= 500
                  				echo "Water pump fault - shutting down heaters - RPM : " ^ fans[1].rpm
                  				M25 ; pause print so you might be able to save it using M119
                  				M0 ; unconditional stop.  If axes are homed and a print is being canceled will run cancel.g  otherwise will run stop.g
                  				M81 S1 ; turn off power when fans have turned off
                  		elif (fans[1].rpm > 500) && (fans[1].rpm < 1400)
                  			G4 S3 ; check again in 3 seconds in case it's just spinning up
                  			if (fans[1].rpm > 500) && (fans[1].rpm < 1400)
                  				echo "WARNING: Water pump RPM low - RPM : " ^ fans[1].rpm
                  				if (state.status=="processing")
                  					M25 ; pause print so you might be able to save it using M119
                  					;M41 P5 S1  ; activate output connected to externally powered latching relay here to sound alarm
                  					M0 ; unconditional stop.  If axes are homed and a print is being canceled will run cancel.g  otherwise will run stop.g
                  					M81 S1 ; turn off power when fans have turned off
                  		else
                  			;echo "Coolant OK - RPM : "  ^ fans[1].rpm
                  			
                  		if fans[2].rpm <=1000
                  			echo "WARNING: Water pump FAN RPM low - RPM : " ^ fans[2].rpm
                  			if (state.status=="processing")
                  				M25 ; pause print so you might be able to save it using M119
                  				;M41 P5 S1  ; activate output connected to externally powered latching relay here to sound alarm
                  				M0 ; unconditional stop.  If axes are homed and a print is being canceled will run cancel.g  otherwise will run stop.g
                  				M81 S1 ; turn off power when fans have turned off
                  
                  	if iterations == #heat.heaters-1 ; all heaters have been checked
                  		set global.LastCheckTime = state.upTime ; set the new time to check
                  
                  
                  ; END HEATER CHECKS
                  
                  
                  ; run other checks
                  
                  ;G4 S10 ; pause daemon.g for 10 seconds before next run
                  
                  1 Reply Last reply Reply Quote 1
                  • ErwinH78undefined
                    ErwinH78
                    last edited by

                    ah ok thx. i check that out...

                    to run this daemon.g i have this to start in config or it starts automatically

                    OwenDundefined 1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD @ErwinH78
                      last edited by

                      @ErwinH78
                      you create it in the SYS folder
                      0:\sys\

                      Once created it will start to run.

                      Note!
                      To edit it or delete it, you must first rename it.

                      1 Reply Last reply Reply Quote 0
                      • ErwinH78undefined
                        ErwinH78
                        last edited by

                        understood. thx 🙂

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA