[Home]MillSetup

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 5
Some Notes on Limits, Home, Work Offsets, Tool Length Offsets, and Touch Off in EMC2.2

2/4/09 by Dale Grover

(Based on EMC2.2.8 circa February 2009, with the Axis interface)

The absolute x, y, and z positions that EMC2 moves to depend on a number of related concepts and settings. These notes attempt to describe the relationships and usage of machine limits, home position, work offsets, tool length offsets, and touch off in EMC2.2 for the CNC newbie.

1. Setting the Home location. The machine-specific .ini file (often created by using "EMC2 Stepconf Wizard") describes the travel of each axis as well as the position associated with each extreme. For example, the ranges for an Emco F1 CNC mill with x, y, z travels of 200, 100, and 200 mm respectively (about 7.87", 3.94", and 7.87") could be set up as follows:

x: 0" to 7.8"

y: 0" to 3.9"

z: -7.8" to 0"

This would place the (x,y) origin in the lower left corner (looking from above), and the 0 for the z at the upper limit of travel. Other arrangements are possible; for example, z can range from 0 to 7.8". However, (0,0,0) would likely NOT be a safe location for tool changes, etc., and may lead to more accidents than a -7.8 to 0" range.

If home switches are installed, the "Home All" button will automatically move the machine to the home position (specified in the .ini file, this need not be at 0), assumimg Stepconf was run with the proper entries.

However, if there are no home switches, homing must be done manually by carefully moving each axis to its desired home position (be careful not to jog too far or you could damage the machine) and pressing the "Home" button. You will need to repeat this separately for each axis, but need not leave an axis at its home position. (That is, treat each axis as independent.)

Note that you could use "Home" to set the machine's origin with respect to your material to be milled. This might sound useful, but 1) EMC2 won't know your actual machine limits and may therefore be unnecessarily constrained in movement and/or unable to protect the machine from overtravel, and 2) there is a much nicer method using "work offsets" (described below). Don't do it.

You must home the axes each time you run EMC2 unless you have set the machine to the home position before exiting EMC2. EMC2 powers up assuming the axes are at the home position. (See later for procedure for sending the machine to home manually via "MDI" before shutting down.)

Thought once homed, EMC2 knows the absolute position of the axes (via manual or automatic homing, or by the default of assuming the power up position is home), there are two more pieces of knowledge that EMC2 can apply to make your life easier. The first is "work offsets," and the second is "tool length offsets." Everyone will eventually use the work offsets, and tool length offsets will make any but the most simple CNC operation much more efficient.

Work Offsets

EMC2 keeps track of the absolute movement of the machine elements, but your G-code generally assumes an origin with respect to the part to be machined. Work Offsets are the connection between the coordinate system centered on the work and the absolute coordinate system of the machine.

For example, assume a block to be milled is installed in a vise on the mill table. The G-code for the part assumes the lower left corner of the material is (0,0), and the face of the part will be z=0. It is likely physically impossible to install the vise such that work coordinate system will match the machine's system. Instead, offsets are added to each axis.

There are 9 coordinate systems supporting these offsets. (For a more thurough description of coordinate systems, click [here].)

Coordinate system G-Code to select Coordinate system G-Code to modify coordinate system offset
1 G54 G10 L2 P1
2 G55 G10 L2 P2
3 G56 G10 L2 P3
4 G57 G10 L2 P4
5 G58 G10 L2 P5
6 G59 G10 L2 P6
7 G59.1 G10 L2 P7
8 G59.2 G10 L2 P8
9 G59.3 G10 L2 P9

Each coordinate system stores the offsets for all of the axes (e.g., x,y,z for a 3-axis mill). You set the offset by using G-code ("G10 L2 Px ...", as described [here]) or manually using the "Touch Off" button. To set the coordinates using G-code requires knowing the offset from the machine coordinates to your desired work coordinates-possible, but usually not the case, at least with any accuracy or ease. Instead, an edge finder or other tool is installed in the spindle and the mill is manually jogged to the desired work coordinate system origin. (Again, as in homing, you can do each axis independently, and you need not leave each axis "homed" as you home the others.) Then you select the "Touch Off" button. You'll be asked what work coordinate system (P1..P9) to update. Unless you have a specific reason to do otherwise, select P1, the first coordinate system. Repeat for each axis, manually jogging and selecting "Touch Off."

