Expected input to z_probe_in and getting status?

  • I have a circuit hooked up to z_probe_in which is supplying short (~10ms) bursts of 2.7-2.8 volts when a piezo detects movement. So far, just by hitting the bed and sending M119 (attempting to be simultaneous), I haven't been able to prove this is working (meaning, z probe always reports "not stopped"). A piezo can't make a continuous signal like holding a normal endstop switch closed, so testing is proving frustrating.

    Is this voltage adequate, is there a minimum time for a signal to be considered "on," and is there a better way I can test this (e.g., is there some command that will allow z probe status to be pushed to the console automatically when it changes)?

  • Making these changes to config.g helps – I can now get it to sometimes show the endstop is hit:

    M558 P5 X0 Y0 Z0 ; Z probe is an IR probe and is not used for homing any axes
    G31 X0 Y0 Z0 P50 ; Set the zprobe height and threshold (P500 was default)

    What does P50 in the second line actually mean? Is that milliseconds, some relative value from 0 to 254, or what?

  • My understanding when used with digital probe mode it's a debounce, that is a mechanism to smooth out a switch which might make several connects and disconnects when pressed, to give a nice sharp digital change in state. So it's the debounce time in milliseconds.

    I'm using it with Piezo hotend probe to reduce false triggers. I've got mine set to 1ms.

  • Doesn't setting it to 1ms effectively remove the debounce function? The signals I am seeing from the piezos have a period of about 10ms.

  • administrators

    It's not debounce time in ms but it does define the debounce time, with lower values triggering faster. From memory, I think a value of 100 or lower should give zero debounce.

  • Thanks dc42. Is it possible to provide a formula or table that translates the setting to a ms delay?

    Given the length of the signals I see coming from the piezos (~10ms signal, gap, and then sometimes another 10ms bounce – so the whole process is generally over in less than 50ms), and the fact that I would say it's impossible for the bed leveling procedure to hit the bed, raise, move, and hit the bed in another spot, in less than a few hundred milliseconds, setting the G31 P value to something that means, say 100ms, would seem to be a safe, effective, choice.

  • administrators

    The G31 P value is intended to set the threshold for analog sensors. The fact that it can be used to debounce noisy digital Z probe inputs is a by-product of the filtering that is applied. A Z probe reading is taken every 2ms and that is passed into an averaging filter. The filer takes the average of the last 8 readings. For an analog Z probe, the reading is whatever the probe returns. For a digital Z probe, it is 1000 when the probe output is active and 0 when it isn't.

    The upshot of this is:

    • Events shorter than 2ms in duration may not be seen
    • If you use a digital sensor and you set the G31 P parameter to 125 or less, then a single active reading from the probe is sufficient to cause a trigger
    • If you set the threshold between 126 and 250 then you need two readings out of the last 8 to be active to cause a trigger

    The 2ms interval between readings is a hangover from the old code that used the Arduino core, and I'll probably change it to 1ms before the 1.18 release.

    HTH David


Looks like your connection to Duet3D was lost, please wait while we try to reconnect.