Difference between revisions of "ZTATP"

From Jubilee
Jump to navigation Jump to search
 
(12 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
: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.
 
: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.
  
=== Requirements ===
+
= Requirements =
 
* Rasberry Pi 3B or 4B, with USB attached camera (no Picam at this time).
 
* 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.
 
* 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.
Line 15: Line 15:
 
* May run on Duet3+Pi; does NOT require that configuration, run on any Pi.
 
* May run on Duet3+Pi; does NOT require that configuration, run on any Pi.
  
== Differences between ZTATP on RRF2 and RRF3 ==
+
= ZTATP Differences between Duet 2 and Duet 3 Boards =
=== RRF 2.x.x ===
+
== 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.
 
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 <code>M558 P5 I1 F200 H50</code>
 
The exact definition of this probe type in RRF 2.x.x is <code>M558 P5 I1 F200 H50</code>
  
=== RRF 3.x.x ===
+
== 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.
 
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.
  
== Installation ==
+
= Installation =
=== Software installation and setup ===
+
== Software installation and setup ==
 
Follow the installation steps for TAMV [[TAMV|here]].
 
Follow the installation steps for TAMV [[TAMV|here]].
  
=== Hardware installation and wiring ===
+
== 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.
 
* 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.
 
* The touch plate must be grounded, to any ground in the Duet system.
* There are three ways to wire the nozzles:
+
* There are four 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.
 
: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.
 
::'''OR'''
 
::'''OR'''
 
: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 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.
 +
::'''OR'''
 +
:You use the [https://jubilee3d.com/index.php?title=Community_Mods#Z-offset_KnobProbe_.2F_Doorknob-probe Z-offset doorknob probe] by TypQxQ (The tool touches a spring loaded doorknob -> a ball connected to the knob breaks connection with 3 contacts. No extra wires going to the tools.)
 
::'''OR'''
 
::'''OR'''
 
:''(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 <code>Enter</code> to resume probing.
 
:''(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 <code>Enter</code> to resume probing.
Line 41: Line 45:
 
== Runtime parameters ==
 
== Runtime parameters ==
 
* <code>-duet ''xxx.xxx.xxx.xxx''</code> or <code>-duet ''hostname''</code>
 
* <code>-duet ''xxx.xxx.xxx.xxx''</code> or <code>-duet ''hostname''</code>
:''Default value:'' '''localhost'''
+
:''Default value:'' <code>'''localhost'''</code>
 
:''(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.
 
:''(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.
 
* <code>-touchplate ''x.xxx y.yyy''</code>
 
* <code>-touchplate ''x.xxx y.yyy''</code>
:''Default value:'' '''0.0 0.0'''
+
:''Default value:'' <code>'''0.0 0.0'''</code>
 
:''(required)'' Used to specify the X and Y coordinates for location of the center of the grounded touch plate used to calibrate Z offsets
 
:''(required)'' Used to specify the X and Y coordinates for location of the center of the grounded touch plate used to calibrate Z offsets
* <code>-pin ''pin_name''</code> '''RRF 3.x.x only'''
+
* <code>-pin ''pin_name''</code> '''(RRF 3.x.x only)'''
:''Default value:'' '''!io5.in'''
+
:''Default value:'' <code>'''!io5.in'''</code>
 
:''(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.
 
:''(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.
 
* <code>-tool ''tool_number''</code>
 
* <code>-tool ''tool_number''</code>
 
:''(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!
 
:''(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!
  
== Entering the coordinates of the touch plate ==
+
= Running ZTATP =
 
+
== Pre-flight checklist ==
Edit the following in the beginning of the script:
+
# Ensure that your printer's <code>config.g</code> has a Z probe defined using an <code>M558</code> command.
 
+
# Ensure that your touch plate is properly connected to your controller's ground and has good electrical continuity.
<pre>################################
+
# Check for continuity between the nozzle/tool tip and the wire connected to the probe input, ''for each and every tool''.
# Edit these for your printer. #
+
# Every tool must be capable of mounting and parking with no collisions between tools, as per the operation of their individual <code>tpost</code> and <code>tpre</code> macros.
################################
+
# No tools collide with the build plate when its lowered to Z=45mm.
tl = [0,1]            # List of tools to be compared
+
# All your movement axes are homed and ready for movement. Ideally, you have trammed your build plate with <code>G32</code> bed levelling.
yc = 225              # Y line that will clear parked tools when moving in X
+
# 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.
 
 
xz = 288              # X coord of tool nozzle over flat plate to probe Z. 15x15mm area recommended.
 
yz = 285              # Y coord of tool nozzle over flat plate to probe Z. 15x15mm area recommended.
 
 
 
# Note: The particular probe command we use does NOT apply probe offsets.  
 
xp = 253              # X coord of Z-Probe over flat plate to probe Z. 15x15mm area recommended.
 
yp = 340              # Y coord of Z-Probe over flat plate to probe Z. 15x15mm area recommended.</pre>
 
Note: The printer MUST define Z with a PROBE in config.g. Even if it is really an endstop switch, it is OK to define that as a probe.
 
 
 
== Running ==
 
 
 
* No VNC or graphics needed.
 
* cd to the directory where TAMV was installed. <code>./ZTATP.py</code>
 
  
Everything is automated, the ultimate output is G10 commands (containing only a Znnn) that should be placed in config.g.
+
== Run a probing sequence for all tools ==
 +
:1. Run ZTATP by running the command:
 +
::<code>python ZTATP.py -duet ''hostname_or_IP_address'' -touchplate ''x_coordinate'' ''y_coordinate'' [-pin ''pin_name''] [-tool ''tool_index'']</code>
 +
:2. The carriage will park any mounted tools (by invoking <code>T-1</code>), and it will move from its current position to the position you've defined in the <code>touchplate</code> 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 <code>Enter</code> 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 <code>config.g</code>.
 +
::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 <code>Enter</code> 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 <code>T-1</code>, 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 <code>G10</code> commands.
 +
::You will need to apply these new Z offsets to your <code>config.g</code> file, either by copying and pasting the <code>G10</code> commands from the terminal at the end of your configuration file, or by modifying your <code>M563</code> 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.

Latest revision as of 14:32, 2 July 2022

Overview

  • 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.

Requirements

  • 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.

Installation

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 four 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.
OR
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.
OR
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. No extra wires going to the tools.)
OR
(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.