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

    Duet 2 IDLE State Power Off .

    Scheduled Pinned Locked Moved
    Gcode meta commands
    4
    8
    309
    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.
    • Cubiceyeundefined
      Cubiceye
      last edited by Cubiceye

      PW Printer (2).jpg

      I have rebuilt a 3D Systems CubePro Trio 3D Printer around a Duet 2 WiFi controller board, into a dual nozzle printer with an auto bed levelling sensor where the 3rd nozzle was originally. The CubePro Trio's mechanical build quality is superb, 2nd to none however, the software was atrocious. The whole package was far too proprietary down to the even the filament size of 1.60mm.

      The rebuilt printer has many users of varying ability and knowledge, it therefore needs to be as safe to use as possible.
      I have managed to use the board’s ATX PSU facility along with a custom controller relay board, to switch off the printer after a print using a MACRO called in the End gcode script to initiate shutdown. As an extra safety measure, I would like for the printer to switch off after a period of being idle, either with the heaters / build plate at temp or not. However, I can’t seem to find a flag or pinout anywhere on the Duet board that I could exploit to trigger a ‘close down / power down command if the printer has been idle for a predetermined period.

      The Duet browser Dashboard status screen displays 'IDLE' (see pic), when the machine is in a quiescent state, so the board knows what state the printer is in at any time, I would like to somehow access this flag and make use of it.

      I also have a large CreatBot DX II 3D Printer, if powered on but not used it will power off automatically after about 10 mins. It will do this even if the nozzle or build plate are at working temps but no activity, it can be a pain sometimes but at least it is protecting the printer and its surroundings.

      I have waded through the Duet forums as well the internet in general, but so far not found anything. Maybe have looked too hard and missed the solution glaring back at me, or maybe not.

      My Control Board is -
      Duet2 WiFi
      F/W Ver 3.4.6 2023-07-21
      Duet WiFi Server Ver 1.25
      Purchased from E3D 2021.

      Can anyone help please?

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined Phaedrux moved this topic from Duet Hardware and wiring
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        You can use a file called daemon.g placed in the sys folder to run some conditional gcode in a loop. You code could check the idle state in the object model and increment a counter and when the counter reaches a certain time you could initiate the shut down.

        https://docs.duet3d.com/en/User_manual/RepRapFirmware/Object_Model

        https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands

        These two documents should get you started.

        Z-Bot CoreXY Build | Thingiverse Profile

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

          @Cubiceye
          There are two ways you could go about it.
          When a print finishes, the file stop.g is run.
          In that file I do the following.

          • turn off all heaters
          • turn off bed
          • move bed and nozzle to allow easy access to printed part
          • call M81 S1
            M81 has several options to turn off the ATX (see here)
            The S1 option will allow the nozzle to cool with the fan running and avoid possible heat creep jamming issues. You can also use the D parameter to set a time.

          However if you want to force the power off if the machine has been idle for a period of time, you could use daemon.g as @Phaedrux has indicated.
          You would use something like the code below, however I urge you to read the document links provided so as to understand how to properly implement it without unforeseen issues.

          For example, I have not bothered to take into account the fact that eventually state.upTime rolls over to zero which would cause the shutdown to not happen until the machine had been running for at least as long as it was when the timer was initiated.
          This would only happen if the board was running for something like 2,147,483,647 seconds I think.
          You could use state.time instead, but that is not set until the network has connected.

          ; code should be placed in daemon.g
          ; by default, daemon.g will run every 10 seconds
          
          if !exists(global.idleShutdownLimit)
          	global idleShutdownLimit = 0
          if !exists(global.idleShutdownTime)
          	global idleShutdownTime = 600 ; shutdown time (after idle) in seconds.  Adjust to suit needs
          if !exists(global.ShutDownCounterRunning)
          	global ShutDownCounterRunning=false
          
          ; if a macro is running the state will be "busy", not "idle"
          ; uncomment following line to start timer if state is "busy" or "idle"
          
          ; if ((state.status=="idle") || (state.status=="busy")) && (state.atxPower == true) ; uncomment this line if runniing as a macro to test
          
          if (state.status=="idle") && (state.atxPower == true) ; comment this line if running as macro to test
          	echo "machine is idle and power is on"
          	if  global.ShutDownCounterRunning = false
          		set global.ShutDownCounterRunning = true
          		set global.idleShutdownLimit = state.upTime + global.idleShutdownTime
          		;echo "shutdown timer set"
          	else
          		if (state.upTime > global.idleShutdownLimit) && (state.deferredPowerDown = false)
          			M291 P"Forced power down in 5 seconds" R"Shutting down" S0 T5
          			G4 S5
          			M81;turn off ATX
          		else
          			echo "Shutdown active but still counting down"
          else
          	set global.ShutDownCounterRunning = false
          	set global.idleShutdownLimit = state.upTime + global.idleShutdownTime
          	;echo "shutdown timer reset"
          	
          
          1 Reply Last reply Reply Quote 1
          • Cubiceyeundefined
            Cubiceye
            last edited by

            Hello
            Thank you very much for your replies. I will give them a go after Christmas and promise to report back.

            Cubiceyeundefined 1 Reply Last reply Reply Quote 0
            • Cubiceyeundefined Cubiceye referenced this topic
            • Cubiceyeundefined
              Cubiceye @Cubiceye
              last edited by

              @Cubiceye Hi All
              I have managed to solve the Idle power off issue and I wanted share the script I am using to so.

              However, when I paste the code into the compose window (here), for some reason, it gets broken up into multiple parts in the preview window. As such, some of the code has the forum script highlighting and is in a scrolling text box and some doesn't. It makes it look like three bodies of separate code where in reality it is only one. Is there a trick to posting code?

              I was going to post it in the 'My Duet Controlled machine' category.

              droftartsundefined 1 Reply Last reply Reply Quote 0
              • droftartsundefined
                droftarts administrators @Cubiceye
                last edited by

                @Cubiceye code blocks on the forum have three backticks on their own, like this ``` , on the line above and the line below the code block. That should be the only thing that breaks up a code block. If you want to post it anyway, I can have a look and edit it if that's okay with you.

                Ian

                Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                Cubiceyeundefined 1 Reply Last reply Reply Quote 0
                • Cubiceyeundefined
                  Cubiceye @droftarts
                  last edited by

                  @droftarts
                  Thanks - will do.

                  Cubiceyeundefined 1 Reply Last reply Reply Quote 0
                  • Cubiceyeundefined
                    Cubiceye @Cubiceye
                    last edited by

                    @Cubiceye
                    Hi droftarts
                    I have just posted the code.

                    My Duet Controlled machine' category.

                    everthing below:- "Below is the code I came up with".
                    Is all supposed to be one code block.

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