CNC tool setter with PoKeys and Mach4

Setting tool offsets and measuring tool lengths can be quite frustrating and prone to errors when using a CNC machine. CNC tool setter with reliable probing routine can significantly reduce number of scrapped parts and enable reliable production.

What is CNC tool setter

Most hobby and semi-professional machines do not have an ATC spindle. That means that the tools can not be changed quickly and tool change require loosening the nut with the collet and change tool. The before mentioned part is still quite simple and quick, but the main problem is that now with the new tool you don’t know the length of the tool neither can the length be stored in the tool table since manually changing tools is not repeatable.

To solve that problem, the first and most commonly used option is to touch off tool manually with the help of gage block or dowel pin on the known reference surface. That is quite repeatable and easy but also time consuming as well as prone to errors.

Picture displays how to manually set tool offset with help of dowel pin and retracting the spindle away from the pin until the pin slips under the tool.

The better option is to automate that process with the CNC tool setter and reliable probing routine that automatically measures the tool lenth and apply the right offset so you can resume machining quickly after changing the tool.

Benefits of automatic tool setter

A sometimes additional operation on a CNC are avoided only because tool change is necessary and manually changing tools is time consuming. The errors can also occur with the tools that are not measured or measured incorrectly.

Tool lenth measuring automation greatly simplifies machining, saving time with a lot less manual labour and quicker production of finished parts. So cnc tool setter is the way to go with that process.

Difference between CNC tool setter and probe

In previous blog post we described mach4 probing with probe tool. Probing in that sense is used when you want to locate the part that you are about to machine. That means that you tell the machine where is the zero point in the machine xyz coordinates where the stock is located.

Tool setting with cnc tool setter is the process of measuring the length of the tool which is also important to coincide with the zero point of the stock. If tool length is not set properly the tool can dig too deep into the material and break the tool in the worst case, but if you are lucky the tool will not cut the material at all since it’s length is set too long.

How to connect CNC tool setter with PoKeys

PoKeys57CNC connected and wired CNC tool setter with

To connect the cnc tool setter device to the PoKeys, in our case the PoKeys57CNC, you first need to find a free pin that is not already used for anything else. The easiest option is to use the pin for probe, which is located on the limit switches connector. If you are already using the probe, than you have to find the other available pin, but you can not use the limit pins for probing. The probing pin must be labelled with grey box as “PIN xx” on the page 11 of PoKeys57CNC manual.

Since analog input pins are rarely used, it is recommended that you use one of the analog input pins for additional probe inputs since low pass filtering is present and you don’t have to worry about noise problems. The external 4.7kohm pull-up resistor needs to be added.

Adding a pull-up resistor on the ribbon cable can be troublesome, but with out adapter board the pull-up resistors can be soldered in seconds and cnc tool setter cables can be connected to the screw terminal easily.

After selecting the available input pin, the cnc tool setter electrical wiring must be carefully studied. The connection is not trivial, but it can be very easy. In our case, the cnc tool setter has two normally closed contacts, one for tool measuring and one for over-travel. The normally closed contacts and wiring are much more reliable since it goes into error in case of bad connection, unpluged cable or any similar problem.

We connect one cable of the tool setter to GND pin and the other one to the input pin. If we use the probe pin, the pull-up resistor is already integrated on the board, but if we use any other pin, we have to make sure that the pull-up is present otherwise we have to add an external pull-up resistor with the value of 4.7kohm ohm.

Input pin of PoKeys with internal pull up resistor with value of 10kOhm connected from pin to the 5V supply

The wiring can be checked in the PoKeys app with data logger. PoKeys app has to be opened and right device selected, then data logger tab clicked. New window will open and on the right row with the input pin the state of the pin will change when the probe is activated. The state of the pin could also be verified in Mach4 in the “Diagnostics” tab under “PoKeys plugin – PoLabs”. There are all the pins visible with the colour change when the state of the pin changes.

How to configure Mach4 for automatic cnc tool setter

It is of the utmost importance that the latest version of the Mach4 is installed along with the latest version of the PoKeys plugin. Multiple probing works only with newer versions of the software and reliability is also greater.

The setup for probing is simple, the only thing that has to be configured is input signal in Mach4 configuration under “Configure” -> “Controll…”. In the “Input signals” the Probe Mapping has to be enabled and the right pin chosen. As mentioned before, PoKeys “Pin xx” has to be selected for probing. The seleected “Device” is PoKeys_[serial number] and the input name is selected pin. To invert the pin “Active low” can be selected.

Mach4 settings for input signals for probe 0 or probe 1. There is also the probe status rectangle visible.

If you already have one probe for the xyz probing, then you can connect the cnc tool setter to the probe1 or any other probe.

That is all the configuration in Mach4. You can check the tool setter pin state in GUI, where in case of probe triggering the blue rectangle changes colour. It is always the best practice to test the reliability before serious use.

