Detecting Z-Probe Pickup on move command
-
@T3P3Tony here is a video of trying to execute the loop meta command.
https://photos.app.goo.gl/DYYfcTEyFbJhUGGw5when i first tryed to run it, it complained that G0/G1 axis not sufficiently homed so I overrode it with M564 S0 H0.
then the bed moved and stopped. at that point the system appeared to be un-responsive. when I hit the STOP button PanelDue, I got a couple of error messages.probe type- this is one thing that confused me.
https://duet3d.dozuki.com/Wiki/Connecting_a_Z_probe#Section_Mode_Num_5but there was something that I thought I read that was RRF3 specific that said it was not case and I had to use Mode 4 instead if I wanted NO and it had to be on E0 endstop circuit. I can not find it now, but I am trying to remember if it was RRF3 or Duet3 specific.
@fcwilt I think you might be right abtou G1 vs. G30 . I think that to meake it work though, I need to redefine the probe to be active LOW so that it beleives its 'triggered' when the circuit comepletes.
-
try a loop with just an echo of the switch state and see if it reports the state change as you expect when you manually trigger it
-
@T3P3Tony said in Detecting Z-Probe Pickup on move command:
so i have tested the logic using this macro:
are you running that macro from the console on DWC or via terminal and USB cable?
is RRF reporting back the iteration values line by line as it runs?
I am trying to understand the differnce between the echo statement you posted and what I was using previously -
M409 K"sensors.probes[0].value"
-
@sinned6915 I am running it as a macro from within DWC (i.e. it is saved in a macro file not entered into the console line by line)
There is a limitation on how DWC report macro outputs when using DSF on SBC so the output of the macro is not reported until it completes, but you can see the Z axis raising by 0.01 each time it loops
-
@T3P3Tony should it matter that I am on Duet2 Ethernet?
-
@T3P3Tony I had to increase the iterations to be able to catch it. i did not think to chage the feedrate, only the iterations.
I had to issue a M564 command to overide movement before home, it gave me an error message otherwise.
while sensors.probes[0].value[0]=1000 G91 G1 Z0.01 G90 echo sensors.probes[0].value[0] echo iterations if iterations=100 break
i manually deployed the probe. once the probe snapped into place, the bed stopped moving.
The console showed 41 iterations the system reported a probe value of 500, where before it was consistently 1000.now i am trying to reconcile how this might be different than the original -
while sensors.probes[0].value[0]=1000 G1 Z-0.5 F360
is it the break command at the end? I read the break to apply to the if iterations statement.
EDIT: I am wondering if changing to probe type 8 might be better being unfiltered.
-
@sinned6915 the break is only called if the if statement evaluates to true. If you only got to 41 iterations 41 then the while loop evaluated to false and ended before the if statement evaluated to true.
Using M564 makes sense if you have your bed unable to move below 0.
The 500 report for value, if only for a brief moment could just be the probe moving between the two levels.
Either probe type 5 or 8 should work in this case. 5 might be slightly slower to respond but i don't think that is the root cause of the issue. Also no it does not matter that you are on Duet 2.
Try much smaller movements. Don't forget that the move you send will complete, maybe 0.5mm is too much.
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
@fcwilt I think you might be right abtou G1 vs. G30 . I think that to meake it work though, I need to redefine the probe to be active LOW so that it beleives its 'triggered' when the circuit comepletes.
So you are determined to make it work using the switch as a probe and doing a while loop?
Frederick
-
@sinned6915, if you want to use a G1 command in a while loop with a test to stop movement, you will need to use M400 after the G1 command. Otherwise the G1 commands will be put in the move queue and will not happen instantly. That is why movement continues after the switch is triggered.
Alternatives are to configure the switch as an endstop switch and then use a G1 H1 move; or configure the switch as a Z probe and use a G30 move.
-
@dc42 said in Detecting Z-Probe Pickup on move command:
Alternatives are to configure the switch as an endstop switch and then use a G1 H1 move; or configure the switch as a Z probe and use a G30 move.
Bless you, good sir. Bless you.
Frederick
-
@dc42- the many movements filling the que and then clearing it out makes sense.
i think i discovered that by accident earlier too. with really small small steps, like Z=-0.01 it will move and 'softly' pickup the probe and stop.
when I change to a valuue of Z-0.1 i would still overrun it. Then i threw in an M400 and the behavior really changed.@fcwilt I have been struggling the z-endstop logic all afternoon. as i have tried to show you, I already HAVE the switch set as both endstop and as probe, and I tried using the G1 and G31 commands before I got to this point. I have not doubted you, I just have not ben able to make it work. don't take it peronsally.
M574 Z1 S2 ; configure Z-probe endstop for low end on Z
and
M558 K0 P5 C"^zprobe.in" H8 R0.5 F200 T9000 A1 S0.03
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.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M558_in_RepRapFirmware_Num_3
is where the RRF3 specific stuff was hidden at.
neither method is foolproof. as an engineer my brain is thinking not 'if this bad thing happens' but more 'WHEN this bad thing happens', which will cause the least amount of carnage.
-
@sinned6915 said in Detecting Z-Probe Pickup on move command:
@fcwilt I have been struggling the z-endstop logic all afternoon. as i have tried to show you, I alrady HAVE the switch set as both endstop and as probe, and I tried using the G1 and G31 commands before I got to this point. I am have not doubted you, I just have not ben able to make it work. don't take it peronsally.
I cannot find the configuration commands that set the switch to be an Z endstop.
Can you guide me to them?
Thanks.
Frederick
-
@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
-
@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: !CEDIT: 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.
-
@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
-
@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?
-
@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)
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.
Here are the details if you want to dive in -
https://github.com/nionio6915/Euclid_Probe -
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
-
@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
-
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.
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-
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