Help Setting up Resume after power failure and Bed leveling.



  • Hoping that someone could possibly help me with setting up Resume after power failure as I have had 2 long prints fail in 2 days due to power cuts and it is very frustrating.

    I would also like to setup bed leveling using 2 optical endstops on the either side of the bed for the bed leveling so I can minimise how much Mesh bed compensation is in use.

    I have a CoreXY hypercube Fusion with a clone BMG extruder & Genuine E3D V6 hotend, dual Z axis screws, DC42 Ir Probe for probing the bed and setting the Z height, with a print volume of approx 305 x 270 x 480. Running
    Duet 2 Wifi with Board: Duet WiFi 1.02 or later
    Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 2.05 (2019-12-13b1)
    Duet WiFi Server Version: 1.23

    My setup currently homes the Z to the center of the bed using the DC42 Ir probe.

    I have tried to get my head around the power failure resume but I am not sure about it as I can't get how to probe the bed again without causing it to foul against the print without having endstop switches on the bottom of the Z axis hence why I thought it would be a good idea to setup the Bed leveling at the same time.

    So if someone would kindly be able to help me setup the bed leveling using dual optical endstops and the power resume I would be very appreciative. ( @Phaedrux is probably hiding already )

    If I need to post any of the sys files please let me know and I will.


  • Moderator

    @RAM What you want should be feasible, as many others have done this, and perhaps those with similar hardware can step in and show their resume settings.

    This page is pretty clear and detailed about how to set up resume: https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure
    If you have any specific questions about this, please ask.

    It sounds like dealing with the Z axis is the most difficult part for you. What happens to Z when the power is cut? Does it drop? If not, you'll only lose 1 full step of accuracy on Z at resume, as re-powered motors will jump to the closest full step. This is the easiest way to do it, and losing/gaining one step is pretty trivial unless you have a very low steps per mm on Z. There isn't really any way to combat this, unless you home the Z axis.

    If your bed does drop or move when power is removed, or you really want to rehome Z, you need a way of homing it accurately that does not need the bed to come up to nozzle height (you could, but you'd need to know that the printed part wasn't going to hit the XY gantry). There really isn't any way to probe the bed, either, with a print already on it. Usually the way to do it is to home at the far end of the Z axis, with the bed at the bottom of the printer. You can install an endstop (optical or mechanical) on each motor, and home them independently; see https://duet3d.dozuki.com/Guide/Independent+Z+motors+and+endstop+switches/18
    You can do this just for Resume, instead of using your probe to find Z, or use it all the time, though you might get bored of your bed going up and down! You can fit the endstops, and use bed probing to accurately set the offsets for each side.

    Alternatively, reconfigure your Z axis to have only one motor, connected to leadscrews by belt, and manually level the bed. It's unlikely to go out of level, and many forum users swear by this. Then you only need one lower Z endstop.

    Lastly, if power cuts are a common occurrence, and they are not too long, consider getting an Uninterruptible Power Supply, of sufficient power to run the whole printer. They can also smooth out the power supply and reduce other problems!

    Ian



  • @droftarts Thanks for the info, I was reading through the dozuki again to see if I could get my head around it but I am a little confused as it talks about sys/resurrect.g at the very start on how it works but I have looked in my DWC and in the backup /sys folder on my PC to make sure that I am not going blind but I do not have this file at all and it doesn't state that you have to create it.

    The only file that I have that I might think it could be is resume.g would this be the file instead of resurrect.g ?
    Sorry if this sounds a bit trivial but I want to be certain that I am not missing anything before I put this into place.

    As for the bed dropping when the power is cut I don't think it moves at all as the last print I had to remove was still stuck to the nozzel when I had to home the X / Y Axis to get it out of the way to remove the print from the bed.

    I mainly wanted to add the dual optical endstops to the bottom end of the Z Axis lead screws so that I could use True Bed Leveling mainly & for the purpose of the resume function. If there is another way that I could only have to home say the X & Y axis for the resume function to work and not have to do Z at all then I would be fine with that or to have the Z axis to only probe the front left corner of the bed where the X & Y axis also home as I can't actually use my full bed because of using a glass bed & having to use clips to hold it in place.

    I think the power cuts lately are due to the fact that we are in lockdown and the place where I live has a substation that is not man enough as they have built loads more houses but didn't upgrade it. 😠
    I will look into geting one for the printer as I do use one for my 2 NAS setups, But I can't really add the printer to it as it is over the other side of the loft ( attick).


  • Moderator

    @RAM said in Help Setting up Resume after power failure and Bed leveling.:

    I am a little confused as it talks about sys/resurrect.g

    https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure#Section_How_it_works

    Any time you pause a print from SD card, the state of the print is saved to a special file on the SD card, sys/resurrect.g

    It's created by the firmware when it has to save the current print progress, as in, when pause is initiated, or when the power fails.

    https://duet3d.dozuki.com/Wiki/Macros#Section_Start_pause_stop_and_power_fail
    Resume.g is used by the firmware to resume a paused print.

    ; pause.g
    ; called when a print from SD card is paused
    ;
    ; generated by RepRapFirmware Configuration Tool v2 on Sun May 05 2019 17:25:18 GMT-0600 (Central Standard Time)
    
    G10 ; retract
    G91            ; relative positioning
    G1 Z5 F360     ; lift Z by 5mm
    G90            ; absolute positioning
    G1 X10 Y10 F6000 ; go to X=10 Y=10
    
    ; resume.g
    ; called before a print from SD card is resumed
    ;
    ; generated by RepRapFirmware Configuration Tool v2 on Sun May 05 2019 17:25:18 GMT-0600 (Central Standard Time)
    G1 R1 X0 Y0 Z5 F6000 ; go to 5mm above position of the last print move
    G1 R1 X0 Y0          ; go back to the last print move
    G11 ; unretract
    

    Pause saves the current position, retracts some filament, lifts the head, and moves it out of the way.
    Resume moves the head back to the saved position (5mm above it at first, and then drops to the print height, unretracts, and resumes printing the gcode file.

    The power save function behaves in a similar way, except that a few extra steps are needed to prepare the printer before it can resume printing because the power loss has turned off the heaters and the motors have lost position. This is where resume-prologue comes in. This is a file you customize to tell the printer what to do do get ready to resume the print again. This includes rehoming the axis safely, getting up to temp, etc.

    How you want to home Z axis is entirely up to you. There are many ways to do it. You can do it with zmax endstops, or you could do it entirely manually.

    Bed leveling and power loss recovery are two seperate things, but can be used together. Bed leveling would usually be scripted in the bed.g file which gets called by G32. Part of that process would be homing the Z axis and you probably won't want to use the same process to home Z in normal situations as you would during a power loss recovery (due to the bed having a print on it, and probably not wanting to home to Z max every time).

    So I would suggest you start by spliting the two processes up in your mind first. Either get power loss recovery working, or bed leveling setup first, and move on to the other.

    If your bed isn't dropping at all at power loss you have the option of simply using a G92 Z command to set the print height manually. You can use a caliper or something to get the height of the printed part and then go back to the slicer to compare and find the exact layer number and z height that way.

    See here for an example of setting up a z max endstop. https://duet3d.dozuki.com/Guide/Ender+3+Pro+and+Duet+Maestro+Guide+Part+5:+Upgrades/54#s213

    You probably only need a single z max endstop, since if the bed isn't dropping, you could just use the z probe to level the bed before the print as decribed by https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors, and it will stay pretty even after a power loss, so you really only need to reliably set the z height. Any attempt to correct for tilt at that point may introduce more height error than it solves.



  • @Phaedrux said in Help Setting up Resume after power failure and Bed leveling.:

    https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure#Section_How_it_works

    Any time you pause a print from SD card, the state of the print is saved to a special file on the SD card, sys/resurrect.g

    It's created by the firmware when it has to save the current print progress, as in, when pause is initiated, or when the power fails.

    I have used the Pause on the DWC before where I had to sort something out and then resumed the print, so does the resurrect.g file get deleted once it has been used or am I missing something as I don't have the ressurect.g file within my /sys folder.

    I Just want to be sure that I am getting this right before I implement it into the setup. I will deal with just the power failure resume function 1st then deal with the True bed leveling after.

    I add this to the config.g file
    M911 S21.0 R23.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000

    (Here ok ? or does it need to be in a certain area)
    ; Miscellaneous
    M501 ; Load saved parameters from non-volatile memory
    T0
    M911 S21.0 R23.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000

    Then create the file /sys/resurrect-prologue.g file containing the following

    M116 ; wait for temperatures
    G28 X Y ; home X and Y
    M83 ; relative extrusion
    G1 E4 F3600 ; undo the retraction that was done in the M911 power fail script

    Also do I need to create a macro for running the resume function ? As I can't seem to find this information.


  • Moderator

    @RAM said in Help Setting up Resume after power failure and Bed leveling.:

    https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure#Section_How_it_works

    When the power supply voltage drops below the auto-pause threshold voltage, the heaters are turned off to conserve power, the state of the print is saved to file sys/resurrect.g on the SD card, the power fail script specified in the M911 command is run, and the print is left in a paused state

    After the power is restored, you can use command M916 to resume the print from where it stopped. This command runs file sys/resurrect.g which calls sys/resurrect-prologue.g at an appropriate point to home the printer

    I suggest re-reading the documentation link.

    https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure#main



  • @Phaedrux

    I have re read the documentaion for about the 10th time, I did the following.

    put the M911 information into the config.g

    ; General preferences
    G21                                     ; Work in millimetres
    G90                                     ; send absolute coordinates...
    M83                                     ; ...but relative extruder moves
    M911 S21.0 R23.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000 ; Power Loss Function
    M550 P"HEVO"                            ; set printer name
    

    Then created a ressurect.g file with nothing in it as I couldn't find one in my sys folder anywhere.

    Next I created the resurrect-prologue.g file so it looks like this.

    M116 ; wait for temperatures
    G28 X Y ; home X and Y, hope that Z hasn't moved
    M83 ; relative extrusion
    G1 Z-3 E4 F3600 ; undo the retraction that was done in the M911 power fail script
    

    made the macro with the M916 command and then set off a print test cube then killed the power at the wall socket to simulate power failure.

    Guess what nothing worked. it didn't move the Z axis, didn't write anything to the resurrect.g file so I guess I am totally stupid to the point where I can't even understand the english language which is why I don't get what the instructions are telling me on the
    https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure#main

    I will say thanks for the help in trying to get me to setup this function as I know you have given your time but I will be leaving this alone and leaving the printer at the stage that it is in as I really can't be bothered anymore with beating my head against the wall.


  • Moderator

    Now now, don't be so upset. Persistence will always payoff.

    resurrect.g should be created by the firmware when power is lost. You don't need to create it. Now if it's still not being created when power is lost we need to look at the M911 command first to make sure it's correct. If it is, and it's still not created, then it's possible that there's not enough juice left at power loss time to move the motors and save the file. If that's the case we might be able to modify your M911 to do a little less motor movement.

    Here's my M911 for comparison: M911 S21 R23 P"M913 X0 Y0 G91 M83 G1 Z3 E-1 F500"

    Less extruder movement and slightly slower. Try changing yours to match. If that still doesn't help, try reducing the Z motor movement. If that doesn't help remove all motor movement entirely by removing the G1 Z E F part. If that still doesn't help, we can adjust the voltage range that it will trigger at so that it triggers earlier, by changing the M911 S21 to S22.

    Once it's reliably creating the resurrect.g file on it's own at power loss then we can test resuming.

    Your resurrect-prologue looks ok. Only thing that is missing is a way of homing Z, which as mentioned before is fine as long as you're manually setting the Z height before resuming the print with M916.


Log in to reply