How to test and touch off tools with CNC tool setter and manual programing

The easiest way to test the probe is to first trigger the probe manually multiple times and observe the behavior of the blue square in the Mach4 GUI. If it reliably change color than wiring is most probably OK. The next step is to start testing automatic measurements.

It is recommended to start with manually writing the folowing g-code line in the MDI and then execute that line. The g-code for probing is G31 if using the probe number 0. For probe number 1 the g-code is G31.1, for probe number 2 it is G32.2 and so on.

The parameters for the g-code are Z distance that the probe or tool will travel to while waiting for the signal. The last parameter is feed rate, which can be initially set to a low value, around 20mm/min to be save. It can be later increased of course.

The g-code for probing with probe 0 to the Z value of -10mm and feed of 20mm/min is “G31 Z-10 F20”. When the line is copied into the MDI window, you can “Cycle Start MDI” to run the line. Try to safely trigger the tool setter or probe to see if the machine stops.

When manually using probing g-code, it is also possible to switch from absolute to relative coordinates with G90 (for incremental or relative positioning), then the Z value in the “G31 Z-10 F20” will be interpreted from the current position and the tool will travel 10mm in negative direction from where it is. It is very important to switch back to G91 after probing to use the absolute positioning again.

In our case the tool setter is positioned on the table of the machine. The main goal was to establish the routine that would touch off tools during machining after manual tool change. The idea is that after you changed the tool the offset would be measured and the work zero would stay where it is. That way the process is reliable and a lot of time is saved.

Automatic routine to touch off tools

In case the tool setter has fixed position on the table, the position must somehow be known to the controller. The most reliable way is to set up the homing routine in case it is not already set up. Then the position of the tool setter has to be manually measured, the easiest was is to jog the machine around and check the machine coordinates. The most important ones are X and Y coordinate since the Z will be probed.

Afterwards, for probing the tool length the following g-code can be run:

M5 (turn off spindle)
G43 H1 (tool lenth offset set to tool 1)
G53 G1 Z0 F3000 (move Z-axis to zero away from the table)
G53 G1 X-38.5 Y-13.1 F3000 (move to tool setter location in X and Y)
M49 (disable feed rate oveeride)
G53 G31.1 Z-65 F300 (probe command)
G10 L1 P1 Z#5073 (apply new tool offset from Mach4 variable #5073 – probe machine coordinate)
M48 (enable feed rate override)

The idea with the upper g-code is to use the machine home coordinate of probe to set as a tool offset so it is mandatory to run homing routine before upper g-code. When the tool length is measured the work offsets (G54, G55, etc.) can be set up afterwards and not before.

With the appropriate coordinate input, the spindle should get right above the tool setter. For your machine, right coordinates have to be applied. After the machine is in the right spot, g-code for probing can be input to measure the tool length offset.

Is automatic tool setter really neccessary?

The tool setter greatly simplifies the cnc machining process and makes it more reliable. Conventional methods of setting up tools still work and are roboust, but they are also time consuming and prone to human errors. And since the tool setter have become cheaper and more radily available there is no reason that machinists would would not use them.

Even though the setup might look complicated at first glance, it is quite quick and simple but more importantly, it pays off to invest time into learning new things as well as do some maintenance and improvements to your machine.

How to measure tool length without CNC tool setter

The convential method of setting up tools is using a dowel pin or other precision gauge. The best practice is to lower the tool more than the height of the gauge and then retract is slowly until the gauge is able to slip under the tool. That way you prevent crashing into the gauge and chipping the tool. The height of the gauge is then inserted into the Mach4 and offset is automatically calculated.

Even if you use the tool setter the option is that when you measure tool length you set the setter on the reference surface of the part and measure the tool length. That is usually used on hobby machines and the tool setter is the simple metal plate with the continuity cable connected between the tool and the setter plate.

There are surely other ways to measure tool lenths but I hope we gave you some insight into tool lenth measuring.

About

Polabs, develop and manufacture electronic products for many different areas and needs and also make some machines to make work easier, more productive, and high quality More introduction to CNC Plasma electronics and how to connect plasma voltage divider you can find in the product user manual. Below, here you can find some latest blog posts and products:

Find out more about probing:

  • 1. G10 g-code
  • 2. CNC datums G53, G54
  • 3. Mach4 programming guide

Related Posts

Mach 4 motion controller - PoKeys57 CNC
PoKeys57CNC is the next generation of PoKeys devices that was...
Read more
Raspberry Pi with relay - how to...
In this blog we will describe Raspberry Pi with relay...
Read more
PoBlocks tutorial - Pulse engine, custom PoIL...
In this PoBlocks tutorial, we will describe how PoBlocks can...
Read more
Slovenščina »