Resume on power failure - CNC
-
I have a CNC machine controlled by a Duet3 MB6HC v1.01 board, running RRF 3.4.5
I've asked before about the machine powering down so quickly it doesn't have time to fully prepare a resurrect.g file which includes the spindle speed of the milling motor, but have not yet achieved this.
Recently, I came across the Raspberry Pi Pico and thought I could use this, with a pair of relays, to provide a 5V supply from a PowerBank to give the Duet3 a bit more time to save the resurrect.g file, but the issue comes when getting the Pico to 'sense' the loss of the 24V supply from the PSU, as it doesn't support such a high voltage.
It was recently pointed out that I could use the 24V supply from the PSU and a 5V supply from the PowerBank (in turn connected to a USB supply) so that when the 24V failed, the 5V would be around long enough for the file to be saved.
Is this true and, if it is, how should I set the 5V jumpers shown here:
The documentation isn't particularly clear (to me) about this, so I just need some clarification.
Thank you
-
Could someone help with this, please?
I'm kinda stuck until I can make some progress.
Thanks
-
@Nightowl If i understand correctly you plan to wire the machine with 24V in, and provide 5V backup from a USB power bank?
In this can i presume you still want to use the internal 5V supply on the Duet for normal operation, and then just provide USB power as well. Making the assumption that you do not have an SBC connected you can leave the jumper on internal 5V En, hot have either of the 5V<->SBC jumpers fitted and plug the power bank into the USB port of the Duet.
-
Thank you, @T3P3Tony
No, I just want to power the board from the 5V long enough to ensure the Resume.g file can be written (although the PowerBank kept my Duet2 Network board powered for almost 2 hours!)I don't have a SBC connected, no. I run the machine from a web browser on my Surface Pro.
So, only a single jumper across the Internal 5V En pins, and not the other two.
Brilliant, thanks again
-
@Nightowl if you are not running anything external from the 5V rail (or not much anyway) and using 24V VIN then RRF should have sufficient time to write the complete resurrect.g file, provided you don't do anything in the power fail script that waits for movement to stop. If that's not happening, try a new SD card.
-
@dc42 I don't think I'm running anything external from the 5V power rail and I am using a 24V 350W PSU, but there doesn't seem to be enough time for the resurrect.g file to be written.
Here's the appropriate line from the config.g file:
M911 S23 R23.5 P"M98 P""SaveSpindleSpeed.g""M913 X0 Y0" ; set voltage thresholds and actions to run on power loss
...and here's the savespindlespeed.g file:
var fName = "RestoreSpindleSpeed.g" echo >{var.fName} "if {!exists(global.abort_process)}" echo >>{var.fName} " global abort_process = true" echo >>{var.fName} "else" echo >>{var.fName} " set global.abort_process = true" echo >>{var.fName} "M291 S3 R""Resurrect:"" P""Continue with <"^{job.file.fileName}^">?""" echo >>{var.fName} "set global.abort_process = false" echo >>{var.fName} "M3 S"^{spindles[0].active}
All this was brought about by my desire to ensure the CNC machine saved all the necessary information, in the event of a power failure, to be able to resume the cut when mains power returns. For whatever reason, the power drain is too quick for the files to be written, hence my thoughts of connecting a 5V backup battery to the microUSB port.
We discussed this, at length, here, here and this thread, but not yet found a solution.
-
@Nightowl one thing that occurs to me is that you could potentially shorten the execution of this file to the following:
echo >>"RestoreSpindleSpeed.g" "M291 S3 R""Resurrect:"" P""Continue with <"^{job.file.fileName}^">?""" echo >>"RestoreSpindleSpeed.g""set global.abort_process = false" echo >>"RestoreSpindleSpeed.g" "M3 S"^{spindles[0].active}
and have the first part of the file created as part of the print start gcode, then recreated as part of the power fail recover code..
How far through writing the file does it get?
I did not read through other long thread so apologies if it was also tried but did you try writing an empty file, just to confirm that the macro was being run at all, as a test change savespindlespeed.g to
echo >"RestoreSpindleSpeed.g" ""
-
Thanks, @T3P3Tony
With the current configuration files it only saves about 6 lines but, to be completely honest, I haven't spent a lot of time trying to sort this out as there have been other issues that have taken priority.
I've got a project to run tomorrow (Friday) so I'll finish that off and then concentrate on this, including a simulated power failure.
Just out of curiosity, am I correct in thinking the pause.g file is relevant to this process, and that the resume.g file can be used after powering down and restarting the machine, or have I got my wires crissed?
Thanks
-
@Nightowl it may help that in RRF 3.5beta1 the resurrect.g file includes commands to restore the spindle speed. Please note, this has not been tested yet. Let me know if it works for you.
-
Thanks, @dc42
I’ll see how I get on tomorrow.TBH I’m reluctant to test a beta version as my current configuration is really stable, but I could try with a different microSD card, so I’ve got a fallback.
-
@Nightowl said in Resume on power failure - CNC:
Just out of curiosity, am I correct in thinking the pause.g file is relevant to this process, and that the resume.g file can be used after powering down and restarting the machine, or have I got my wires crissed?
The pause.g and resume.g files are not relevant to resume after power fail. However, any time you pause a print, resurrect.g gets written. This is to allow you to pause the job and then power down, knowing that you can resume it if you have set up resurrect-prologue.g appropriately. This works for 3D printing; I don't know whether it is appropriate for CNC applications.