Detecting Z-Probe Pickup on move command
-
while sensors.probes[0].value[0]!=1000 ; loop to check when probe value changes from 1000 to 0 G1 Z-290 F360 ; move bed with probe dock up if sensors.probes[0].value[0]=0 ; when switch is coupled the sensor value will change to 0 break ; when sensor = 0, end loop
Aside from the indentation, you've misunderstood the progression of the code.
The first "while" loop is just going to keep trying to move to Z-290 until the probe is triggered.
It will complete that move before checking again, so even if the probe triggers at -100 it'll keep going in order to complete the command.You need to use a move that halts upon activation of the probe.
G1 H3 perhaps?
It's going to depend on the structure of your printer. -
I might have stripped it out when i copied and pasted it. I pasted the whole thing in its entirety at the bottom.
@OwenD I did try to do something like that at one point- when I did try to
G1 H1 Z-300 F300
The printer 'homed' to the center of the bed where I had defined homez.g first instead of at the current X,Y point. i could not figure it out.
Does the printer geometry matter though? my current priner is a gantry style cartesian. the probe dock is in the bottom left hand corner.
I just re-read the firmware limitations, https://duet3d.dozuki.com/Wiki/Duet_3_firmware_configuration_limitations#Section_Temporary_limitations
I wonder if I am limited by either of these.-
Endstop switches and Z probes connected to the main board cannot control motors on an expansion board. This is planned to be fixed in release 3.4.
-
If you use a Z probe then the Z motors must be connected to the main board. This is planned to be fixed in release 3.4.
How/who/where do I ask if this might be the case for me? How do we approach the devs for something like this?
This is how my drives are defined- I have a later version Duet2Ethernet with an Duex2. I think that the Duex2 is like version 0.8 or 0.9. I am on DW version 3.1.1. I have 3 motors, that I refer to as Z0, Z1 & Z2. Z2 is P5, which I think would put it on the Duex. I have to rework a few motor leads to test this out.
; Drives M569 P0 S1 ; physical drive 0 goes anti-forwards X M569 P1 S1 ; physical drive 1 goes forwards Y M569 P2 S1 ; physical drive 2 goes forwards Z0 M569 P3 S1 ; physical drive 3 goes forwards E0 M569 P4 S1 ; physical drive 4 goes forwards Z1 M569 P5 S1 ; physical drive 5 goes forwards Z2 ; M569 P6 S1 ; physical drive 6 goes forwards Y M584 X0 Y1 Z2:4:5 E3 ; set drive mapping
@fcwilt I do not feel like I understand the indentation convention at all. I tried to structure it from the start putting in the if-elif-else and then indenting below each step. Could you critique me?
Based on what happened i then tried to change the prope type to NO so that when it did get picked up, the state would be NC and thus the probe be 'triggered'. that did not help.
I did try to pepper my macro with statements to display the probe state-
M409 K"sensors.probes[0].value"
so that I can get the console to report the probe value on the start and at the places in the macro that I call it at. actaullly , right now i can not remember if it was the PanelDue or the console on DWC, but its displayed. Wiith the current probe definition, the value is 1000 when the probe is physically disconnected.
M409 K"sensors.probes[0].value" if sensors.probes[0].value[0]!=1000 ; if sensor is value other than 1000 do this abort "deployprobe: Probe already picked up. Manually return probe to the dock" elif G91 M564 S0 H0 ; allow movement outside of print area and while not homed G1 Z6 F6000 ; move Z for clearance G90 ; absolute positioning G1 X0 Y-15 F6000 ; move to side of probe dock location M400 ; wait for moves to finish G1 X0 Y-29.5 ; move exactly above probe for pickup M400 ; wait for moves to finish while sensors.probes[0].value[0]=1000 ; loop to check when probe value changes from 1000 to 0 G1 Z-290 F360 ; move bed with probe dock up if sensors.probes[0].value[0]=0 ; when switch is coupled the sensor value will change to 0 break ; when sensor = 0, end loop M564 S1 ; limit axis to print area G1 Z2 F360 ; move bed to clear probe from dock G1 X55 F6000 ; move probe out of the dock G1 Z5 F360 ; move bed to clear probe from glass build surface M400 ; wait for moves to finish G90 else if sensors.probes[0].value[0]!= 0 abort "deployprobe: Probe not picked up!"
-
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
I'm not 100% sure I'm picturing your setup, but based on what I think you're trying to do try this.
if sensors.probes[0].value[0]!=1000 ; if sensor is value other than 1000 do this abort "deployprobe: Probe already picked up. Manually return probe to the dock" ;if we're here we know it's 1000 which I assume is because you have an NC switch as a probe. G91 M564 S0 H0 ; allow movement outside of print area and while not homed G1 Z6 F6000 ; move Z for clearance G90 ; absolute positioning G1 X0 Y-15 F6000 ; move to side of probe dock location M400 ; wait for moves to finish G1 X0 Y-29.5 ; move exactly above probe for pickup M400 ; wait for moves to finish while sensors.probes[0].value[0]=1000 ; loop to check when probe value changes from 1000 to 0 G1 Z-0.5 F360 ; 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! G1 Z2 F360 ; move bed to clear probe from dock G1 X55 F6000 ; move probe out of the dock G1 Z5 F360 ; move bed to clear probe from glass build surface M400 ; wait for moves to finish M564 S1 ; limit axis to print area G90 if sensors.probes[0].value[0]!= 0 abort "deployprobe: Probe not picked up! Print cancelled."
-
@OwenD thank you for your help. I see where I made the indentation mistakes. I apprciate you cleaning up my code and reposting it. I'm REALLY close now, I think a couple of tweakes will do it.
- I rewired the steppers so that all the Z motors are on the Duet board. I enede up putting X & Y on the Duex board. It gets a little fussy becasue reading the RRF FW limitations, the extruder, associated heater and thermistor that go together also have to be on the SAME board.
I will put config.g snips at the end in case someone else needs to see what I did.
- I did confirm that the probe value is 1000 when the switch is not connected; 0 when connected; and 1000 when the NC is broken.
3 . Here is a video of the probe deploy, bed leveling and probe retract. The dock is just 2-sided taped to the glass bed for now.
EDIT: https://youtu.be/bkqzr3B-ufs
If you watch the probe pickup, the green LED lights up when the pairs of magnets between the carraige and probe make contact. The LED goes off when the NC goes to open. (The magnets mechanically and electrically couple the switch to the circuit).
What I do not like is that the bed continues to move well after probe is picked up and even after the switch is triggered. I tried to slow down the feedrate on the probe pickup. I did not try reducing the step.
It quite literally crashes the prbe into the bed and the bed lifts off the pivots. If the bed was fixed, I think it would be damaged.
Any thoughts on how to stop the bed quicker?
You can see the LED reflection blink when the switch is triggered.
Here is the deployprobe.g -
if sensors.probes[0].value[0]!=1000 ; if sensor is value other than 1000 do this abort "deployprobe: Probe already picked up. Manually return probe to the dock" ; if we're here we know it's 1000 which I assume is because you have an NC switch as a probe. G91 M564 S0 H0 ; allow movement outside of print area and while not homed G1 Z10 F6000 ; move Z for clearance G90 ; absolute positioning G1 X0 Y15 F6000 ; move to side of probe dock location M400 ; wait for moves to finish G1 X0 Y0 ; move exactly above probe for pickup M400 ; wait for moves to finish while sensors.probes[0].value[0]=1000 ; loop to check when probe value changes from 1000 to 0 G1 Z-0.5 F200 ; 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! G1 Z1 F360 ; move bed to clear probe from dock M400 G1 X100 F6000 ; move right so probe moves out of the dock M400 G1 Z5 F360 ; move bed to clear probe from glass build surface M400 ; wait for moves to finish M564 S1 ; limit axis to print area G90 if sensors.probes[0].value[0]!= 0 abort "deployprobe: Probe not picked up! Print cancelled."
here is the retractprobe.g file -
; ******************************************************* ; retractprobe.g ; ******************************************************** M400 if sensors.probes[0].value[0] != 0 abort "retractprobe: Probe not currently picked up!" M564 S0 ; allow movement outside of print area G90 ; absolute positioning G1 X100 Y0 Z5 F12000 ; move to the starting point G1 X60 Y0 F12000 ; move to the entry position for the dock G1 X0 Y0 F600 ; move to the dock position G1 X0 Y20 F12000 ; move to the side adjacent to the dock M400 G1 X100 Y20 F12000 ; move to the right to clear dock G1 X145 Y0 Z10 F6000 ; move to start point at middle front M400 M564 S1 ; limit axis to print area if sensors.probes[0].value[0] != 1000 abort "retractprobe: Probe not correctly dropped off in dock!"
Here are the tweaks to my config.g file: I had to put all the Z motors on the Duet board.
; Probe Definiotns ; set Z probe type to switch and the dive height + speeds. Probe A times M558 K0 P5 C"^zprobe.in" H8 R0.5 F200 T9000 A1 S0.03 ; K0 for probe 0, P5 for NC switch, C for input pin, ; ^ for enabling the native pullup resistor on Duet2 hardware running RRF3 ; H dive height of 8mm, F300 probing speed 6mm/sec, T9000 travel speed 150mm/sec, ; A3 number of probes 1, S0.01 max tolerance of 0.01 ; **** ; Drives ; in order from left to right on the board ; 4 - 3 - 0 - 1 - 2 ; X - E0 - Z2 - Z1 - Z0 ; M569 P4 S1 ; physical drive 4 goes forwards 0 M569 P3 S1 ; physical drive 3 goes forwards E0 M569 P0 S1 ; physical drive 0 goes forwards Z2 M569 P1 S1 ; physical drive 1 goes forwards Z1 M569 P2 S1 ; physical drive 2 goes forwards Z0 ; Duex Drive Assignements ; in order from left to right on the board ; 6 - 5 ; X - Y M569 P5 S1 ; physical drive 5 goes forwards Y M569 P6 S1 ; physical drive 6 goes forwards X ; X Y Z0:Z1:Z2 E M584 X6 Y5 Z2:1:0 E3 ; set drive mapping M671 X0:290:290 Y163.5:307.5:17.5 S15 ; Z0 left screw at -88,110 pivot point 0,163.5 ; Z1 back right at 340,302 pivot point 290,307.5 ; Z2 front right at 340,-2 pivot point 290,17.5 ; max correction S is 15mm
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
- I rewired the steppers so that all the Z motors are on the Duet board. I enede up putting X & Y on the Duex board. It gets a little fussy becasue reading the RRF FW limitations, the extruder, associated heater and thermistor that go together also have to be on the SAME board.
That didn't hurt be it wasn't necessary, at least with firmware 3.1.1 and Duet 2/Duex 5 combo.
As to stopping bed movement - did you consider trying to arrange some sort of sensor that could function as a Z end stop sensor just for purposes of picking up the probe?
With G1 H1 commands movement stops when the associated end stop sensor is triggered.
Frederick
-
@fcwilt said in Detecting Z-Probe Pickup on move command:
With G1 H1 commands movement stops when the associated end stop sensor is triggered.
I did try that at one point. iirc, the carriage jumped to the position defined in the homez.g file.
What mystifies me right now is that I believe that the probe value has to go from 1000 to 0 since the circuit goes from open to closed as evidenced by the LED illuminating.
I will try G1 H1 again. Perhaps I need to try G1 H1 with a Z grater than 0 - like this?
G1 H1 Z2.0
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
I did try that at one point. iirc, the carriage jumped to the position defined in the homez.g file.
I don't know what you mean by that.
When the end stop is triggered during a G1 H1 move the firmware sets the current position for the axis in question to the min/max of that axis as defined in the M208 for that axis. It uses min or max depending on the configuration of the end stop as being at the low end (uses min) or high end (uses max).
After the G1 H1 finishes you will need to reset the Z position, using G92 Znnn, to the correct position.
If the end stop is at known Z position that would be simple but I don't fully understand how this probe change feature is implemented.
I will try G1 H1 again. Perhaps I need to try G1 H1 with a Z grater than 0 - like this?
G1 H1 Z2.0
Since G1 H1 moves are usually done in relative mode, set using a G91 command, a G1 H1 Z0 command would do exactly what is says - move 0 mm
Frederick
-
To use the G1 H1 command, the probe has to trigger. If NC as currently set up, it has to couple the probe AND the probe has to trigger for it to work. That means that the probe value will register 1000 when the circuit is open, then 0 when the probe is picked up, then has to go to 1000 again for trigger.
I tried temprarily changing the probe defiition to be NO instead. I was thinking that this way, the open probe would go closed as soon as the electrical continutiy was made and trigger the reading.
Now that I have working meta command I will try to retry that in the lines above and below the proper loop statement.
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
To use the G1 H1 command, the probe has to trigger. If NC as currently set up, it has to couple the probe AND the probe has to trigger for it to work. That means that the probe value will register 1000 when the circuit is open, then 0 when the probe is picked up, then has to go to 1000 again for trigger.
I tried temprarily changing the probe defiition to be NO instead. I was thinking that this way, the open probe would go closed as soon as the electrical continutiy was made and trigger the reading.
Now that I have working meta command I will try to retry that in the lines above and below the proper loop statement.
Now I'm really confused.
There was a while loop above trying to monitor the probe state while moving small amounts on the Z axis.
Are you still trying to do this?
Frederick
-
@sinned6915 there have been quite a bit happening on this thread. can we start from the beginning.
With the bed probe mounted on the magnets, with the bed well out of the way, when you probe the bed does manually triggering the switch work as expected?
If it does then for the pickup can you break it down into individual commands (sent from the console) and confirm they each work individually.
At the core of this is this while loop:
while sensors.probes[0].value[0]=1000 G1 Z-0.5 F200
does that work when executed separately ?
-
@T3P3Tony if i manally deploy the probe, everything works as expected.
here is old vid if it helps. https://photos.app.goo.gl/3KEhDJKUdSbfTjS2Athe switch is your garden variety SPDT microswitch. the NC - C are connnected to the magnets. when the halves couple, the circuit is complete to the controller.
i incrementally built the move commands to align the carraige over the dock. i have verified that with no probe, P=1000. When I manually couple the probes, P=0
the issue is the while loop.
the controller is not reazling the circuit is complete and the probe value goes from 1000 to 0.
if you watch the video from this point, you see the point where the probe is coupled- the LED lights up. then as the bed continues to move, the probe is trigered and the LED goes out as the switch is depressed.
https://youtu.be/bkqzr3B-ufs?t=10
i will make a macro of just the loop and post results in a moment
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
the issue is the while loop.
the controller is not reazling the circuit is complete and the probe value goes from 1000 to 0.
Does this switch change state at the correct location for stopping movement?
If so did you consider my comments about using the switch as a temporary Z endstop which would stop a G1 H1 move when the switch triggered?
Thanks.
Frederick
-
the statement by itself does does not work.
i made a macro to execute it -
homes X & Y axis. I even gave it an M564 S0 H0
I also tried to manually issue G1 Z-100 H1 but did not get anthing.
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
I also tried to manually issue G1 Z-100 H1 but did not get anthing.
A G1 H1 Znnn move will only work if that switch is configured as a Z endstop.
Recall that a G1 H1 stops when an endstop associated with the same axis is triggered. If not endstop is triggered it stops moving when it has moved the specified distance.
For example, this will move until a Z endstop is triggered or Z has moved 50mm.
G91 G1 H1 Z-50
Frederick
-
@fcwilt paneldue doe not refresh fast enough to reflect the moment when the probe halves couple. i can not tell what the controller sees.
i am trusting the LED illumination as a failsafe indicator. the LED is mounted to the top half. it uses the same ground as the probe. so when the probe circuit is completed, the LED will light up.
when the NC is broken, the LED goes out.
my config lines for the probe as endstop:
M574 Z1 S2 ; configure Z-probe endstop for low end on Z .... M558 K0 P5 C"^zprobe.in" H8 R0.5 F200 T9000 A1 S0.03
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
@fcwilt paneldue doe not refresh fast enough to reflect the moment when the probe halves couple. i can not tell what the controller sees.
i am trusting the LED illumination as a failsafe indicator. the LED is mounted to the top half. it uses the same ground as the probe. so when the probe circuit is completed, the LED will light up.
when the NC is broken, the LED goes out. .
So if movement stopped with the LED comes on it will be OK?
Frederick
-
@fcwilt EXACTLY!
probe not attached P=1000
probe attached, P=0 -
@sinned6915 said in Detecting Z-Probe Pickup on move command:
@fcwilt EXACTLY!
probe not attached P=1000
probe attached, P=0So this switch is currently configured as a Z probe?
Frederick
-
@fcwilt yes, that is what i attempted with my M558 command. syntax and comments below
M558 K0 P5 C"^zprobe.in" H8 R0.5 F200 T9000 A1 S0.03 ; K0 for probe 0, P5 for NC switch, C for input pin, ; ^ for enabling the native pullup resistor on Duet2 hardware running RRF3 ; H dive height of 8mm, F300 probing speed 6mm/sec, T9000 travel speed 150mm/sec, ; A3 number of probes 1, S0.01 max tolerance of 0.01
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
@fcwilt yes, that is what i attempted with my M558 command=
Just for your information you should be able swap the values returned by the probe, open versus closed, by adding a ! character to the beginning of the pin name.
Some folks home Z using Z endstop switches (I'm one of them). Some home Z using a Z probe.
When homing with endstop switches you use a G1 H1 command.
When homing with a Z probe you use a G30 command.
The important thing to note is that in both cases movements stops when the endstop switch or the Z probe is activated.
When homing using a G1 H1 command you have control over the direction of the move. So you can move toward an endstop switch at Z min or one at Z max.
When homing with a G30 command I think the direction is always going to be toward Z min.
So have you considered configuring this switch NOT as a Z probe but as a Z endstop switch and trying to use a G1 H1 command?
Frederick