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

    DUET3 any pin to detect poweroff and aid Zbraking?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    @dc42 @phaedrux
    8
    22
    1.3k
    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.
    • JayTundefined
      JayT
      last edited by

      Hi,

      I have a design of bed with 4 motors. The bed moves down on power down. I tried using Brake motors, but there is some 100-300ms delay between power off and in application of brake, during which the bed moves down.
      Is there any signal on the Duet 3 board that can be used to reduce this delay or to apply brake first and then release motors?
      I have tried connecting relays and the shorting the phase as suggested in
      https://forum.duet3d.com/topic/19206/duet-2-using-z-brake/11

      PCRundefined 1 Reply Last reply Reply Quote 0
      • PCRundefined
        PCR @JayT
        last edited by

        @jayt have you tried M569.7 with the latest beta?

        JayTundefined 1 Reply Last reply Reply Quote 0
        • JayTundefined
          JayT @PCR
          last edited by

          @pcr :
          I Read the instruction, but what i understand is this works only on expansion boards?
          Can I use say OUT3 of Duet3 to control all Z motors using this instruction?

          PCRundefined 1 Reply Last reply Reply Quote 0
          • PCRundefined
            PCR @JayT
            last edited by

            @jayt works with normal boards too.

            JayTundefined 1 Reply Last reply Reply Quote 0
            • JayTundefined
              JayT @PCR
              last edited by

              @pcr : I tried. but on power off, the brakes apply a little late, so the bed moves down a little.
              Any thing I am missing here? what else can be done to make this quick switch to brake?

              @dc42 : Is there a way, to save the last known bed deviation learned during auto levelling and then use them on power up, by homing Zmax?
              Then even if the bed goes down, we can try to level on power up using last known deviations?

              dc42undefined 1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators @JayT
                last edited by

                @jayt if you send M18 Z after the Z axis has been operated, does the bed drop the same as it does at power down? Or more, less, or not at all?

                It may be possible to speed up the brake action by using an external circuit to control the brake solenoids. The reason is that the flyback diode that protects the mosfet slows down the release of the brake solenoid. I can provide a schematic of what's needed if you like. However, it will still take a little while for the spring to engage the brake after the solenoid releases it; so although this may help it's unlikely to be a complete solution.

                Another thing you could do is to disengage the brake in the M911 power off script.

                Regarding levelling at power up, have you seen https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors ? You need only probe the bed 3 or 4 times to level the motors. One they are levelled then you can load an existing height map, if that height map was obtained by probing immediately after the motors were levelled.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                JayTundefined 1 Reply Last reply Reply Quote 0
                • JayTundefined
                  JayT @dc42
                  last edited by

                  @dc42 :
                  thank you for responding quickly, please find responses inline.

                  1. M18 Z, I will try and confirm if the bed drops more or less or it doesn't.
                    But I tried both sequences, putting M18 Z in my M911 command and without as well. Both cases, the bed drops by 5-15mm untill brake is activated. I tried to use M569.7 with out3 and used that via a relay to signal braking.

                  2. I am ready to try any suggestion feasible. Please suggest what external circuit can be done to aid faster braking.

                  3. How to engage brake of motor in M911? I wish to engage brake before stepper torque is released or immediately when released.

                  4. Understood. But is it possible to change in RRF to read last learned deviations stored in a file and then call a function to apply those, in case of Power failure sequence?

                  JayTundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
                  • JayTundefined
                    JayT @JayT
                    last edited by

                    @jayt
                    @dc42
                    1.: on disabling motors using M18 Z, bed comes down a lot as much as it does without using M569.7.
                    with M569.7, on power up it stays still as stepper is activated and then the brake is released. On power off the bed comes down a bit but not as much as in the latter case.

                    1 Reply Last reply Reply Quote 0
                    • o_lampeundefined
                      o_lampe @JayT
                      last edited by

                      @jayt said in DUET3 any pin to detect poweroff and aid Zbraking?:

                      Please suggest what external circuit can be done to aid faster braking.

                      I think it's illusoric to believe that a faster switching circuit will completely keep the bed from dropping.

                      You could add counterweights to make the bed weightless or just go the usual way of re-levelling the bed as dc42 suggested.

                      JayTundefined 1 Reply Last reply Reply Quote 0
                      • JayTundefined
                        JayT @o_lampe
                        last edited by JayT

                        @o_lampe :
                        Consider a scenario, where there is print on the bed, on power off the bed goes down. I can home the printer on Zmax, but without probing, how do I apply relevelling w.r.t old heightmap deviations?

                        What I understood from heightmap is its for mesh bed compensation. Even if I reload map using G29, how will it get applied when I resume print after power failure ? Can you elaborate on this for me please?

                        engikeneerundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
                        • chas2706undefined
                          chas2706
                          last edited by

                          I have a large heavy printbed that had the same problems with dropping unlevel at power off.
                          Here's how I overcome it:

                          I grabbed a stepper brake design from thingyverse and modified it for use with a solenoid.
                          Here is the final result:

                          Z Brake.jpg

                          I have these on all 3 Z steppers and they are controlled by a cheap arduino nano.
                          The nano is used as an interface to be able to control the braking exactly how I want.
                          It looks for a brake control signal that I set up on the Duet 3 board.

                          By default the brakes are on. When the printer is powered up one of the first commands in config.g is to enable the Z motors. This locks their positions and therefore is now safe to release the brakes without causing any Z movement.
                          The only downside is that for complete control I have to use my own board reset, e-stop and shutdown macros but this is not a real problem for me.

                          Visually, I no longer see any Z drop but to be safe after every power up I do one quick bed level
                          which before the upgrade would have not been enough to level the bed accurately.
                          Now, I see no bed drop and the bed is guaranteed level within seconds of power up.

                          Here is what is required:

                          In config.g:

                          ; Z brake control
                          M17 Z ; enable Z motors to hold bed position before brake is released

                          ; set up servo brake signal on out5
                          M950 P5 C"io5.out"
                          M42 P5 S255 ; brake off

                          My Macros:

                          E-Stop:
                          M42 P5 S0 ; brake on
                          G4 P500 ; wait 500 milli seconds
                          M112

                          Reset:
                          M42 P5 S0 ; brake on
                          G4 P500 ; wait 500 milli seconds
                          M999

                          shutdown:
                          ; macro to shutdown printer after hot end has cooled down
                          ; carry out some checks first

                          G10 S0 R0 ; Set active and standby temps to zero to ensure nothing is on standby
                          M140 S0 ; heated bed heater off

                          ; only shutdown if extruder temperature is below 70

                              while true
                                 if sensors.analog[1].lastReading > 70            ; if hot end temperature is 70 or above then cool down
                                  M291 P{"Hot end temperature too high, cooling in progress!" } R"Power Management" S1 T0
                                  ;break                                          ; if not true, go to next command
                              
                                 if sensors.analog[1].lastReading < 68 
                                  M291 P{"Hot end temperature < 68, shutting down now" } R"Power Management" S0 T4
                                   M42 P5 S0   ; apply Z brakes
                                    G4 S2		; wait 2 seconds
                                     M81                                              ; atx power off
                          

                          Arduino code:
                          #include <Servo.h>

                          //Define duet output pin
                          #define inPin 12

                          #define PUSHED HIGH // look for active high

                          byte lastState;
                          unsigned long startMillis; // time variable
                          Servo servo1;
                          Servo servo2;
                          Servo servo3;

                          void setup()
                          {
                          servo1.attach(3); // servo 1
                          servo2.attach(4); // servo 2
                          servo3.attach(5); // servo 3
                          pinMode(inPin, INPUT_PULLUP);
                          //keep brake on at power up (brake arm is at 90 degrees when in off position!)
                          servo1.write(0); // brake on
                          servo2.write(0);
                          servo3.write(0);
                          delay(10000); // delay for duet initialisation
                          servo1.write(100); // brake off
                          servo2.write(100);
                          servo3.write(100);
                          delay(10000);

                          }
                          // duet in control from here onwards
                          void loop()
                          {
                          byte thisState = digitalRead(inPin);

                          //look for changed state?
                          if (lastState != thisState)
                          {
                          //update to the new state
                          lastState = thisState;
                          //record time
                          startMillis = millis();
                          }
                          //check for changed state
                          // if (lastState == PUSHED) {

                          // inPin state must have changed for >= 2 seconds to eliminate false triggers
                          if (lastState == PUSHED && millis() - startMillis >= 2000UL)
                          {
                          servo1.write(100); // brake off if input high
                          servo2.write(100);
                          servo3.write(100);
                          delay(1000);
                          }
                          else
                          {
                          servo1.write(0); // brake on if input low
                          servo2.write(0);
                          servo3.write(0);
                          delay(1000);
                          }

                          }

                          1 Reply Last reply Reply Quote 3
                          • engikeneerundefined
                            engikeneer @JayT
                            last edited by

                            @jayt said in DUET3 any pin to detect poweroff and aid Zbraking?:

                            What I understood from heightmap is its for mesh bed compensation. Even if I reload map using G29, how will it get applied when I resume print after power failure ? Can you elaborate on this for me please?

                            Just send G29 S1 after you have homed to Z max to load the heightmap

                            E3D TC with D3Mini and Toolboards.
                            Home-built CoreXY, Duet Wifi, Chimera direct drive, 2x BMG, 300x300x300 build volume
                            i3 clone with a bunch of mods

                            Phaedruxundefined 1 Reply Last reply Reply Quote 0
                            • Phaedruxundefined
                              Phaedrux Moderator @engikeneer
                              last edited by

                              @engikeneer said in DUET3 any pin to detect poweroff and aid Zbraking?:

                              Just send G29 S1 after you have homed to Z max to load the heightmap

                              As long as the Z0 point is the same when homing with Z max and homing with the probe, this will work just fine.

                              The best way to ensure this is to have a macro that homes z using the probe and then moves to Z max and sets the actual Z axis length so that when the Z max endstop is used the position is correct.

                              Example

                              ; 0:/macros/Bed Leveling/0_Set Zmax height.g
                              ; Automates measuring the Zmax height for optical endstop at ~300mm
                              ;
                              M291 P"This will set Z0 and calibrate Zmax height" R"Proceed?" S3
                              M291 P"Homing all axis" T5
                              G28			; Home all
                              G90			; Absolute positioning
                              M98 P"0:/macros/0_Center Nozzle.g"	; Move nozzle to bed center	
                              M291 P"Adjust nozzle height until it's touching bed" Z1 S3
                              G92 Z0 			; set Z0
                              M291 P"Bed will now drop to Z300" S3
                              G1 Z300			; Move bed down 300mm
                              G1 S3 Z300 F200
                              M500 ; save m208 value for z axis to config override
                              M291 P"Adjust optical endstop flag until light just turns off" R"Set Zmax=300mm" S3
                              M291 P"ZMax homing will now be tested, starting with homing Zmin" S3
                              M291 P"Homing to Zmin" T5
                              G28 Z
                              M291 P"Ready to test Zmax homing?" R"Proceed?" S3
                              M291 P"Homing to Zmax" T5
                              M98 P"0:/macros/2_HomeZMax.g" ; Test Zmax homing
                              M291 P"ZMax homing test complete. Printer will now home all." R"Proceed?" S3
                              G28	; Home all
                              M291 "ZMax calibration complete." S3
                              

                              Z-Bot CoreXY Build | Thingiverse Profile

                              JayTundefined 1 Reply Last reply Reply Quote 2
                              • o_lampeundefined
                                o_lampe @JayT
                                last edited by

                                @jayt said in DUET3 any pin to detect poweroff and aid Zbraking?:

                                What I understood from heightmap is its for mesh bed compensation. Even if I reload map using G29, how will it get applied when I resume print after power failure ? Can you elaborate on this for me please?

                                I never had a power failure, but fom what I know, the last position is stored on SD.
                                After homing to Z-max and applying G29 S1 but before hitting the resurrect button, you can direct the nozzle to that position and see if it's reasonable. With a little luck you are somewhere in the infill so it's safe to do minor adjustments to the position if needed.

                                Worst case in a power failure scenario is the bed temp dropping to a point where it's almost certain you'll kick off the part when you continue printing.
                                If you see power grid failures often where you live, it's probably safer to use a backup battery. (old e-bike or RC hobby LiPo batteries)

                                A more advanced πŸ˜‰ solution would be an automatically compensated counterweight : You'd install two empty buckets as counterweights for the empty bed and during print you fill them with water to compensate for the filament weight. A peristaltic pump parallel to the extruder could do this. Change mixing ratio for different filament density.
                                ...crazy idea, I know 😁

                                1 Reply Last reply Reply Quote 1
                                • JayTundefined
                                  JayT @Phaedrux
                                  last edited by JayT

                                  Thank you for all the replies. I used M569.7 with one of the out signal, so on power off, the bed fall is now quite less. So I donot wish to include counter balance, but instead check if G29 can help.

                                  @phaedrux , @engikeneer :
                                  a) I need a little help to understand what happens when I run G29 S1 on power on, when config is read. From my understanding, this will load the height map, but to perform mesh bed compensation. It does not apply correction to ball screw like we do in bed levelling in one shot right? it will be a correction that will apply at each layer right until taper height?

                                  b) Suppose first few layers we applied mesh bed compensation. Now after say Xmm height, power goes off.
                                  Now if I use Zmax homing and resume, will it not resume at proper height? Will there be chances of nozzle hitting the print due to compensation applied?

                                  c) @dc42: Is there a way, the way we save heightmap , we can use this to run Auto-level on power up by updating few things in the firmware? I am ready to try if there is a way?

                                  Phaedruxundefined 1 Reply Last reply Reply Quote 0
                                  • Phaedruxundefined
                                    Phaedrux Moderator @JayT
                                    last edited by

                                    @jayt G29 S1 should not be used in config.g. The heightmap should only be loaded after your Z axis has been homed. In the case of power loss resume, the correct place to load it would be in the resurrect-prologue.g file after the Z axis has been rehomed.

                                    Z-Bot CoreXY Build | Thingiverse Profile

                                    JayTundefined 1 Reply Last reply Reply Quote 1
                                    • JayTundefined
                                      JayT @Phaedrux
                                      last edited by

                                      @phaedrux : ok understood.
                                      Can you clarify one more question, IF we define taper height, and after Zmax home-> resume-> it will again apply correction for defined taper height right?
                                      i.e. if taper height is 10, then on resume if Zprinted is >10mm, it will again apply correction for 10mm ?
                                      (I know this is silly question, but I am new to this topic. )

                                      Phaedruxundefined engikeneerundefined 2 Replies Last reply Reply Quote 0
                                      • Phaedruxundefined
                                        Phaedrux Moderator @JayT
                                        last edited by

                                        @jayt said in DUET3 any pin to detect poweroff and aid Zbraking?:

                                        it will again apply correction for defined taper height right?
                                        i.e. if taper height is 10, then on resume if Zprinted is >10mm, it will again apply correction for 10mm ?

                                        That sounds correct to me.

                                        Z-Bot CoreXY Build | Thingiverse Profile

                                        1 Reply Last reply Reply Quote 0
                                        • engikeneerundefined
                                          engikeneer @JayT
                                          last edited by

                                          @jayt no, it will only apply correction from z=0 to z=10 (in decreasing amounts). So if you resume a print at z =50, no correction will occur

                                          E3D TC with D3Mini and Toolboards.
                                          Home-built CoreXY, Duet Wifi, Chimera direct drive, 2x BMG, 300x300x300 build volume
                                          i3 clone with a bunch of mods

                                          JayTundefined 1 Reply Last reply Reply Quote 2
                                          • JayTundefined
                                            JayT @engikeneer
                                            last edited by JayT

                                            @engikeneer @Phaedrux : Both of yours answers are contradictory 😟
                                            Can you check if you have these settings in place?

                                            @dc42 : Any way to apply last learned deviation corrections, after Zmax homing , on power up , by changing RRF? I tried to check few files, in Zleadscrewkinematics.cpp, can we use function: "Write ResumeSetting()" to call function that applies last learned corrections (if saved) ? Do you suggest to do so?

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