CNC Machines
CNC Machines
• Autonomous operations.
• For motion of tool and/or guides ways, actuators and sensors are
used.
• Low in wear
Because of rolling contact, wear is less than that of sliding contact.
Thus, the accuracy is high.
1
2
Advantages of ball screws
• Highly efficient and reliable.
• Less starting torque.
• Lower co efficient of friction compared to sliding type screws and
run at cooler temperatures
• Power transmission efficiency is very high and is of the order of 95
%.
• Could be easily preloaded to eliminate backlash.
• The friction force is virtually independent of the travel velocity
and the friction at rest is very small; consequently, the stick-slip
phenomenon is practically absent, ensuring uniformity of
motion.
• Has longer thread life hence need to be replaced less frequently.
• Ball screws are well -suited to high through output, high speed
applications or those with continuous or long cycle times.
• Smooth movement over full range of travel.
1
3
Harmonic drives for high reduction
Use of Stepping Motors in Slide Movement
1
5
Stepper motors : Variable reluctance,
permanent magnet
Working of a stepper motor
Sequence of rotation
(CW): B – C – D - A’
Mega-torque motors
Linear stepper motors
DC Motors : basic working
Brushless DC motors
• This format is essentially the same as the fixed sequential format. The
difference is that each word within a block is preceded by a Tab
character.
• The main improvement over fixed sequential format is that the Tab
character for a specified word need not be followed by a numeric data if
data are not required in that particular block or they are modal data.
Word Sequential Format
• This is the format that is used on virtually all modern controllers and
will be explained in greater detail.
• With this type of format, each type of word is assigned as address
that is identified by a letter code within the part program.
• Thus, the letter code specifies the type of word that follows and then
its associated numeric data is given.
• For example, the code T represents a tool number. Thus, a word of the
form T01 would represent tool number 1.
• Theoretically, with this approach, the words in a given block can be
entered in any sequence and the controller should be able to interpret
them correctly.
Sequence and format of words:
G word can have upto two integer digits with no associated signs.
X word can have upto seven real digits, which may be positive or negative. The decimal point which
is not explicitly entered is assumed to be three digits from the right, and there can be upto four
digits to the left of the decimal point in metric format.
F script can have upto four real digits, which may be positive or negative. The decimal point, which is
not explicitly entered, is in the rightmost position and there can be upto four digits to the left of the
decimal points.
I word can have upto seven real digits with no associated signs. The decimal point, which is not
explicitly entered, is assumed to be three digits from the right, and there can be upto four digits to
the left of the decimal point in metric format.
Fundamentals of NC part programming
• The first step in writing an NC part program is to determine and organize the data that will be used within the
program.
• A fully coded NC part program generally consists of five broad categories or classes of command. These are
the following:
1. Preparatory functions: These are used to inform the MCU of the requirements for the machining that is
to be carried out and thus to establish the necessary operating conditions.
2. Axis motion commands: These are used to control the amount of relative motion between the cutting tool
and workpiece along each machine axis.
3. Feed and speed commands: These are used to set and control the cutting conditions for individual
machining operations.
4. Identification commands: These are used to identify specific entities in the program, such as cutting tools
used.
5. Miscellaneous Commands: These are used to control various other aspects of the machine’s operation not
addressed elsewhere, such as turning the spindle on and off and changing tools.
Preparatory Functions
• Preparatory functions form the largest class of commands used in NC
programs.
• They are identified by the word address letter ‘G’ followed by two digits.
4
2
4
3
List of M codes
M codes vary from machine to machine depending on the
functions available on it. They are decided by the manufacturer of
the machine. The M codes listed below are the common ones.
4
4
Explanation of Some Commonly Used G-Codes
• G00 is a preparatory function to specify that the tool should be moved to a
specified location.
• This function is used only to control the final position of the tool and is not
concerned with the path that is followed in arriving at the final destination.
• For this reason, motion with this function is also referred to as positioning mode.
• The way this code is implemented in most controllers is that all axes that need to
be moved in order to get to the target point are moved simultaneously at the
beginning of the motion, with each axis being moved at maximum speed.
• The effect of any one of these canned cycles is cancelled by programming a G80
function.
Axis Motion Commands
• Axis motion commands are used to specify the axes that are required to move during the
execution of a given command.
• They are made up of a letter specifying an axis such as x, followed by dimensional
information associated with the motion of the axis in question.
• The X,Y, and Z commands, respectively, specify the motion of the cartesian coordinates
themselves; I,J and K values specify the offset relative to x,y,and z axes.
• Some controllers support the use of polar coordinates, in which case R and A axes are
used to specify the radial and angular directions, respectively.
• The dimensional data associated with an axis command can represent absolute
dimensions (if G90 was specified) or they may be incremental values (if G91 was
specified)
• The dimensional data associated with the axis commands consists of real numbers that
may or may not have a sign associated with them.
• An important point to remember is that the axis commands guide the motion of the point
defining the tool position. For some operations, such as profile milling, the periphery of
the cutter moves along the surface to be machined, rather than the tool-point (i.e., center
of the cutter)
Axis motion commands
• Thus, the actual motion of the tool has to be along a path different
from the geometry of the machined surface. This difference is called
a tool offset which the programmer has to consider when writing the
program.
• Most modern controllers can be programmed using an offset tool by
applying a compensation factor called cutter compensation.
• With this approach one the offset between the tool point and the
machined surface is specified, the tool motion can be programmed as
if the tool point followed the actual machined surface.
• The controller adjusts internally for the difference in the actual path
followed by the tool point.
• Cutter compensation is programmed using G41 and G42 codes and
cancelled using G40 code.
Feed and speed commands
• Feed and speed commands are used to specify the feed rate and speed
to use during the machining operation.
• The feed command is specified by the address script ‘F’ followed by
the numerical value of the feed rate required; the speed command is
specified by the address word ‘S’ followed by the required speed.
• The feed rate and the speed used during the machining are of crucial
importance in determining how long it will take to make a part.
• The units for cutting conditions can be specified in a variety of ways
in the NC program. The feed rate may be specified directly in units/
min. or units/rev., where the units may be in inches or millimeters.
• The preparatory functions G92-G98 are used to designate how the
cutting conditions are to be specified.
Identification commands
• Identification commands are used within a NC program for the simple task of being able to
identify certain entities within the program.
• The ‘N’ word is the most widely used identification command and it is used to identify
individual blocks within the program.
• The identification data in this case consist of integer numbers written in a format given as
part of the machine specification.
• Usually three or four digits are used and leading or trailing zeros are not suppressed.
• The ‘N’ word is purely for the convenience of human writing or using the program, so that
they can distinguish between the various blocks in the program.
• The MCU itself does not use the data contained in the ‘N’ word.
• Because the controller does not use the block identification data, it is not strictly necessary
to number the blocks in any particular order.
• However, for the convenience of the human users, blocks are generally numbered in
ascending order, with increments of 5 or 10 between consecutive blocks.
• The reason for having increments of 5 or 10 is that, when necessary, additional blocks may
be inserted in the program while maintaining the generally ascending order in which blocks
are numbered.
Identification Commands
• The other widely used command is the ‘T’ word.
• This is used to identify individual cutting tools used within the program.
• For most components, more than one tool is needed to complete the
machining operations needed to make the part.
• For many NC machines, multi-station tool turret or tool magazines housing
several cutting tools are used.
• The programmer uses the ‘T’ word to specify to the controller regarding
the various tools available should be used for a particular machining
operation.
• The format of ‘T’ word usually consists of two unsigned digits after ‘T’.
• Other identification commands are used to identify special sections of the
part program, such as loops and macros, that can be executed more than
once during the running of the program.
Miscellaneous Commands
• Miscellaneous commands are used to control a variety of
machine functions that are not covered by the other
commands.
• The address word ‘M’ followed by two unsigned digits is
used to specify miscellaneous commands.
• Examples of functions controlled by miscellaneous
commands are turning the spindle on and off, turning
coolant on and off, initiating a tool change, clamping and
unclamping the work-piece interrupting and restarting
program execution, stopping the program and rewinding
the program.
Miscellaneous Commands
• Generally, miscellaneous
Table Some common M codes
commands take effect after
execution of the other CODE FUNCTION
commands in the block in M00 Program stop
which they are programmed. M01 Optional stop
• It is usually permissible to M02 End of program
program more than one M03 Spindle on CW
miscellaneous command in a M04 Spindle on CCW
given block provided they do
not have conflicting effects. M05 Spindle off
M06 Tool change
• Many of the ‘M’ codes have
M07 Mist coolant on
been assigned standardized
functions. Some ‘M’ codes M08 Flood coolant on
are given in the table : M09 Coolant off
M30 End of program-rewind
Special Characters
• In addition to the commands outlined in the preceding pages,
certain special characters are used in NC part programs to achieve
special effects.
• Some of these special characters are used with all controllers, but
others are particular to specific controllers.
• These characters include the % sign, common to all controllers,
which is used as the first line of the NC program.
• The character signals the controller when the beginning of the
program has been reached during a rewind of the program, an end
of block character is used at the end of each block of the program.
• This special character is produced by hit of a carriage return on a
keyboard.
• The character itself does not print when the program is printed.
• During coding , the end-of-block is frequently represented by *
symbol or the letters EOB.
G02/G03 Circular interpolation
Format
N G02/03 X Y Z I J K F using the arc center
or
N G02/03 X Y Z R F using the arc radius
Arc center
The arc center is specified by addresses I, J and K. I, J and K are the X, Y and Z
co-ordinates of the arc center with reference to the arc start point.
• Absolute zero is usually set at the corner edge of a part, or at the center of a
square or round part, or an existing bore. ABSOLUTE ZERO is where the
dimensions of a part program are defined from.
• Absolute dimensions are referenced from a known point on the part, and
can be any point the operator chooses, such as the upper-left corner, center
of a round part, or an existing bore.
G 18 : ZX plane selection
Syntax: N.. G18
G 19 : ZY plane selection
Syntax: N.. G19
Assumptions:
1. The top lower left corner will be used for program zero.
2. Machining motion will start in the indicated position.
3. The tool is ¼ in. above the top surface of the part prior to start of machining.
4. The tool diameter used is ½ in., so only one pass is required.
5. A cutting speed of 500 rpm and feed rate of 10in./ min are used for machining.
6. Machine specification: N3G2X + 43Y + 43Z+ 43R+ 43F4S4T2M2
NC Program
1”
(4, 4)
p1
Motion of tool:
p0 p1 p2 p3 p4 p5 p1 p0
p0 (2, 2)
1. Set up the programming parameters
5”
2.5”
p4
p2 p3 p5
1”
Programming in inches
5”
Use absolute coordinates
Feed in ipm
45°
N010 G70 G90 G94 G97 M04
(4, 4)
p1
Spindle speed in rpm
p0 (2, 2)
Spindle CCW
2. Set up the machining conditions
5”
2.5”
p4
p2 p3 p5
1”
Machine moves in XY-plane
Spindle speed
45°
N020 G17 G75 F6.0 S300 T1001 M08
(4, 4)
p1
Tool no.
p0 (2, 2)
Flood coolant ON
3. Move tool from p0 to p1 in straight line
5”
2.5”
p4
p2 p3 p5
Linear interpolation
1”
target coordinates
45°
(4, 4)
p1
p0 (2, 2)
4. Cut profile from p1 to p2 5”
2.5”
p4
p2 p3 p5
1”
Linear interpolation
5” target coordinates
p0 (2, 2)
target coordinates
1”
5”
y = 9 + 0.125 = 9.125
(6.5 - x)2 + 0.1252 = (1 - 0.125)2
x = 5.634
45° p3
(x, y)
(4, 4)
p1 (6.5, 9)
.125
p0 (2, 2)
1”
6. Cut along circle from p3 to p4
5”
2.5”
p4
p2 p3 p5
1”
5”
target coordinates
1”
5”
Linear interpolation
p0 (2, 2)
8. Cut from p5 to p1 5”
2.5”
p4
p2 p3 p5
1”
5”
Linear interpolation
p0 (2, 2)
9. Return to home position, stop program
5”
2.5”
p4
p2 p3 p5
1”
Linear interpolation
45°
end of data
(4, 4)
N100 M00
p1
N5 M12
N10 T0101
N15 G0 X100 Z50
N20 M3 S600
N25 M8
N30 G1 X50 Z0 F600
N40 Y-30 F200
N50 X80 Y-20 F150
N60 G0 X100 Z50
N70 T0100
N80 M5
N90 M9
N100 M13
N110 M30
Code Explanation
N5 Clamping workpiece
N10 Changing No.1 tool and executing its offset
N15 Rapidly positioning to A point
N20 Starting the spindle with 600 r/min
N25 Cooling ON
N30 Approaching B point with 600mm/min
N40 Cutting from B point to C point
N50 Cutting from C point to D point
N60 Rapidly retracting to A point
N70 Cancelling the tool offset
N80 Stopping the spindle
N90 Cooling OFF
N100 Releasing workpiece
N110 End of program, spindle stopping and Cooling OFF
CNC MILLING EXAMPLE
N5 G90 G71
N10 T1 M6
N15 G92 X-100 Y86 Z95
N20 G0 X0 Y0 S2500 M3
N25 Z12.5
N30 G1 Z-12.5 F150
N35 X-20 Y30
N40 G2 X10 Y100 R80
N45 G1 X140 Y60
N50 G2 X150 Y0 R50
N55 G1 X0 Y0
N60 G0 Z12.5
N65 G91 G28 Z0 M5
N70 G91 G28 X0 Y0
N75 M30
CODE EXPLANATION
N5 absolute positioning, metric unit
N10 tool change to T1
N15 define work zero point at A
N20 rapid traverse to A, spindle on (2500 RPM, CW)
N25 rapid plunge to 12.5 mm above Z0
N30 feed to Z-12.5, feed rate 150 MMPM
N35 cut line AB to B
N40 cut arc BC to C
N45 cut line CD to D
N50 cut arc DE to E
N55 cut line EA to A
N60 rapid retract to Z12.5
N65 reference point return in Z direction, spindle off
N70 reference point return in X and Y directions
N75 end of program
SAMPLE PROGRAM ON DRILLING
N1 T16 M06
N2 G90 G54 G00 X0.5 Y-0.5
N3 S1450 M03
N4 G43 H16 Z1. M08
N5 G81 G99 Z-0.375 R0.1 F9.
N6 X1.5
N7 Y-1.5
N8 X0.5
N9 G80 G00 Z1. M09
N10 G53 G49 Z0. M05
N11 M30
CODE EXPLANATION
N1- Tool change (M06) to tool no.16
N2- Tool rapidly moves (G00) to first drilling position X0.5
Y-0.5 while taking into account Zero-offset-no. 1 (G54)
N3- Drill starts rotating clockwise (M03) with 1450 rpm
(S1450).
N4- Drill takes depth Z1. taking into account tool length
compensation (G43 H16), coolant is turned on (M08).
N5- Drilling cycle (G81) parameters, drill depth (Z) and
cutting feed (F) are given,
with this command first drill is made at current position
(X0.5 Y-0.5).
N6- As drilling cycle continues it’s work with every axis
movement so next drill is
done at X1.5
N7- Third drilling hole at Y-1.5
N8- Fourth drill at X0.5
N9- Drilling cycle is cancelled (G80), Coolant is turned off (M09).
N10- Taking Machine-coordinate-system (G53) into account the drill is taken
to Z0 position. Tool length compensation is cancelled (G49), cutter rotation
is stopped (M05).
N11- CNC part-program is ended.
References