Note that the G-code interpreter ALWAYS uses one of the work coordinates (unless you have a G53 on the line-that overrides the work offset and the tool length offset). If all the offsets are zero, there's no difference between the work coordinate system and the machine coordinates. However, the offsets are preserved between sessions, so when you turn on EMC2, it remembers the offsets. It also remembers which offset to use (the default is P1).

If your job requires only one tool, you are set. Here's what you'd do:

1. In your G-code, include the following:

g17 (xy plane)(g17:xy; g18:xz; g19 yz)

g20 (inch units)(g20:inch; g21:mm)

g40 (cancel cutter radius compensation)

g49 (cancel tool length offset)

g54 (coordinate system 1)(g54,g55,g56,g57,g58,g59,g59.1,g59.2,g59.3

are systems 1..9)

g80 (cancel motion mode)

g90 (absolute distance mode)

g94 (feed/minute mode)

g97 (spindle speed is rpm, vs constant surface speed)

m9 (all coolant off)

m5 (spindle off) (program should turn on with m3 and s<spindle speed>)

Not all of these are required-they just reset various modes that may have been leftover from previous runs. The critical line with respect to work offsets is G54.

2. Also in your G-code, use coordinates with respect to some identifiable location on or near the material prior to machining-you'll want to be able to set the work coordinate offset somehow, and having the reference point be inside the material may make that difficult to do with precision.

3. Home the machine by moving each axis to the machine home position and selecting "Home." Repeat for each axis.

4. Put the desired tool in the spindle.

5. Move the tool tip to the work coordinate origin, selecting each axis in turn and selecting "Touch Off." This establishes the work coordinate offsets. (When asked, use coordinate system P1 G54, which is the default.)

6. Mill away.

Tool Length Offsets

For many jobs, you will need to use more than one cutter. At some point in the G-code, you'll want to stop cutting, go to a safe tool changing position, alert the operator to change the tool, and then start cutting with a new tool. (Note that some machine support automatic tool changing.)

If the new tool/holder is exactly the same length as the old tool/holder (with respect to the spindle), then there are no problems. The tool change might look like this (for manual tool changing):

g53 g0 z0 (go to z=0 in absolute machine coordinates)

(you might want a g53 g0 x... y... too if x and y are important to your tool changing)

