This tutorial will explain how to correctly use Work Position / Measure feature with movable sensor using PlanetCNC TNG software and PlanetCNC motion controllers.
Movable sensor is basically a switch that sends signal to motion controller corresponding input pin.
The most basic type of movable sensor is usually copper-clad laminate. Clad has soldered wire that is connected to controller sensor input, while GND signal is attached to tool via e.g. crocodile clip.
When tool touches sensors surface, controllers corresponding input is activated and software sets Work Position value to zero.
Example of movable sensor used with Mk3 controller:
Connecting movable sensor with PlanetCNC motion controller
Configuring movable sensor in PlanetCNC TNG software
In PlanetCNC TNG under File/Settings/Program Options/Measure configure input pin that you intend to use for movable sensor.
You can select between either Sensor 1 or Sensor 2 option. It doesn’t matter which one you choose.
Input pin is selected from drop down menu:
Size Z: If you use copper board as a movable sensor, then value of this parameter is the thickness of the copper board( usually 1.6mm).
Now that your sensor is connected and configured, it is best to activate sensor by hand to check if everything is functioning OK. Jog your machine (it can be in any direction) and see if machine stops when you activate sensor.
Under IO tab of main display check if input is activated correctly:
The last parameter that needs to be configured is Probe Speed. This is the speed at which Z axis will descend to measure Z axis work position.
Please note: Make sure that Probe speed is not set too high. You see, during measuring procedure, when tool touches the surface (sensor gets activated) machine stops immediately. If your probe speed is too high, inertia on Z axis will cause loss of steps of Z axis stepper motor.
Measuring work position with PlanetCNC TNG software
Work position measure procedure can be executed via menu item Machine/Work Position/Measure or using left toolbar button:
Default sequence of Work Position Measure procedure:
-Machine will start descending at current position in -Z direction using probe speed.
-When sensor is activated, machine will stop and ascend to Z height from which we started Work Position Measure procedure.
-Z axis work position value on surface of material should now be 0(zero).
Measure work position script file
Work Position Measure procedure uses script file. If you would like to edit script code or to have more in-depth look at the procedure itself, you can do that by opening script file.
You can generate, access and edit script file in two ways:
a.) In settings under File/Settings/Program Options/Scripts/Work position -> Work Position Measure click button Edit Script. Script file will open in your default text editor.
b.) When you execute Work Position Measure procedure for the first time, either via toolbar button or via Machine menu, _Work_Position.Measure.gcode default file will be created. Locate your PlanetCNC TNG software installation folder and locate script file under Profiles/Default/Scripts -> _Work_Position.Measure.gcode
Default script code:
O<PlanetCNC> if[[#<_sensor1_pin> GT 0] OR [#<_sensor2_pin> GT 0]] M70 (store state) G90 (absolute mode) G15 (cancel polar mode) #<z> = #<_machine_z> (store current z position) F#<_speed_probe> (set probe speed) G38.2 Z-100000 (touch down) G92 Z#<_sensor_sizeZ> (set Z) G53 G0 Z#<z> (move back to stored position) M72 (restore state) O<PlanetCNC> else (msgdlg,Sensor is not configured) O<PlanetCNC> endif
Description of parameters and g-codes(in order of appearance in script g-code):
Saves states of of all modal g-codes currently used by software. When Machine.Work_Position.Measure.gcode procedure is executed in its entirety, all states will be restored to their previous values.
#3 = #<_machine_z>: Stores value of current Z axis position as parameter #3.
G90: With G90 g-code we set absolute mode of motion.
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 g-code uses parameters X(-/+)value, Y(-/+)value or Z(-/+)value which define which axis should move to which position and in what direction. When probe is activated over the time of machine travel, machine will stop.
G92 Z#<_sensor_sizeZ>: Sets current work position (where probe was activated) to thickness of sensor value.
<_sensor_sizeZ> parameter is set with Site Z in settings (File/Settings/Program Options/Measure/Movable Sensor -> size Z).
G53 G0 Z#3:
Machine moves in machine coordinates to previously saved Z axis position.