ToolbarButton

How to measure tool offset using fixed tool sensor in PlanetCNC TNG software

1. Reference your machine using Homing procedure(Machine/Home):
How to set Homing procedure in PlanetCNC TNG software

2. Mount your fixed tool sensor(further in text referenced as sensor) on machine table.

3. Connect sensor to one of the inputs (Input connector) of controller.
InputWiringMk34

InputWiringMk3

4. In settings select either Sensor 1 or Sensor 2(File/Settings/Input/Sensors). It doesn’t matter which one you choose.

From drop down menu select input to which you connected your sensor.

SensorInput1

5. Activate sensor by hand and under IO tab of main display check if designated input gets properly triggered.
SensorInput1_IO

For safety reasons jog your machine (it can be in any direction) and see if machine stops when you activate sensor.

6. Jog your machine to sensor position, so that tool is right above the centre of fixed tool sensor.
For Sensor Position(File/Settings/Program Options/Sensor Position)insert X,Y motor values that can be seen under Motors tab of coordinate display.
Z value of sensor position is usually sensors height. Sensor Position(File/Settings/Program Options/Sensor Position).

7. Start Measure Tool procedure(Machine/Tool Offset/Measure Tool).
You can also use the “Tool Offset Measure Tool” button on the left toolbar:
ToolbarButton

8. When “Measure Tool” procedure is executed, default tool measure sequence will be:

Machine will ascend to safe height and move from current position to sensors XY position(the one we set in settings).

Machine will descend towards sensor with probe speed(File/Settings/Program Options/Probe Speed) and when sensor gets activated, machine will stop and ascend to safe height.
Machine will return back to XY position from which we started the “Measure Tool” procedure.

You have configured your fixed tool sensor and you should be able to use “Measure Tool” procedure.

If you would like to edit “Measure Tool” procedure to fit your needs or to have more in depth look at the tool measure procedure itself, you can do that by opening the tool measure script file.

 

 

9. You can create and access “Measure Tool” procedure script file  in two ways:

a.) In settings (File/Settings/Program Options/Scripts/Tool Offset) you can click buttons Generate and Edit. With Generate button you create default file and with Edit button you can open it and make any modifications of the script g-code

GenerateEdit

b.) When you start “Measure Tool” procedure for the first time, Machine.Tool_Offset.Measure_Tool.gcode default file will be created. Open your PlanetCNC TNG software installation folder and locate folder: “.Scripts”

Find “Machine.Tool_Offset.Measure_Tool.gcode” file and open it with text editor:

MeasureScript

 

10. Description of parameters and g-codes(in order of appearance in script g-code):

M73:
This g-code saves states of of all modal g-codes currently used by software. When Machine.Tool_Offset.Measure_Tool.gcode procedure is executed in its entirety, all states will be restored to their previous values.

#1 = # (store current x position): Stores value of current X axis position as parameter #1.
#2 = # (store current y position): Stores value of current Y axis position as parameter #2.
#3 = # (store current z position): Stores value of current Z axis position as parameter #3.

G90:
With G90 g-code we set absolute mode of motion. Prior to “Measure Tool” procedure , motion mode could be different so we used M73 to save current modal states.

G53 G0 Z#<_motorlimit_zp>:
Machine ascends to safe height.

G53 G0 X#<_sensor_x> Y#<_sensor_y>:
Machine moves to sensor XY position.

F#<_speed_probe>:
Speed at which machine descends to measure tool. Set with Probe Speed in settings(File/Settings/Program Options/Probe Speed). This value can be set directly with new F value. In such case you should delete the “#<_speed_probe>” line of code.

G38.2 Z-100000:
This g-code moves selected axis in selected direction. G38.2 g-code uses parameter X(-/+)Value,Y(-/+)Value or Z(-/+)Value which define to which coordinate value machine should move and in what direction. When probe activation occurs over the time of machine travel, machine will stop.

G43.1 Z[#<_probe_z> – #<_sensor_z>]:
When G38.2 g-code senses that sensor is activated and stops the machine, this g-code sets tool offset.

G53 G0 Z#<_motorlimit_zp>:
Machine moves in absolute coordinates to safe height.

G0 X#1 Y#2:
Rapid move to position from which we started the “Measure Tool” procedure .

o<100> if[[TOABSZ[#3] LT #<_motorlimit_zp>] AND [TOABSZ[#3] GT #<_motorlimit_zm>]]
G0 Z#3 (move to last z position)
o<100> endif

With this sub program we make sure that we are safely within Z axis motors limits when machine moves back to position from which we started the “Measure Tool” procedure .