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

Detecting Z-Probe Pickup on move command

Scheduled Pinned Locked Moved
Gcode meta commands
5
57
2.5k
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.
  • undefined
    fcwilt @sinned6915
    last edited by 11 Feb 2021, 00:07

    @sinned6915 said in Detecting Z-Probe Pickup on move command:

    it seems that to make it work, I HAVE to change the probe logic, and that is where I am getting tripped up. it also has to get changed back to probe the bed.

    You should not have to do that.

    Once the probe displays 1000 in the DWC when it is activated and 0 when it is not you have the correct settings for all uses as a probe.

    Unless you have two probes - then you can configure each one separately to obtain the correct values.

    Frederick

    Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

    1 Reply Last reply Reply Quote 0
    • undefined
      sinned6915 @fcwilt
      last edited by sinned6915 2 Nov 2021, 01:15 11 Feb 2021, 00:28

      @fcwilt said in Detecting Z-Probe Pickup on move command:

      I cannot find the configuration commands that set the switch to be an Z endstop.

      I am reading the command reference for M574. There is a difference in the application in RRF2 an 3.

      https://duet3d.dozuki.com/Wiki/Gcode#Section_M574_RepRapFirmware_Num_3

      and the Snnn options -

      1 = switch-type (eg microswitch) endstop input,
      2 = Z probe (when used to home an axis other than Z),
      3 = single motor load detection,
      4 = multiple motor load detection (see Notes).

      M574 says if you use the swtich as active low, invert it by prefixing the pin name with !.
      eg: P"!xstop"

      RRF3 introduced the C parameter to define the input pin, and the M558 notes for RRF3 says to invert the input, prefix the C with !.
      eg: !C

      EDIT: The other issue is that the logic and threshold numbers change. Changing the probe type inverts the probe value. I was under the impression that 1000 was high and 0 was low, but it seems to be more realted to the state of the probe.

      alt text

      alt text

      1 Reply Last reply Reply Quote 0
      • undefined
        fcwilt
        last edited by 11 Feb 2021, 01:43

        @sinned6915 said in Detecting Z-Probe Pickup on move command:

        M574 Z1 S2 ; configure Z-probe endstop for low end on Z

        You posted this earlier on...

        M574 Z1 S2 ; configure Z-probe endstop for low end on Z

        From the documentation you pasted...

        2 = Z probe (when used to home an axis other than Z),

        Notice the other than Z

        Again from the documentation you pasted...

        1 = switch-type (eg microswitch) endstop input,

        To use that switch as an Z endstop you need an M574 like this.

        M574 Z1 S1 C"name_of_pin_switch_is_connected_to"

        You also may need the ^ and/or ! character to get the endstop state to match the switch state.

        Is this switch used for some other purpose - you mention probing the bed? I was thinking this switch was mounted to the frame but it seems it may be mounted to the gantry?

        I don't think the same input can be an endstop input and a z probe input at the same time. But I need to verify that. In any case re-configuring it depending on what you need to do that that moment is perfectly fine and not uncommon.

        Frederick

        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

        undefined 2 Replies Last reply 11 Feb 2021, 02:20 Reply Quote 0
        • undefined
          sinned6915 @fcwilt
          last edited by sinned6915 2 Nov 2021, 02:22 11 Feb 2021, 02:20

          @fcwilt i agree with your breakdown of the options and paramters.

          Here's the thing though, I gave up trying to migrate my RRF2 setup by hand becasue of all the version changes and choose to use the RRF3 configurator and just start over. I reloaded the .json file and configs that ended up with to make the screenshot.

          These were my results and it seemed reasonable, and I have been using it since. I trusted that the configurator was vetted and correct.

          The additonal drives that I had to define for Z were later reworked and remapped.

          Could there be a mistake in the configurator or in the docs?

          alt text

          undefined 1 Reply Last reply 11 Feb 2021, 04:04 Reply Quote 0
          • undefined
            sinned6915 @fcwilt
            last edited by sinned6915 2 Nov 2021, 02:35 11 Feb 2021, 02:32

            @fcwilt said in Detecting Z-Probe Pickup on move command:

            Is this switch used for some other purpose - you mention probing the bed? I was thinking this switch was mounted to the frame but it seems it may be mounted to the gantry?

            I am physically (mechanically and electrically) deploying and retracting the switch that is used for probing and z-endstop.

            The top half is mounted to the carraige. It has 2 magnets- one is wired to zprobe.in, the other to ground. The LED is wired to Vcc and when the circuit is complete (ie probe picked up)
            alt text

            The bottom half also has 2 magnets. One magnet is to wired to the Common terminal, the other to the Normally Closed terminal. It acts like a momentary swtich.
            alt text

            Here are the details if you want to dive in -
            https://github.com/nionio6915/Euclid_Probe

            undefined 1 Reply Last reply 11 Feb 2021, 02:56 Reply Quote 0
            • undefined
              fcwilt @sinned6915
              last edited by 11 Feb 2021, 02:56

              @sinned6915

              Thank you. That helps tremendously.

              So when the top half picks up the bottom have you have a assembly of the two parts with a "push button" on the underside which you can use as a Z probe? Is that correct?

              Is they system used to pick up any other kind of bottom half?

              Or is it just to have a Z probe that can be installed and removed automatically as needed?

              Thanks.

              Frederick

              Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

              1 Reply Last reply Reply Quote 0
              • undefined
                fcwilt @sinned6915
                last edited by 11 Feb 2021, 04:04

                @sinned6915 said in Detecting Z-Probe Pickup on move command:

                Could there be a mistake in the configurator or in the docs?

                There have been mistakes in both in the past.

                I don't use the configurator - I rather learn the commands - it makes solving problems easier.

                Frederick

                Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                1 Reply Last reply Reply Quote 0
                • undefined
                  sinned6915
                  last edited by 12 Feb 2021, 02:10

                  I get the behavior that I want with a pickup of the probe and exiting the dock, but the macro seems to loop now and I dont understand why.

                  alt text

                  After homing X & Y, trying to home Z seems to deploy the probe correctly using a G1 H1 command. Then the carraige moves to the center of the bed as instreucted in the homez.g files, but at the point where the G30 command is used, the machine appeard to start the deploypobe over. I am confused why it is doing this?

                  Should I be using a G1 H1 command here instead?

                  ; ***********************************************************
                  ; deployprobe.g
                  ; ***********************************************************
                  M118 S"deployprobe.g start"
                  echo sensors.probes[0].value[0]
                  G91
                  M564 H0 S0 ; allow movement while not homed
                  G1 Z15 F6000 ; move Z 10 for clearance above dock.
                  ; need to figure out some safety check on this
                  G90
                  if sensors.probes[0].value[0]!=1000 ; if sensor is value other than 1000 do this
                  abort "deployprobe: value0 Probe already picked up. Manually return probe to the dock"
                  ; if we're here we know it's becasue the above is true which I assume is because you have an N0 switch as a probe.
                  ; change probe temporarily to mimic NO to go to NC on pickup
                  M558 K0 P8 C"^!zprobe.in" H10 R0.5 F200 T9000 A1 S0.03
                  M118 S"Flipped probe from NC to NO"
                  echo sensors.probes[0].value[0]
                  M400
                  G1 X0 Y0 F6000 ; move above probe dock location
                  M400 ; wait for moves to finish
                  G1 H1 Z-280 F300 ; controlled linear move up the height of build envelope
                  ; H1 terminate the move when the endstop switch is triggered
                  ; and set the axis position to the axis limit defined by M208
                  G91 ; relative coords
                  G1 Z-1 F600 ; move bed up 1 to clear probe from dock since mags pull it up
                  M400 ; wait for move to finish
                  G1 X50 F3000 ; move right so probe moves out of the dock
                  G1 Z5 F3000 ; move bed to clear probe from glass build surface
                  G1 X100 F6000 ;
                  G90 ; absolute coords
                  M400 ; wait for moves to finish
                  echo sensors.probes[0].value[0]
                  M558 K0 P8 C"^zprobe.in" H10 R0.5 F200 T9000 A1 S0.03 ; NC synatax
                  M118 S"Flipped probe from NO to NC"
                  echo sensors.probes[0].value[0]
                  G4 S5 ; wait 1 second
                  ; M564 S1 ; limit axis to print area
                  ; while sensors.probes[0].value[0]=1000 ; loop to check when NC probe value changes from 1000 to 0
                  ; while sensors.probes[0].value[0]=0 ; loop to check when N0 probe value changes from 0 to 1000
                  ; if sensors.probes[0].value[0]=0 ; if sensor is value is 0 do this
                  ; move bed with probe dock up 0.5mm at a time until the switch activate.
                  ; This will get ugly if the switch fails as you have limits off!
                  ; echo sensors.probes[0].value[0]
                  ; echo iterations
                  ; if iterations=1000
                  ; break
                  echo sensors.probes[0].value[0]
                  if sensors.probes[0].value[0]!=0
                  abort "deployprobe: endvalue not 0 Probe not picked up! Print cancelled."

                  Here is the console output-
                  alt text

                  Here are the contents of homez.g-

                  ; ***********************************************************
                  ; homez.g
                  ; ***********************************************************
                  M118 S"homez.g started"
                  if !move.axes[0].homed || !move.axes[1].homed ; If the printer hasn't been homed, home it
                  M98 P"0:/sys/homexy.g"
                  M561 ; clear any bed transform
                  M290 S0 R0 ; clear baby steps per Wes C
                  G91 ; relative positioning
                  ; G1 H2 Z6 F6000 ; lift Z relative to current position
                  G90 ; absolute positioning
                  M401 P0 ; This runs macro file deployprobe
                  G1 X145 Y162.5 F9000 ; go to first probe point
                  M400
                  G30 ; home Z by probing the bed
                  M400
                  G4 P500
                  M118 S"Call 4 point macro"
                  M98 P"0:/sys/bed4point.g" ; tram bed
                  ;
                  G1 X145 Y165 F9000 ; go back to the first probe point and reprobe 0 in case it moved
                  G30
                  M402 P0 ; retract probe
                  G1 Z10 F600 ; lift Z relative to current position
                  G90 ; absolute positioning
                  M564 S1 H0
                  ; G1 X150 Y0 F9000 ; move carraige to center front
                  1 Reply Last reply Reply Quote 0
                  • undefined
                    fcwilt
                    last edited by fcwilt 2 Dec 2021, 03:30 12 Feb 2021, 03:29

                    G1 H1 commands are used with endstops. G1 H1 commands have nothing to do with deploying Z probes.

                    G30 commands are used with a Z probe.

                    There is no reason I can think of to be using while loops to accomplish your goal.

                    If you configure the switch device as an Z endstop then a G1 H1 move in the correct direction will stop when the switch is activated.

                    If you configure the switch device as a Z probe then a G30 command (if it moves toward the switch) will stop when the switch is activated.

                    The above assumes the switch device is activated with sitting in the dock.

                    Rather then spend time working with loops why don't you try to get one of the above approaches to work.

                    You can code some simple macros to test each approach.

                    Frederick

                    Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                    undefined 1 Reply Last reply 12 Feb 2021, 05:42 Reply Quote 1
                    • undefined
                      sinned6915 @fcwilt
                      last edited by sinned6915 2 Dec 2021, 05:49 12 Feb 2021, 05:42

                      @fcwilt I am a little confused by your response. I am not using while loops anymore. The test bits of code from earlier are all commented out. I just have not deleted them yet.

                      I have a G1 H1 Z-280 F300 to pick the switch up from the dock.

                      Once the switch is picked up from the dock and positioned at the center of the bed, when I issue the G30 command to what I think should be singe point probe to define Z=0.

                      Instead it seems to start the deployprobe.g macro again. That is what makes no sense to me

                      Are you saying I should use G1 instead? If that is the case, then how do we take into account the probe offset?

                      undefined 2 Replies Last reply 12 Feb 2021, 06:22 Reply Quote 0
                      • undefined
                        fcwilt @sinned6915
                        last edited by fcwilt 2 Dec 2021, 07:52 12 Feb 2021, 06:22

                        @sinned6915 said in Detecting Z-Probe Pickup on move command:

                        @fcwilt I am a little confused by your response. I am not using while loops anymore. The test bits of code from earlier are all commented out. I just have not deleted them yet.

                        Sorry - my bad - I was looking at the commands and didn't notice the bits you had commented out.

                        I have a G1 H1 Z-280 F300 to pick the switch up from the dock.

                        This works? Is that switch at that point configured as a Z endstop?

                        Once the switch is picked up from the dock and positioned at the center of the bed, when I issue the G30 command to what I think should be singe point probe to define Z=0.

                        Instead it seems to start the deployprobe.g macro again. That is what makes no sense to me

                        I'm not sure what you mean by "again" - when was it called before this?

                        The G30 command uses the Z probe. So it calls deployprobe.g before it tries to use it.

                        And retractprobe.g will be called when the G30 is finished with it.

                        Is that not happening?

                        Frederick

                        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                        1 Reply Last reply Reply Quote 0
                        • undefined
                          OwenD
                          last edited by 12 Feb 2021, 07:29

                          You shouldn't have the moves to pick up the probe in deployprobe.g
                          I believe the intent of deployprobe.g is to extend the probe such as when a bltouch or servo probe is used.
                          As stated above, it is called internally at the start of G30.
                          If you're manually calling deployprobe.g using M98 and later using G30, then it would do it twice.
                          Move all that code to say "pickup-probe.g" and likewise put the code to dock the probe into say "dock-probe.g"

                          undefined 1 Reply Last reply 12 Feb 2021, 16:03 Reply Quote 1
                          • undefined
                            fcwilt @sinned6915
                            last edited by 12 Feb 2021, 08:34

                            @sinned6915

                            I got to thinking about your homeZ.g file.

                            You call M401 which invokes deployprobe.g.

                            Later you call G30 - which normally would call M401 but it seems to notice that M401 has already been called and does not call M401 again. It also does not call M402 as it normally would

                            Later still you call M402 which invokes retractprobe.g.

                            Are you invoking deployprobe.g directly using M98 somewhere? G30 does not notice that and invokes M401 calling deployprobe.g as it normally would.

                            Frederick

                            Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              dc42 administrators
                              last edited by dc42 2 Dec 2021, 09:24 12 Feb 2021, 09:23

                              You might want to configure two separate Z probes, one for the real probe and one for the pickup mechanism. RRF3.2 supports this. They can have each have their own deploy and retract files.

                              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

                              undefined 1 Reply Last reply 12 Feb 2021, 16:31 Reply Quote 2
                              • undefined
                                sinned6915 @OwenD
                                last edited by 12 Feb 2021, 16:03

                                @OwenD said in Detecting Z-Probe Pickup on move command:

                                You shouldn't have the moves to pick up the probe in deployprobe.g
                                I believe the intent of deployprobe.g is to extend the probe such as when a bltouch or servo probe is used.

                                That is where I started conceiving this approach. Does the machine really care what it does during the deployprobe?

                                As stated above, it is called internally at the start of G30.

                                Any idea where can I confirm this? I'm not distrusting you, I want to re-learn it and maybe re-write the approach I am using.

                                When I call homez.g, the routine is to pick up the probe via M400, probe Z in the middle of the bed, then probe the 4 corners and level the bed (basically 4-G30 commands, 3 indep motors), then re-probe Z.
                                The switch is already attached and it does not try to re-deploy the switch.

                                If you're manually calling deployprobe.g using M98 and later using G30, then it would do it twice.
                                I'm using M401 and M402 to deploy and retract the probe.

                                Move all that code to say "pickup-probe.g" and likewise put the code to dock the probe into say "dock-probe.g"

                                ; ***********************************************************
                                ; bed4point.g
                                ; ***********************************************************
                                G90
                                G30 P0 X0.0 Y5.0 F9000.0 Z-99999 ; probe front left
                                G30 P1 X0.0 Y275.0 F9000.0 Z-99999 ; probe back left
                                G30 P2 X270.0 Y275.0 F9000.0 Z-99999 ; probe back right
                                G30 P3 X270.0 Y5.0 F9000.0 Z-99999 S3 ; probe near front right leadscrew and calibrate 3 motors
                                undefined 1 Reply Last reply 12 Feb 2021, 16:29 Reply Quote 0
                                • undefined
                                  fcwilt @sinned6915
                                  last edited by 12 Feb 2021, 16:29

                                  @sinned6915 said in Detecting Z-Probe Pickup on move command:

                                  That is where I started conceiving this approach. Does the machine really care what it does during the deployprobe?

                                  You are using deployprobe.g correctly in that the code in that file needs to get the probe ready for use by G29 or G30.

                                  Some probes, like Inductive devices, generally are fixed in position and need no deployment. Others, like the BLTouch and yours need to be "deployed" to be ready to use.

                                  Any idea where can I confirm this? I'm not distrusting you, I want to re-learn it and maybe re-write the approach I am using.

                                  Oddly enough I don't see any mention of G30 calling M401 or M402 - but it does as I have verified many times.

                                  In the M558 command docs there is this:

                                  All Z probes use the same deployprobe.g and retractprobe.g files


                                  Aside to @Phaedrux: Could you check the docs to see where mention of the calling of M401 and M402 might needed to be added? Thanks.


                                  When I call homez.g, the routine is to pick up the probe via M400, probe Z in the middle of the bed, then probe the 4 corners and level the bed (basically 4-G30 commands, 3 indep motors), then re-probe Z.
                                  The switch is already attached and it does not try to re-deploy the switch.

                                  Well in your homeZ.g file you called M401 and M402 explicitly and as I mentioned before when you do that G30 doesn't call them.

                                  You could comment out M401 and M402 in your homeZ.g file and you should still see that deployprobe.g is called.

                                  Do you have a retractprobe.g file?

                                  If you want to verify for yourself what G30 does in regards to these two files you can do what I did.

                                  My deployprobe.g file had this: M291 R"DEPLOYPROBE.G" P"DEPLOYPROBE.G" T1

                                  My repractprobe.g file had this: M291 R"RETRACTPROBE.G" P"RETRACTPROBE.G" T1

                                  So whenever G30 invoked (via M401 and M402) them I could see the message popup on the DWC.


                                  So is your homeZ.g file now working?

                                  Frederick

                                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                  1 Reply Last reply Reply Quote 0
                                  • undefined
                                    sinned6915 @dc42
                                    last edited by sinned6915 2 Dec 2021, 16:33 12 Feb 2021, 16:31

                                    @dc42 can I ask you to help me take a step back and re-think this? The solution is becoming unweildly and in my experience, when things get this complex, its probably because I've overlooked something, or I have completely uderestimated it.

                                    The concept is to use a magnetically coupled microswitch as Z probe and endstop. When attached the NC swtich competes the circuit. When detached, its open. It seems simple enough to accomplish.

                                    alt text

                                    Considering @OwenD comments, does the switch attachement fall under the scope of probe deployment and retraction? The definition of deployprobe.g is just that its a macro. I read that as 'a bunch of gcode'.

                                    Previously with a fixed dock, the switch attachement was accomplished by simply swiping the carraige clockwise or anti-clockwise through a dock fixed in X,Y,Z location. gcode meta commands allowed me to check the probe value to ensure probe pickup, dropoff or malfunction.

                                    Now I am trying to translate to X,Y and then move in Z.
                                    Once at X,Y location, using a G1 H1 in deployprobe to pick up the switch works but causes issues in the subsequent G30 commands. Add to this the redefinition of the probe high or low and redefining the meta commands to interpret the probe values when switching from high or low.

                                    Using a G30 command at the proper X,Y location to couple the switch, the bed moves away from the carraige, similalry to trying to issue a move command when Z is not homed.

                                    So here I sit, realizing the mirage on the horizon is much longer walk for a small drink of water wondering if there is an oaisis that I have overlooked?

                                    undefined undefined 2 Replies Last reply 12 Feb 2021, 16:46 Reply Quote 0
                                    • undefined
                                      fcwilt @sinned6915
                                      last edited by 12 Feb 2021, 16:46

                                      @sinned6915 said in Detecting Z-Probe Pickup on move command:

                                      Using a G30 command at the proper X,Y location to couple the switch, the bed moves away from the carraige,

                                      Is the G30 command moving towards Z min or Z max?

                                      Try as I might I cannot G30 to NOT move the bed toward the gantry.

                                      Frederick

                                      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        OwenD @sinned6915
                                        last edited by 12 Feb 2021, 20:48

                                        @sinned6915 said in Detecting Z-Probe Pickup on move command:

                                        @dc42 can I ask you to help me take a step back and re-think this?
                                        <snip>

                                        Considering @OwenD comments, does the switch attachement fall under the scope of probe deployment and retraction? The definition of deployprobe.g is just that its a macro. I read that as 'a bunch of gcode'.

                                        @sinned6915
                                        My suggestion was in reference to you saying that the code was running twice.
                                        The file is indeed just a bunch of code, but it can be called implicitly by you and also internally during the execution of another GCode or process.

                                        Likewise, at the beginning of this thread I suggested that a G1 H* move should achieve what you want if configured correctly.
                                        My modification of your loop code was provided based on your findings that G1 H* didn't work for you.

                                        @dc42 stated above you can configure two probes on your tool.
                                        That would seem to me to be a good solution given you want the probe to function as both an end stop and a probe.

                                        I'll withdraw from this thread to reduce the static as the new information provided changes the way I'd go about it.

                                        1 Reply Last reply Reply Quote 1
                                        • undefined
                                          sinned6915
                                          last edited by 13 Feb 2021, 04:35

                                          @OwenD I was not calling you out on anything- in fact I am grateful that you offered a reaonable explaination to what I was seeing.

                                          I see nothing in the documentation that says issuing a G30 command to probe will execute a deployprobe. Regardless, that is exactly what appears to be happening. Curiously, After I issue the singe G30, I call on the 4 point beld probing/leveling routine. It follows in sucession without retracting the probe.

                                          I think this basically a catch22- I can not pick up the probe with a G1 H1 move command without changing the probe type and that breaks things downstream. I can not do a G30 command withing the deployprobe macro.

                                          The cleanest way seems to be to do it with the while loop withing the deploy probe macro.
                                          Again, I thank you for helping me underdstand that.

                                          undefined 1 Reply Last reply 13 Feb 2021, 07:30 Reply Quote 1
                                          45 out of 57
                                          • First post
                                            45/57
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA