From Jubilee
Jump to navigation Jump to search


  • ZTATP = Z Tool Align with Touch Plate.
Partially automated process that uses a touch plate to calculate ‘G10 Znnn’ commands that go in your config.g to correctly set the Z alignment for tool-to-tool correct behavior when printing. It also sets the bed-to-tool-zero spacing!
  • TAMV = Tool Alignment with Machine Vision.
Fully automated process that uses a camera to calculate ‘G10 Xnnn Ynnn’ commands that go in your config.g to correctly set the X Y alignment for correct tool-to-tool behavior when printing.


  • Rasberry Pi 3B or 4B, with USB attached camera (no Picam at this time).
  • Almost any webcam with auto-exposure and the ability to focus within a few centimeters of the lens will work. Logitech C270 is one that is known to have a threaded lens and a case that can be removed and replaced with a printed case.
  • A Duet printer, reachable from the Pi by network, running V2 or V3 firmware
  • May run on Duet3+Pi; does NOT require that configuration, run on any Pi.

ZTATP Differences between Duet 2 and Duet 3 Boards

Duet 2 Boards

The following applies to all Duet 2 boards, regardless of which version of RRF (2.x or 3.x) you are running. You can only use a single input for a Z-probe. ZTATP will default its probe input pin definition for the touch plate to the Z_PROBE_IN and GND pins, and these currently cannot be re-assigned to another endstop on an RRF2 board. This may be changed in a later release.

The exact definition of this probe type in RRF 2.x.x is M558 P5 I1 F200 H50

Duet 3 Boards

This applies to all Duet 3 boards, using RRF3.x. You have the flexibility to select which input channel on the board is used for the probe. ZTATP will default the probing pin input to !io5.in (notice the inverted logic). You can re-assign this input by specifying an RRF3-style input name to any other input pin you want that would be compatible. Keep in mind, however, that ZTATP uses a normally open endstop configuration (usually RRF has normally closed endstops), and the circuit will close and trigger the endstop once the nozzle tip comes into contact with the probe plate.


Software installation and setup

Follow the installation steps for TAMV here.

Hardware installation and wiring

  • ZTATP requires a conductive touch plate that is fixed to the bed that can be reached by BOTH the nozzle on each and every tool, and by the Z-Probe. This can be slightly (a few mm) above or below the actual printable surface of the bed.
  • The touch plate must be grounded, to any ground in the Duet system.
  • There are three ways to wire the nozzles:
Each nozzle has a wire, leading back to a “Y” harness that leads them all into ‘io5.in’ (or any other endstop connector, if you change the script). This is basically a parallel connection from each tool back to the probe input pin.
You can arrange any number of “spring” mechanisms that contact the nozzle just before the nozzle contacts the touch plate, similar in operation to a CNC pressure foot.
You use the Z-offset doorknob probe by TypQxQ (The tool touches a spring loaded doorknob -> a ball connected to the knob breaks connection with 3 contacts)
(default and easiest wiring method) You can have a single probe wire that you connect to each tool manually in sequence. The script will pause between tools during the probing sequence until you hit Enter to resume probing.

Runtime parameters

  • -duet xxx.xxx.xxx.xxx or -duet hostname
Default value: localhost
(optional) Used to specify the IP address or hostname of the Duet controller you're connecting to. If running ZTATP on the local Pi directly connected to a Duet 3 board, you can omit this parameter.
  • -touchplate x.xxx y.yyy
Default value: 0.0 0.0
(required) Used to specify the X and Y coordinates for location of the center of the grounded touch plate used to calibrate Z offsets
  • -pin pin_name (RRF 3.x.x only)
Default value: !io5.in
(optional) Used to specify the input pin the probe wires are connected to. Typically a normally-open definition indicated by inverting the logic of the pin using an exclamation point at the start of the name.
  • -tool tool_number
(optional) Used to specify the tool number (starting from 0, as in T0, T1, T2, etc.) if you want to run a Z-offset calibration for a single tool. Integer values only!

Running ZTATP

Pre-flight checklist

  1. Ensure that your printer's config.g has a Z probe defined using an M558 command.
  2. Ensure that your touch plate is properly connected to your controller's ground and has good electrical continuity.
  3. Check for continuity between the nozzle/tool tip and the wire connected to the probe input, for each and every tool.
  4. Every tool must be capable of mounting and parking with no collisions between tools, as per the operation of their individual tpost and tpre macros.
  5. No tools collide with the build plate when its lowered to Z=45mm.
  6. All your movement axes are homed and ready for movement. Ideally, you have trammed your build plate with G32 bed levelling.
  7. Choose the fixed coordinates for the center of your touch plate. Typically the center of your bed, or if using your build plate itself as a touch plate, then a position reachable by all tools without any collisions with other tools or the ends of your movement axes in X and Y. Write these coordinates down as you'll need to pass them as a parameter to the ZTATP script. You may, or may not, have to temporarily attach your touch plate to the build plate to prevent it from sliding around.

Run a probing sequence for all tools

1. Run ZTATP by running the command:
python ZTATP.py -duet hostname_or_IP_address -touchplate x_coordinate y_coordinate [-pin pin_name] [-tool tool_index]
2. The carriage will park any mounted tools (by invoking T-1), and it will move from its current position to the position you've defined in the touchplate parameter and Z=50.
3. Place your touch plate under the tool head such that the Z endstop is directly above its center.
4. Press Enter to start the initial probe of the touch plate.
The script will reset Z=0 to the height of the touch plate by probing it twice (one fast and one slow pass, using the probe parameters from config.g.
After a successful pass, the script lowers the bed to Z=10.
5. You'll see a prompt asking you to connect your probe wire to the first tool (useful in case you're using a single probe wire for multiple tools). Connect the probe wire to your first tool and press Enter to continue.
The script will mount the first tool, move to the touch plate coordinates, and probe the Z offset twice: the first time is a fast pass, and the second is a more accurate slow pass that will determine the offset value.
If you're running this for the first time, this is the most critical point where you may have a collision so be ready to stop your printer if needed!
If you do perform an e-stop, you'll need to reboot your Duet board (to restore endstop settings!), re-home all your axes, and restart this ZTATP procedure from the first step all over again.
Remember to remove your touch plate if you're going to home your axes!!
6. The script will park the current tool using T-1, lower the bed by 50 (relative coordinates), and prompt you to connect the probe for the next tool. Repeat step 5 and 6 until all of your tools have been run through ZTATP.
7. Once all tools have been measured, ZTATP applies the newly measured Z offsets to your running configuration by performing a set of G10 commands.
You will need to apply these new Z offsets to your config.g file, either by copying and pasting the G10 commands from the terminal at the end of your configuration file, or by modifying your M563 tool definition statements.
8. You can now remove your tool plate and probe wires, and you will need to re-home the Z axis (or all axes) before starting any new jobs on the printer.