Duet 2 IDLE State Power Off .
-
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?
-
-
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.
-
@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 usestate.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"
-
Hello
Thank you very much for your replies. I will give them a go after Christmas and promise to report back. -
-
@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.
-
@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
-
@droftarts
Thanks - will do. -
@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.