t3 (we'll be using tool number 3)

m6 (actually change tool)

(Don't forget to change spindle speed or feed.)

However, it's unlikely that a 1/16" ball-end endmill will be the same length as a 1/2" endmill. One efficient solution to this problem is the use of a tool table and tool length offset. Essentially, you tell EMC2 what tool you are using at any given moment, and EMC2 compensates for the length after consulting a tool table that you provide. For milling, it adds (or subtracts) the tool length to the coordinates. The absolute Z position is then:

Z(machine) = Z(desired position) + Z(work offset) + Z(tool length offset)

That is, the absolute position of an axis is the sum of the position given by the G-code (e.g., "g0 z3.2"), the work offset system selected (e.g., "G54" for the first), and the tool length offset (given in the tool table, the particular entry given by g43 h... command).

In practice, there are several ways of setting up the tool table. You could measure the tool lengths with the tools off of the machine, but for small mills the easiest way is probably as follows:

1. Set up the tool table.

Pick a reference tool. A sharp-pointed wiggler works great. It can be shorter, longer, or in between the lengths of the other tools. Install it in one tool holder (ideally, you'll leave it installed there for future reference). Install your other tools in their own holders.

Pick some reference surface like the top of a 1-2-3 block. It needs to be something you can slide on the table (the vise won't work well), but accurate. Set the tool to match this height by first moving the block from under the tool, jogging down, then attempting to slide the block under the tool. Using the incremental jogging (change the drop down menu for jogging from "continous" to ".005" and then ".001" as you get closer), move the tool up or down and then slide the block under the tool until you find the location where the tool is just not touching the block. Don't jog with the block underneath-you could accidently drive the tool into the block.

Once you have found the height of the reference tool, select "Touch Off" (and P1 G54). This resets the value for z displayed in EMC2.

Now raise the spindle and replace the reference tool with a new tool. Find the height of this tool (with respect to the reference tool) using the same jogging and testing method as above. But do NOT select "Touch Off," since we want to measure all of the new tools against the reference tool. Just record the displayed z value. If the new tools are shorter than the reference tool, you'll be recording negative numbers. That's fine.

Now find and edit the tool table ("tool.tbl") file. This is specific to each machine configuration, and has a format like this:

POC FMS LEN DIAM COMMENT

1 1 -2.7708 0.0625 1/6" ball end 2-flute

2 2 -2.6905 0.125 1/8" center cutting 4-flute

3 3 -2.7553 0.375 3/8" center cutting 4-flute

32 32 2.0 0.0 last tool

It will be located in the same directory as the .ini file for the machine configuration you're using.

The first two columns (POCket and FMS) should have the same number, and these should be integers. Enter length, diameter, and optional comments in the next three columns. The "last tool" line is not required.

If EMC2 is still running, select "File->Reload tool table" to reload the tool table.

(The following steps are similar to the "one tool" procedure earlier.)

2. In your G-code, include the following:

g17 (xy plane)(g17:xy; g18:xz; g19 yz)

g20 (inch units)(g20:inch; g21:mm)

g40 (cancel cutter radius compensation)

g49 (cancel tool length offset)

g54 (coordinate system 1)(g54,g55,g56,g57,g58,g59,g59.1,g59.2,g59.3 are 1..9)

g80 (cancel motion mode)

g90 (absolute distance mode)

g94 (feed/minute mode)

g97 (spindle speed is rpm, vs constant surface speed)

m9 (all coolant off)

m5 (spindle off) (program should turn on with m3 and s<spindle speed>)

Not all of these are required-they just reset various modes that may have been leftover from previous runs. The critical line with respect to work offsets is G54.

3. As before, in your G-code, use coordinates with respect to some identifiable location on the material prior to machining-you'll want to be able to set the work coordinate offset somehow, and having the reference point be inside the material may make that difficult to do with precision if you need precision.

4. Home the machine. Move each axis to the machine home position, select "Home."

5. Turn off tool length compensation and move the spindle for easier tool change. To do so enter the following lines in the "MDI" command box, one at a time:

(You may need to change the Z0 below to correspond to your safe z tool change position!)

G49

T0 M6

G53 G0 Z0

(These are all "zeros" above.)

Press the "GO" button next to the MDI entry box to act on each line. You may need to make sure the machine is out of E-stop and is on.

This turns off tool length compensation, tells EMC2 not to worry about the installed tool (we're saying it is tool number 0, non-existant), and raises the spindle to absolute position z=0 for an easy tool change. (You may need to change this if your tool change z location is different.)

6. Put the reference tool in the spindle.

7. Move the tool tip to the work coordinate origin, selecting each axis in turn and selecting "Touch Off." This establishes the work coordinate offsets. (When asked, use coordinate system P1 G54, which is the default.)

8. In your G-code, before using each tool, insert something like the following block (recall that parentheses surround comments in G-code):

t3 (prepare to use tool #3)

g53 g0 z0 (go to z=0 in absolute coordinates for a safe tool change)

m6 (actual tool change happens now)

g43 h3 (use tool length offset associated with tool number 3)

m3 (start spindle clockwise)

s3000 (spindle speed in rpm)

f15 (feed rate in inches/min)

G53 is a temporary (i.e., non-modal) command that says to interpret any coordinates on that line as being in absolute, machine coordinates. Thus, regardless of the tool offset or work coordinates, we're going to a known position.

G43 H<tool#> says to add in the offset from the tool table associated with the tool number. (Some other G-code interpreters have a G44 as well, which subtracts the tool table offset, but EMC2 allows either positive or negative offsets so we don't need to bother with a G44.) Note that this doesn't have to be the same tool index as the "T" command above, but it will almost always be the same.

You'll want to change the speed and feed rates to appropriate values for your job.

9. Mill away.

Note that you can issue the MDI commands:

g53 g0 z0

g53 g0 x0 y0

(First move up, then move to x=0, y=0.)

This will home the machine before you turn it off. You won't need to manually home it next time you run EMC2.

To do:

Is there a command for going to a tool change position in EMC2?

Add in reference to upcoming EMC 2.3 options for faster tool offset calibration.

Add in references to EMC2 documentation on these topics.


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited February 5, 2009 8:14 pm by SebastianKuzminsky (diff)
Search:
Published under a Creative Commons License