CNC Lab Manual
CNC Lab Manual
CNC Lab Manual
CNC
LABORATORY
MANUAL
1
MECHANICAL ENGINEERING
CNC stands for computer numerical control. The evolution towards the current state began with NC,
or numerical control only.
The first NC machines were built in the 40s and 50s. These machines based on existing tools but with some
modifications.
Motors moved based on the informational input given to them via punched tape. The code was manually
punched into data cards.
In the 50s, the first steps towards CNC machining were done. At first, MIT’s computers were ready to
produce the punched tape according to the inputs. In one instance, this reduced the time spent on producing
the card from 8 hours to 15 minutes for a milling job.
Such time-saving capabilities resulted in more R&D work in the field. Soon the first programming languages
for CNC machining became available. Over time, largely because of decreasing computer prices, CNC took
over the reigns from NC
Contemporary CNC machines are fully automated. All they need is digital files with the instructions about
cutting trajectories and tooling.
Design or machining processes require many tools to produce a certain part. Machinists can build digital tool
libraries that interface with the physical machine. Such machinery can automatically switch tooling based on
the digital instructions, making them manufacturing workhorses.
The CNC machining process starts with designing the parts in CAD software. The 3D model determines the
necessary dimensions and properties of the final part.
Some of these programs come in CAD-CAM packages, so the flow can continue in the same programs.
Otherwise, CAD models are fed into designated CAM software. If both CAD and CAM are from the same
product family, no translation of files is necessary. Otherwise, the CAD files need to be imported.
CAM (computer-aided manufacturing) software prepares the model for the whole fabrication process. First, it
checks the model for errors. Then it creates a CNC program to fabricate the physical part.
The program is, in essence, a set of coordinates that guides the cutting head during the manufacturing process.
The third step is choosing the right parameters. These include cutting speed, voltage, RPMs, etc. The
configuration depends on the geometry of the part as well as the available machinery and tooling.
Lastly, the software determines the nesting. Nesting means the orientation and placement of parts relative to
raw material. The purpose is to maximise the material usage.
All this information is then translated into codes that the machinery can understand – M-code and G-code.
G-Code vs M-Code
A common misconception is that G-code is all you need for running machining operations. However, this is
not true, as the code can be separated into the two codes mentioned above.
G-code refers to a language that is used to tell a machine how to move. Basically, it is the geometric code. G-
code determines the movement and speed of cutting heads.
The instructions are fed to a machine controller which is just an industrial computer. This, in turn, dictates
how the motors should move. And the motors, of course, determine the path to be followed.
2
MECHANICAL ENGINEERING
The M-code, on the other hand, gives all the info that the G-code overlooks. That’s why it is called
either machine code or miscellaneous code.
M-code’s instructions include information about the use of coolant, tool change, program stops, etc.
So both are equally important but not the same.
So, we now know how CNC machines work. But not all these machines are used for CNC machining.
We will take a closer look at all the different types of CNC machines that are available a little later. But in
a traditional sense, CNC machining refers to only a few of these automated processes. Namely milling,
turning, grinding, routing, drilling, etc.
Milling:
It is an operation where the cutting tool rotates. When the milling tool comes into contact with the workpiece,
it removes chips from it.
Milling operations include:
3
MECHANICAL ENGINEERING
End milling
Chamfer milling
Face milling
Drilling, boring, tapping, etc.
It is a very universal fabrication method with great accuracy and tolerances. Milling is suitable for a variety of
materials and is also very quick. The ability to manufacture a wide range of complex parts is a great advantage.
The disadvantages include a large amount of waste, need for a variety of tooling and high cost of equipment.
Turning:
4
MECHANICAL ENGINEERING
While the two are often called just CNC machining, turning and milling have distinct differences. Turning is
pretty much the opposite of milling. This means that instead of the cutting tool, the workpiece is rotating.
CNC turning is commonly used for producing shafts, for example. The tool is brought against the rotating
workpiece to cut off bits of metal, known as chips or swarf. Achieving high accuracy for a suitable type of
limits and fits system is possible.
Turning is usable on the outside of a cylinder or on the inside. The latter operation is called boring.
Grinding:
CNC grinding machines use a rotating grinding wheel to remove material. The objective is to give a high
precision finish to a metal part.
The achievable surface quality is very high. Therefore, it is used as a finishing operation rather than creating
the final piece from raw materials.
Routing:
CNC routers are seemingly similar to CNC milling machines. Here also the rotating piece is the cutting head.
The main difference lies with the materials suitable for cutting.
Routers are a perfect fit for cutting softer materials (not metals) that do not require very high accuracy. The
reason for that is its lesser output power.
At the same time, routers are quicker. Therefore, they are able to produce the parts in less time.
Drilling:
While milling equipment can also produce holes, drills are meant for only that job.
The difference? While milling tools use cutting edges around the cutting head’s periphery, drills use the tip of
the tool to produce a hole.
CNC drilling machines are commonly used to automate this job, provide better accuracy and a more cost-
effective solution.
Plasma cutters
Waterjet cutters
Flame cutters
Press brakes
Milling machines
Turning machines
Routers
Electrical discharge machines, etc.
5
MECHANICAL ENGINEERING
All these operations greatly benefit from the automation factor. This reduces the human element in the final
quality, enhances repeatability of processes and accuracy.
The description above about the workings of CNC machines apply to all these methods. When turning to
a laser cutting service for example, the same logic applies – the cutting path is automatically generated.
This process like many others, however, does not need some of the extra information like the change of
tooling. Because the same cutting head is suitable for the whole duration of the process.
Seemingly, CNC machining has no limitations. It is suitable for a wide range of materials, including different
types of metal, plastics, foam, composites and wood.
3-axis milling machines are able to produce most of the more basic geometric shapes. For more complex parts,
multi-axis milling centers are available.
6
MECHANICAL ENGINEERING
For example, a 5-axis CNC milling centre can help out. While the more common 3-axis one has 3 linear axes
of movement, 5-axis machines can also rotate the cutting head and the machine bed.
This significantly improves the flexibility but also increases the cost. Even though CNC is a lot quicker,
manual machining still has its place in the industry. Especially for low-volume rapid prototyping.
But CNC machining still prevails in the sector when high accuracy is necessary. This is the reason why so
many industries take advantage of it, including:
Aerospace
Electrical
Defence
Mining
Industrial machinery
Food & beverage
Clothing
Automotive
Product design, etc.
All in all, CNC machining has cemented its place in the manufacturing sector as a reliable and useful way of
producing parts. At the same time, CNC machining cost may often be a little bit higher compared to other
fabrication methods.
The machinery itself comes with a high price and is difficult to operate, posing some dangers. Thus, the best
you to get machined parts is turning to a company who has the necessary expertise to assure top-notch quality.
7
MECHANICAL ENGINEERING
8
MECHANICAL ENGINEERING
9
MECHANICAL ENGINEERING
G code Description
G04 Dwell
G21 Input in mm
10
MECHANICAL ENGINEERING
11
MECHANICAL ENGINEERING
DESCRIPTION OF G-CODES:
G00 is used for positioning the tool rapidly at the desired point. In rapid traverse,
the machine moves at a prespecified, rapid rate. It is used when cutting tool is not
cutting the material, but is being positioned with respect to the work piece. G00 helps in
saving machining, time as rapid traverse rate is much higher compared to feed rate. For
the machine manufacturer sets rapid traverse, feed rate, user has no control over it.
Hence it can be different for different machine tools. For example,
G01 is used to move the cutting tool with the feed rate. Hence, it is used when
material has to be actually removed from the work piece. Feed rate has to be
specifiedby the programmer in the part program. For example, the command
causes tool to move clockwise along arc of radius 10 from current position to X = 10,Z = - 10
12
MECHANICAL ENGINEERING
G03 is used when machining has to be done in a circular path in counter clockwise
direction
G04 (Dwell)
G04 causes program to wait for a specified time. It can be used to rotate the tool at
a fixed position for a specified period of time.
The format of the command is
G04 X(t)
For example, if a drill or reamer should dwell is a hole for 5 seconds; the command can be
written as
G04 X5.0
G20 and G21 is used to enter input data in inches and millimeter respectively.
G28
G28 is used to move the tool to a reference point via an intermediate point. The
movement is accomplished in rapid traverse mode.
G32, G78
It is used for cutting straight or tapered threads, but since it does not allow
automatic return to the start point, G78 i.e. multiple threading cycle is used. G78 is
13
MECHANICAL ENGINEERING
canned cycle unlike G32. The format of this cycle comprises of two blocks. Forexample,
G78 P021O56 Q180 RO.18
In the first block for P021056, 02 refers to number of finishing cuts, 10 is the
chamfer value and 56 is flank angle of thread in degrees. Q is the minimum cutting depth in
microns and R is finishing offset (allowance) in millimeter. In the second block, X and Z
are the coordinates. R is incremental taper value with sign (R = 0 for cylindrical threads), P is
the thread depth in microns (always positive). Q is cutting depth of first cut in microns
(radius value, without sign), F is thread pitch in millimeter.
An amount equal to its radius uses G41 and G42 to offset the cutter from its
predesigned path. For example, consider end milling of the rectangular plate as shownin figure
3.1. Usually, the edges of the plate are defined as the trajectory of the cutter, while in fact, the
axis of the tool should get offset from the edges by an amount equal toradius of the cutter and
move along dotted path shown in the figure. In order to offset the tool from work piece, by an
amount equal to its radius, work piece shape is programmed withcutter compensation made
by the programmer. During machining, if offset value equal to cutter radius is set in the CNC
controller, the tool path is offset automatically. The offset amount is set in the offset memory.
G41 is used when cutter moves on the leftside of the work piece and G42 is used when cutter
moves on the right side of the work piece. G40 and G41 are used in conjunction with G00 or
G01. The radius compensation is canceled with G40. It is incorporated in the same block as
GOO or G01 or in the proceeding block.
14
MECHANICAL ENGINEERING
The CNC software, has a table which has tool information such as tool number, codenumber
and offset value. Refer the following table.
(assumes)
For positive offset value, G43 is used while for negative offset value, G44 is used.
G49 is used at the end of the program to cancel tool-length offset value.
G90 X 45 Y 50
G9l X 35 Y 40
15
MECHANICAL ENGINEERING
G92
It is used to define coordinate system setting. It is used to specify the location of
system origin, relative to starting point of the cutting tool in milling, drilling and some
lathe machines.
M code Description
M00 Program
stop
M01 Optional program
stop
M02 End of program
16
MECHANICAL ENGINEERING
M code Description
M00 Program
stop
M01 Optional program
stop
M02 End of program
17
MECHANICAL ENGINEERING
M08 Coolant on
18
MECHANICAL ENGINEERING
DESCRIPTION OF M COMMANDS
This command is used to stop the execution of part program. Main spindle, feed
and coolant will be switched off. Also, the chip protection door can be opened without triggering
an alarm. MOO can be used if an inspection check is required during an operation.
M01 also works like M00, but only if "Programmed Stop Yes" is switched on by
soft key in the menu PROGRAM CONTROL.
It works like M30. It halts program execution, spindle is turned off and tool moves
To extreme right on the Z-axis.
It is used to switch on the spindle in clockwise direction. Note that spindle speed
has to be programmed, chip protection door should be closed and workpiece properly damped for
executing M03.
It is used to stop the spindle motion. In turning operation, MO5 can be used to stop
spindle for inspection of workpiece or change of cutting tool. It can be used at the end of
program, however at the program end, the main spindle is also automatically switched off.
If the NC machine has tool magazine or tool drum with multiple tool capacity. M06is
used to change the tool. It is used with T word, which specifies the tool number.
M07 is used to switch the coolant on in flood mode while M08 is used to switch
coolant on in must mode. M09 is used to switch coolant off.
M10, M11
M10 is used to clamping the fixture while M11 is used to unclamp it.
19
MECHANICAL ENGINEERING
M13 turns the coolant on and starts the spindle motion in clockwise direction. M14
also switches the coolant on but starts spindle motion in counterclockwise direction. M17
switches off both coolant and spindle.
M30
With M30, all machine drives are switched off and control returns to start of program.
M60
In case NC/CNC machine makes use of multiple pallets for loading-unloading of
workpiece from the machine, M60 can be used for changing pallets.
M98, M99
M98 is used to call a subprogram or function. In this command, the subprogram number
and the number of repetitions have to be specified. M99 is used to jump back tothe start of the
program or the specified block number
20
MECHANICAL ENGINEERING
Experiment No.-1
Procedure:-
Part Program:-
21
MECHANICAL ENGINEERING
%
O0011
T0101
G50 S3500
G96 S240 M4
G00 X82 Z0.
G01 X-2 F0.15 M7
G00 Z2.
G00 X71.
G01 Z-47 F0.3
G01 X74 Z-49.8
G01 X81 Z-53
G00 Z2.
G00 X60
G01 Z-19.8
G01 X65
G01 X72 Z-24
G00 Z2.
G00 X51.
G01 Z-16.8
G01 X57 Z-19.8
G01 X65
G00 Z2.
G00 X37.
G01 X52 Z-6
G00 X150 Z100
M5
M9
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully
22
MECHANICAL ENGINEERING
Experiment No.-2
Object:
Procedure:-
Part Program:-
23
MECHANICAL ENGINEERING
%
O2222
T0101
G50 S3000
G96 S139 M04
X105 Z4 M08
X104
G72 W3 R0.5
G72 P25 Q40 U0 W0.2 F0.3
N25 G0 Z0
N30 G01 X100 Z0
N35 X-1
N40 Z2
G0 X105
Z2.2
X104
G71 U3 R0.5
G71 P45 Q120 U0 W0 F0.3
N45 G00 X20
N50 G01 X20 Z0.2
N55 Z0
N60 G03 X30 Z-5 I0 K-5
N65 G01 Z-26
N70 G02 X38 Z-30 I4 K0
N75 G01 X44
N80 X50 Z-33
N85 Z-47
N90 G02 X56 Z-50 I3 K0
N95 G01 X60 Z-52
N100 Z-67
N105 G02 X66 Z-70 I3 K0
N110 G01 X88
N115 X100 Z-76
N120X104Z-76
G0 X105
M09
M05
X200 Z100
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully
24
MECHANICAL ENGINEERING
Experiment No.-3
Object:
Procedure:-
Part Program:-
25
MECHANICAL ENGINEERING
%
O0003
G54
N020 T0101
N030 M03 S1500
N040 G00 X30 Z2
N050 G71 U1 R1
N060 G71 P70 Q100 U0.1 W0.1 F0.2
N070 G01 X0 Z0
N080 G01 X20 Z-10
N090 G01 X20 Z-30
N100 G01 X30 Z-40
N110 G70 P70 Q100
N120 G00 X30 Z100
N130 M05
N140 M30
N150
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
26
MECHANICAL ENGINEERING
Experiment No.-4
Object:
Procedure:-
Part Program:-
27
MECHANICAL ENGINEERING
%
O0006
G0X40Z5
M03S200
G01X0Z0F900
G03U24W-24R15
G02X26Z-31R5
G01Z-40
X40Z5
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
28
MECHANICAL ENGINEERING
Experiment No. – 5
Object:
Procedure:-
Part Program:-
29
MECHANICAL ENGINEERING
O0033
G21G40G99G90
G28U0.00W0.00
T0101
G97M03S1000
G00X44.00Z2.00
G76P020060Q100R0
G76X37.44Z-30.00R0P1280Q200F2
G28U0.00W0.00
M05
M30
Result:- Part program of the given dimension has been prepared and also run on the software
successfully.
30
MECHANICAL ENGINEERING
Experiment No.-6
Object:
Procedure:-
Part Program:-
31
MECHANICAL ENGINEERING
%
O0001
G91 G28 Z0
G91 G28 X0 Z0
G54 G98 G40 G80 G94 G90
T1 M6
S1000 M3
G0 G43 Z50 H2
G0 X10 Y30
G0 Z2
G1 Z-15 F80 M7
G0 Z2
G0 X30 Y50
G1 Z-15
G0 Z2
G0 X50 Y70
G1 Z-15
G0 Z2
G0 X70 Y50
G1 Z-15
G0 Z2
G0 X90 Y30
G1 Z-15
G0 Z2
G0 Z100
M5
M9
G0 X150 Y150
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
32
MECHANICAL ENGINEERING
Experiment No.-7
Object:
Procedure:-
Part Program:-
33
MECHANICAL ENGINEERING
%
O0001
G91 G28 Z0
G91 G28 X0 Y0
G54 G98 G40 G80 G49 G90
T1 M6
S2000 M3
G0 G43 Z50 H1
G0 X120 Y90
G0 Z2
G1 Z-5 F200 M7
G41 G1 X110 Y80 D1
G1 X105 Y65
G1 Y17.5
G1 X80 Y5
G1 X67.5
G3 X42.5 I-12.5 J0
G1 X30
G1 X5 Y17.5
G1 Y52.5
G1 X30 Y65
G1 X42.5
G3 X67.5 I12.5 J0
G1 X80
G1 X105 Y52.5
G1 Y50
G3 X120 Y25 I24.916 J-2.051
G40
G0 Z100
G0 X124.363 Y35.098
M5
M9
G0 X150 Y100
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
34
MECHANICAL ENGINEERING
Experiment No.-8
Object:
Procedure:-
Part Program:-
35
MECHANICAL ENGINEERING
%
O0003
N5 G00 G54 G64 G90 G17 X-20 Y-20 Z50
N10 S450 M03 F250 D01
N15 C0
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G42 X0 Y0 M08
N40 X60 Y0
N45 X85 Y30
N50 X85 Y50
N55 G03 X70 Y65 U15
N60 G01 X45 Y65
N65 G02 X30 Y50 U15
N70 G01 X10 Y50
N75 X0 Y0
N80 G40 X-20 Y-20
N85 G00 Z50 M09
N90 Y100
N95 M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
36
MECHANICAL ENGINEERING
Experiment No.-9
Object:
Procedure:-
Part Program:-
37
MECHANICAL ENGINEERING
%
O0001
G00G90X70Y25Z1S800M3
Z-5
G01X20F150
G00Z100
X-25Y50
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
38
MECHANICAL ENGINEERING
Experiment No.-10
Object:
Procedure:-
Part Program:-
39
MECHANICAL ENGINEERING
%
O0001
G00X10Y25Z1S1250M3
G01Z-5F100
G02X10Y25I20J0F125
G00Z100M5
X-20
M30
Result: - Part program of the given dimension has been prepared and also run on the software
successfully.
40