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

    EndStop Accuracy Test

    Scheduled Pinned Locked Moved Unsolved
    Gcode meta commands
    5
    13
    668
    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.
    • Nazarundefined
      Nazar
      last edited by

      Hello,

      I want to create a script to test repeatability of X and U axis movements and check for missed steps by stepper motors

      Machine will move axis and then should come to an endstop and save the position by triggering it. Position value should be stored and Max deviation should be found to check if any steps were skipped.

      My draft is attached below:

      G28
      
      M574 X1 S1 P"duex.e4stop"  ;Free Up "E0stop" Pin by Assigning to unused pin
      M574 U2 S1 P"duex.e5stop"  ;Free Up "E1stop" Pin by Assigning to unused pin
      
      M558 K1 P8 C"E0stop" H5 F6000 T30000
      M558 K2 P8 C"E1stop" H5 F6000 T30000
      
      while iterations <=3
        G1 F18000 X0 Y0 U999
      
        G1 X-999
        G1 X150
        G1 X-999
      
        G1 U999
        G1 U-150
        G1 U999
        
        G1 Y170 X-200 U200
        G38.4 K1 X-215
        echo move.axes[0].userPosition
        
        G38.4 K2 U215
        echo move.axes[3].userPosition
      
      M574 X1 S1 P"E0stop"
      M574 U2 S1 P"E1stop"
      

      Please let me know if there is a simpler solution?
      I want to add a max deviation analysis but do not know if it is possible?

      I wanted to add another while loop inside existing one to move the axis to move few times, but it did not work, please let me know if it is possible as well?

      Example attached bellow:

      while iterations <=3
        G1 F18000 X0 Y0 U999
      
        while iterations <=3
          G1 X-999
          G1 X150
          G1 X-999
        
          G1 U999
          G1 U-150
          G1 U999
        
        G1 Y170 X-200 U200
        G38.4 K1 X-215
        echo move.axes[0].userPosition
        
        G38.4 K2 U215
        echo move.axes[3].userPosition
      
      M574 X1 S1 P"E0stop"
      M574 U2 S1 P"E1stop"
      
      dc42undefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined Phaedrux marked this topic as a question
      • Phaedruxundefined Phaedrux moved this topic from Tuning and tweaking
      • dc42undefined
        dc42 administrators @Nazar
        last edited by

        @Nazar I think it would be easier to leave the endstop switches enabled and use G1 H3 or G1 H4 commands to move to the endstops without resetting the current position.

        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

        Nazarundefined 1 Reply Last reply Reply Quote 0
        • Nazarundefined
          Nazar @dc42
          last edited by

          @dc42 thank you for your recommendation, I have read about both commands and I do not think they are suitable because G1 H3 will reset the axis limit, and G1 H4 will update the current position, but I do not need to change the position, I need to read the deviation between machine's position and triggered position to then report it to the user.

          Please let me know if there is solution for that.

          deckingmanundefined dc42undefined 2 Replies Last reply Reply Quote 0
          • deckingmanundefined
            deckingman @Nazar
            last edited by

            @Nazar

            For info, the repeatability of a cheap mechanical end stop is about +_0.2mm and one micro-step is about 0.0125mm (at 80 steps per mm). So if you want to check for missed steps using an end stop, you need one with a repeatability better than 0.0125mm.

            But take a look at the macros that @jay_s_uk posted in this thread https://forum.duet3d.com/topic/32433/determining-max-speed-and-acceleration?_=1695128541482. They might give you some ideas.

            Essentially that thread was about trying to find the maximum speeds and accelerations that could be used before missed steps were encountered by homing the printer, doing a series of high speed moves, then using the end stops to check the positional accuracy. So there are similarities with what you are trying to do and the macros might be useful (assuming you can find a suitable end-stop switch with the required repeatability).

            Ian
            https://somei3deas.wordpress.com/
            https://www.youtube.com/@deckingman

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

              @Nazar I think G1 H4 will do exactly what you need.

              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

              Nazarundefined 1 Reply Last reply Reply Quote 0
              • Nazarundefined
                Nazar @dc42
                last edited by

                @dc42 Thank you, I will test it tomorrow
                @deckingman Thank you for the reference, I use high quality end stops, I want to look for missed steps

                deckingmanundefined 1 Reply Last reply Reply Quote 0
                • deckingmanundefined
                  deckingman @Nazar
                  last edited by

                  @Nazar said in EndStop Accuracy Test:

                  @deckingman ................... I use high quality end stops, I want to look for missed steps

                  You don't say what the repeatability of your end stop switches are though. Just because they are high quality, doesn't mean the repeatability will be good enough when looking at differences of 0.0125mm. You certainly won't do it with a conventional micro-switch. I can recommend Metrol Ultra Precision switches which have a claimed repeatability of 0.005 mm (so roughly half of one micro-step). I used to use one as my Z "probe". Here in the UK they cost about £90 GBP plus taxes and shipping.

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

                  jens55undefined Nazarundefined 2 Replies Last reply Reply Quote 0
                  • jens55undefined
                    jens55 @deckingman
                    last edited by

                    @deckingman, what made you go with the Metrol switch when a BLTouch has the same repeatability/accuracy?

                    deckingmanundefined 1 Reply Last reply Reply Quote 0
                    • deckingmanundefined
                      deckingman @jens55
                      last edited by

                      @jens55 said in EndStop Accuracy Test:

                      @deckingman, what made you go with the Metrol switch when a BLTouch has the same repeatability/accuracy?

                      Two reasons. Firstly it was before the BL touch came into existence. Secondly the application was a bit different in that I use the actual nozzle as a probe. My hot ends are mounted in such a way that they have zero movement in X and Y but are able to move in Z a few mm (against a spring). I wanted to be able to detect that vertical hot end movement. Nowadays I use two solid brass contacts which form the physical hot end stop but also make a switch with excellent repeatability and zero histeresis (and it's a fraction of the cost).

                      Ian
                      https://somei3deas.wordpress.com/
                      https://www.youtube.com/@deckingman

                      1 Reply Last reply Reply Quote 0
                      • Nazarundefined
                        Nazar @deckingman
                        last edited by

                        @dc42 Thank you so much for your advice, G1 H4 works for my application

                        @deckingman Thank you for bringing a point and end stop recommendation, I am using Omron D2F micro switches (with no arm for increased accuracy). The result I have are controversial, I am getting standard deviation the data set approximately 0.1129 mm, which is much higher that I was expecting, the test code is attached bellow:

                        echo >"0:/macros/accuracy.g" "EndStop Test Start"
                        echo >>"0:/macros/accuracy.g" " "
                        
                        G28 X
                        G90
                        G1 Z50 F18000
                        
                        
                        while iterations <100
                        	M400
                        	G91
                        	G1 X2 F600
                        	G1 H4 X-10 F240
                        	var dd = move.axes[0].min  - move.axes[0].machinePosition
                        	echo "X "^{var.dd}
                        	echo >>"0:/macros/accuracy.g" ""^{var.dd}
                        

                        My machine is able to conductively probe the aluminum build plate with a nozzle, I have run the script attached bellow an got similarly large standard divination of 0.0967mm

                        echo >"0:/macros/accuracy.g" "Nozzle Test Start"
                        echo >>"0:/macros/accuracy.g" " "
                        M42 P4 S1        ; Turn on relay, engage probing (ESD Warning)
                        M208 Z-3.5 S1    ; set axis minima
                        
                        G1 X-999 U999 Y0 Z5 F18000
                        G1 Z-99
                        
                        G91
                        G38.4 K0 X10
                        M400
                        G92 X0
                        
                        while iterations <100
                        	M400
                        	G91
                        	G1 X-1 F600
                        	G38.4 K0 X2
                        	var dd = move.axes[0].machinePosition
                        	echo "X "^{var.dd}
                        	echo >>"0:/macros/accuracy.g" ""^{var.dd}
                        
                        G1 Z10 F18000
                        M208 Z0 S1    ; set axis minima
                        G90
                        G28 X
                        

                        I have rigidity mounted the same end stop to the toolhead, run the script below, and got deviation from mean 0.002mm, again this is with same end stop, just mounted to toolhead and measured with Z - Axis

                        G30 P0 X0 Y0 Z-99999
                        G30 P1 X0 Y0 Z-99999
                        G30 P2 X0 Y0 Z-99999
                        G30 P3 X0 Y0 Z-99999
                        G30 P4 X0 Y0 Z-99999
                        G30 P5 X0 Y0 Z-99999
                        G30 P6 X0 Y0 Z-99999
                        G30 P7 X0 Y0 Z-99999
                        G30 P8 X0 Y0 Z-99999
                        G30 P9 X0 Y0 Z-99999
                        G30 P10 X0 Y0 Z-99999
                        G30 P11 X0 Y0 Z-99999
                        G30 P12 X0 Y0 Z-99999
                        G30 P13 X0 Y0 Z-99999
                        G30 P14 X0 Y0 Z-99999
                        G30 P15 X0 Y0 Z-99999
                        G30 P16 X0 Y0 Z-99999
                        G30 P17 X0 Y0 Z-99999
                        G30 P18 X0 Y0 Z-99999
                        G30 P19 X0 Y0 Z-99999
                        G30 P20 X0 Y0 Z-99999
                        G30 P21 X0 Y0 Z-99999
                        G30 P22 X0 Y0 Z-99999
                        G30 P23 X0 Y0 Z-99999
                        G30 P24 X0 Y0 Z-99999
                        G30 P25 X0 Y0 Z-99999
                        G30 P26 X0 Y0 Z-99999
                        G30 P27 X0 Y0 Z-99999
                        G30 P28 X0 Y0 Z-99999
                        G30 P29 X0 Y0 Z-99999
                        G30 P30 X0 Y0 Z-99999 S-1
                        

                        Results:

                        G32 bed probe heights: 0.020 0.020 0.016 0.020 0.016 0.015 0.016 0.020 0.016 0.019 0.015 0.015 0.016 0.016 0.021 0.017 0.016 0.016 0.016 0.016 0.015 0.020 0.020 0.015 0.016 0.015 0.015 0.016 0.016 0.015 0.015, mean 0.017, deviation from mean 0.002
                        

                        When I run test using G38.2 with the same end stop attached to the toolhead I get much larger divinations of 0.2657mm, code is attached below:

                        echo >"0:/macros/accuracy.txt" "Z probe with G38 Test Start"
                        echo >>"0:/macros/accuracy.txt" " "
                        
                        
                        
                        G1 X0 U999 Y0 Z20 F18000
                        M42 P4 S1        ; Turn on relay, engage probing (ESD Warning)
                        
                        G91
                        G38.2 K0 Z-30
                        M400
                        G92 Z0
                        
                        while iterations <100
                        	M400
                        	G91
                        	G1 Z2 F600
                        	G38.2 K0 Z-3
                        	var dd = move.axes[2].machinePosition
                        	echo "X "^{var.dd}
                        	echo >>"0:/macros/accuracy.txt" ""^{var.dd}
                        
                        G1 Z50 F18000
                        G90
                        

                        @deckingman what do you think?

                        I have a theory that large deviations can be caused by reading them with G38 or G1 H2 followed by move.axes[2].machinePosition variable, meaning we measure not a triggered position but the position after it was triggered and stopped somewhere @dc42 what do you think?

                        dc42undefined mrehorstdmdundefined 2 Replies Last reply Reply Quote 0
                        • dc42undefined
                          dc42 administrators @Nazar
                          last edited by

                          @Nazar in RRF 3.5.x the machine position is read during moves instead of only at the end of a move, and at most every 250ms. So if you read the machine position immediately after the G1 H4 or G38.2 move has completed, you may gat a value that is up to 250ms out of date.

                          I suggest you insert command G4 P260 after the G1 or G38.2 command, before you read the machine position.

                          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

                          1 Reply Last reply Reply Quote 0
                          • mrehorstdmdundefined
                            mrehorstdmd @Nazar
                            last edited by

                            @Nazar I ran a couple test prints after I swapped out microswitches for opto endstops in my printer. The precision of the opto endstops was very high. I didn't make measurements, but I compared prints, one made with homing only at the start of the print and the other with homing at each layer change. See: https://drmrehorst.blogspot.com/2020/03/testing-ummds-xy-optical-endstops.html

                            The endstops I used were purchased on Amazon for 3 for $10 and included an LM393 comparator chip. They claim 0.002mm precision. I haven't seen the same endstops for sale there for a while, but there are probably others like them available elsewhere for similar price.

                            I ran into one problem with opto endstops in my printer- the work room where the printer sits has a large, east-facing window and sunlight falling directly on the printer interfered with them. It took a while to figure out what was going on, but closing the curtains on the window solved the problem. I've never had any other problems with them.

                            https://drmrehorst.blogspot.com/

                            deckingmanundefined 1 Reply Last reply Reply Quote 0
                            • deckingmanundefined
                              deckingman @mrehorstdmd
                              last edited by

                              @mrehorstdmd said in EndStop Accuracy Test:

                              ................ I ran into one problem with opto endstops in my printer- the work room where the printer sits has a large, east-facing window and sunlight falling directly on the printer interfered with them. It took a while to figure out what was going on, but closing the curtains on the window solved the problem. I've never had any other problems with them.

                              That reminds me of a similar issue I came across. I use a slotted opto switch to get my bed somewhere close at highish speed before homing "proper" using the nozzle. When I first tried to test the switch, it didn't seem to be triggering until I realised that it was seeing straight through the thin piece of paper I was using as a "flag". 😊 (It doesn't see though a piece of 2mm thick aluminium though). ☺

                              Ian
                              https://somei3deas.wordpress.com/
                              https://www.youtube.com/@deckingman

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