What do I plug in to get xyz probe working?

  • I have a Duet 3 with firmware 3.1.1

    I have a woodworking cnc machine and would like to set up a XYZ probe to set the 0,0,0 for my work. I have the aluminium block tool to use as the reference and it works fine if I set it up as a Z endstop. However I want it to sense X and Y as well and have seen lots of code examples that I could put into a macro for doing this. I have separate end stops for X and Y.

    My question is, how do I tell the software which pin to use for the macro? Apologies if it has been asked before but I have spent hours searching. Or more simply, what do I plug in where on the board to get XYZ cnc probe working?

    At present I am using Io01 for the Z endstop.
    The macro I list below is for the Workbee which I understand uses Duet.

    ;This Macro is to be used with an active low touch probe. It DOES Require adjustment for different endmill sizes. It DOES require adjustments for different probe sizes. Please see comments below.

    M291 P"Make sure the probe is connected and is in position." R"Warning" S3
    G1 Z-0.5 F500
    M585 Z50 E2 L0 F500 S1
    G10 P1 X0 Y0 Z0
    G10 P2 L20 Z5 ;Please adjust the Z value here to match z offset of your probe.
    G1 Z3 F500
    G1 X-50 F500
    G1 Z-5.5 F500
    M585 X50 E2 L0 F500 S0
    G10 P1 X0 Y0 Z0
    G10 P2 L20 X-11.0575 ;Please adjust the X value to match the X offset of your probe + the radius of the your endmill. Make it negative.
    G1 X-3 F500
    G1 Z5.5 F500
    G1 X50 F500
    G1 Y-50 F500
    G1 Z-5.5 F500
    M585 Y50 E2 L0 F500 S0
    G10 P1 X0 Y0 Z0
    G10 P2 L20 Y-12.6675 ;Please adjust the Y value to match the X offset of your probe + the radius of the your endmill. Make it negative.
    G1 Y-3 F500
    G1 Z8 F500
    G1 X0 Y0 F500
    M291 P"Probe complete. Please remove probe." R"Success" S1

  • Moderator

    Post your config.g as well. You'll need to plug the probes into some io in pins, and then use M950 commands to define those pins, and then setup the endstops as a probe in M574.

    Does that make sense?

    As for how the macros to use them for the CNC will look, I'm not sure.

  • Just the one probe as per pic attached. Works fine as a 20200725_092654 (1).jpg Z stop connected to Io_1
    This is my config file:
    ; Configuration file for Duet 3 (firmware version 3)
    ; executed by the firmware on start-up
    ; generated by RepRapFirmware Configuration Tool v3.1.4 on Thu Jul 23 2020 15:25:20 GMT+0100 (British Summer Time)

    ; General preferences
    M453 ;Put in CNC mode
    G90 ; send absolute coordinates...
    M83 ; ...but relative extruder moves
    M550 P"Duet 3" ; set printer name

    ; Drives
    M569 P0.0 S1 ; physical drive 0.0 goes forwards
    M569 P0.1 S1 ; physical drive 0.1 goes forwards
    M569 P0.2 S0 ; physical drive 0.2 goes backwards
    M569 P0.3 S1 ; physical drive 0.3 goes forwards
    M584 X0.0 Y0.1 Z0.2 E0.3 ; set drive mapping
    M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
    M92 X80.00 Y80.00 Z800.00 E420.00 ; set steps per mm
    M566 X900.00 Y900.00 Z12.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
    M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set maximum speeds (mm/min)
    M201 X500.00 Y500.00 Z35.00 E250.00 ; set accelerations (mm/s^2)
    M906 X2000 Y2000 Z800 E800 I30 ; set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X0 Y0 Z0 S1 ; set axis minima
    M208 X600 Y300 Z80 S0 ; set axis maxima

    ; Endstops
    M574 X1 S1 P"io3.in" ; configure active-high endstop for low end on X via pin
    M574 Y1 S1 P"io4.in" ; configure active-high endstop for low end on Y via pin
    M574 Z2 S1 P"!io1.in"

    ; Z-Probe
    M558 P0 H0 F120 T4800 ; disable Z probe but set dive height, probe speed and travel speed
    M557 X15:215 Y15:195 S20 ; define mesh grid

    ; Heaters
    M308 S0 P"temp0" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp0
    M950 H0 C"out0" T0 ; create bed heater output on out0 and map it to sensor 0
    M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit
    M140 H0 ; map heated bed to heater 0
    M143 H0 S120 ; set temperature limit for heater 0 to 120C
    M308 S1 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin temp1
    M950 H1 C"out1" T1 ; create nozzle heater output on out1 and map it to sensor 1
    M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit

    ; Fans
    M950 F0 C"out4" Q500 ; create fan 0 on pin out4 and set its frequency
    M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off
    M950 F1 C"out5" Q500 ; create fan 1 on pin out5 and set its frequency
    M106 P1 S1 H1 T45 ; set fan 1 value. Thermostatic control is turned on

    ; Tools
    M563 P0 D0 H1 F0 ; define tool 0
    G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
    G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C

    ; Custom settings are not defined

    ; Miscellaneous
    M575 P1 S1 B57600 ; enable support for PanelDue
    M564 H0 ;Cancel requirement to home axes

  • @chrishornby .. and this is the error I get when probing which is why I need to define the tool pin I guess:

    7/25/2020, 9:56:28 AM M98 P"0:/macros/probe xyz"
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    7/25/2020, 9:54:59 AM M98 P"0:/macros/probe xyz"
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    Error: M585: No tool selected!
    Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 1
    7/25/2020, 9:54:54 AM Error: Temperature reading fault on heater 1: sensor open circuit
    7/25/2020, 9:54:01 AM Upload of probe xyz successful after 0s

  • @chrishornby you can say T0 to select the tool, eg at the end of config or at the beginning of your macro.

    And your macro says T1, but you have no tool 1. So you have to remove that.

  • @JoergS5 Please can you tell me how to define tool 0?
    Say I want to plug my probe into Io_1 on the board. What do I actually add to the macro to make the board understand to read the state of that port? Forgive me but I am new to this and I am not a programmer.

  • @chrishornby Tool 0 was defined in the config :
    ; Tools
    M563 P0 D0 H1 F0 ; define tool 0
    G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
    G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C
    so you say T0 somewhere to use the tool. The macro uses T1 and then T0, but you have only tool 0 defined, so the macro doesn't know T1 (T1 = select tool 1).

    If you want to use a separate probe for probing, you should define this tool as second tool
    P1in config and use the macro as intended where T1 starts. So the definition for the probe which pin is used and offsets is done in config. In the macro, only the T1 is used then with this definition.

    To help you setup the tool probe, I need to know some details about it: is it at the same position like the router and you exchange it with the router after probing or is it a separate tool with a known fixed offset to the router?

  • Hi The tool is placed at the point on your work that you wish to record as position 0,0,0. This is so you don't have to program an offset from the home position and maybe miss your piece of wood entirely. After you have probed, the CNC machine has a new home position and you remove the tool (crocodile clip attached to the bit) and replace it with the router. (Actually the router was there all along as it forms part of the XYZ sensor by completing the circuit and pulling the polarity of the pin down to 0v)

  • I have defined a T1 like
    M563 P1 D0 H1 F0 ; define tool 1

    The probe sets off looking for something
    ...but still don't know how to trigger it. Where to plug in the switch and how to tell the software! Sorry if this sounds dense.

  • @chrishornby if you have defined Tool 1, then you can use it by T1 and then moving with G1 commands etc. The macro has this part, starting at the T1 line, all following commands use the T1, until the T0 line comes, which switches to Tool 0. If tool 1 (probe) and tool 0 are in the same place, there must be some pause to exchange the probe with the router.

  • Sorry perhaps I am not making it clear. I have a DUET 3 and there are lots of I/O ports. I just need to know which one to use and how to tell the routine to use that port as a trigger.

  • For example, the documentation says "The Duet 2(WiFi and Ethernet) and Duet 0.8.5 provide a dedicated 4-pin connector for connecting a Z probe"
    It does not mention the Duet 3
    ..Or maybe I just cant find it! I don't know how to define connectors, unless I have a specific example like for end stops.

  • @chrishornby Now I understand what you want (I hope!!)

    First the Duet 3 is very flexible which pins you use. You can use io0 to io8, the in direction together with ground. You just have to define it in configure. The pinnames for Duet 3 are named in https://duet3d.dozuki.com/Wiki/RepRapFirmware_3_overview#Section_Pin_names_for_Duet_Num_3

    The probelm is that your macro uses tool 1 for probing, but defining a Tool 1 would mean you need a second set of endstops for XYZ. I don't think this is possible. A bit crude solution is to combine the normal X endstop with the X trigger of the probe (some eletronic circuit: like an NO endstop and the probe trigger parallel, so if one triggers, the endstop detection triggers). The alternative to use your probe as probe: I only know it to use it as Z probe, so this is also no solution. I'll search whether I can find something.

    The thread https://forum.duet3d.com/topic/12721/cnc-probing-in-xy-plane could help setting XY probing with M585.

  • That is kind of complicated for me. If I connect it up as a Z endstop then it triggers. Which I suppose I can live with. Its just that I have seen loads of Utube videos showing the probe sensing all three axes using the gizmo I have pictured. Now all I need to know is how to configure a Z offset for the depth of the device (which is a nominal 10mm but actually 9.82mm)

  • @chrishornby the probe you're using behaves like a normal switch (contact => on). So you could use your probe wiring as Z endstop for the
    M574 Z2 S1 P"!io1.in"
    And make a simple Z homing.
    The tip of the router is then Z=0.
    But you will damage the bed or workpiece, so do it carefully.

    You could use the other endstops the same way at the workpiece, so you can calibrate the workpiece position.

  • I guess I am asking the wrong questions. I could use another macro with G38.2 which seems the way to go, but the original question still arises. How do I tell it to use one of the pins IO_0 through 8? Just a basic programming thing...
    When I define an endstop I use M574 Z2 S1 P"!io1.in"
    There you are the config.g file says use io1.in

    I just don't know how to tell the board to use one of the many IO pins to do what I want. Before I activate the macro I need to tell it which connector to use. This is the original question I asked. The macro assumes that it knows which connector to use. It doesn't. How do I tell it?

    Guess I am back to simple Z probe then...

  • @chrishornby The macro says T1 at one line and T0 at another line.

    From the line T1 on the next lines, the macro uses the Tool 1 and it's config setting. So all commands use the pins defined and the offsets in config for Tool 1.

    So the pin configuration, XY offsets, temparatures etc. are all defined in config for the endstop, probes and tools, so they need not to be newly defined in the macro, homeing etc. files.

    Example: if you move X until the X endstop is triggered, the config has previously defined at which pin the Duet must look and which status is open or close and wheter it's the high or low endstop. If it's the low endstop eg, it can set X=0 for the M208 value of X min (for G1 H1 and if M208 X min is 0). The M208 is defined in config again.

    There are some specialities in G-Code, however:
    e.g. if you look into the definition of G1 https://duet3d.dozuki.com/Wiki/Gcode#Section_G0_G1_Move there are specific parameters like H0 to H3 which activate or ignore the endstops and whether movement stops at the endstop.

  • Oh thanks, now we are getting somewhere. Just to be clear.
    If I define an endstop. with a connection setting in config.g, then that definition will be used regardless even in a different tool?
    Also I need to tell it to respond to endstops at all times, not just homing? (In G1).
    If I define a specific pin for Z axis end stop, that will be also used for the probe?

  • @chrishornby yes, the endstops are active for all tools. The tools have XYZ offsets, so they can be at different positions. But corrected by this offest, they are all be defined by the same endstops.

    The homing defines where the XYZ movement is at the XYZ endstop (high or low). The printer defines this as the end of the possible movement for most commands. If you try to move behind the endstop, you'll get an error message and the movement is canceled. There are a few commands to ignore the endstops (with the danger to create a crash), but the "normal" movement commands like G0 and G1 behave so.

    If you define the Z axis endstop, you can use it to define Z=0. You can use the router as your probe, so you don't need to change from probe to router. This may not be possible because some routers have a peak, this will be in the way, so you may need to define it as tool and change the Z value of the tool properties. The probe is mainly used if you make mash compensation, ie probing multiple points on the bed to correct the 3D print, so the first layer's adhesive is best (unevenness of bed is corrected). This is not needed in CNC IMHO.

  • Thanks, slowly getting there. Guess I need to understand the G codes and it is a steep learning curve.

  • @chrishornby this is true. If you want to learn, a good method is to follow the threads and the solutions of config problems.

  • Looks like I have it, I need to add the HI to any G1 command that is looking for an end stop command to make it trigger.
    Like G1 H1 X50

    Is that right?

  • @chrishornby Yes, H1 sets to the M208 limit. I would make X much bigger, because it will be stopped at the endstop anyway and you don't know where you start. Make X bigger than the maximal possible movement.
    In most cases there is one fast G1 H1 to the endstop (F high value), than a bit back G1 without H, than second G1 H1 movement slowly for higher precision. Just check some examples in the documentation of printer types.

  • OK thanks got it
    Could you tell me what the parameters in this command refer to:
    M585 Z50 E2 L0 F500 S1

    According to the wiki
    Parameter must be only one of

  • @chrishornby M585 is for getting the tool's offset by moving against the endstop. You can only run and get value for one axis with a M585, but you can run it three times with the different axes. M585 was the preferred method of the thread I mentioned above.

Log in to reply