CNC an Overview With Practical Example [MADE EASY]


This instructable is just to get overall basic knowledge and programming aspect of CNC machines and its programming with a program at the end. This Instructable may be taken as short notes of CNC and for refreshing material if you already have a knowledge of it. I think this would be greatly helpful for the Mechanical students who need to know about CNC and its importance in Core Company and also hobbyists knowing about it helps you a lot. Have taken efforts to give the correct informations which i learned ,but sorry if any errors present in this instructable....kindly forgive me as I am basically from Electrical Engineering. You may feel free to point it out if any. Moreover this is written in motive to share the known knowledge to the aspirants. So make use of it. Thus we move on from the very basic question of CNC.

CNC - Computer Numerical Control,in which Machining is based on the computer controls( any controller).

This is a number based control where each number has the separate Value. Each number is assigned to separate function and work. Which we will be seeing it in the upcoming steps.

Advantages of Learning CNC:

1. As a Core Mechanical Engineer, It is very essential for you to know CNC to get placed in Core.
2.Basics of CNC is only being used in the 3D printing Industry.
3. More for a Researchers or hobbyist to make new things, it is essential for them to know some basic of CNC, to make prototype.


The CNC basically constructed with the Controllers which determines various Machining Functions for each and every Machine Codes. (Mostly it might be a PLC -Programable Logic Controller)

The are mainly 2 main Controller companies ,They are as follows:

  2. SINENUMERIK CONTROLLER(siemens brand)

They are the Largest manufacturers of the CNC machine and CNC controllers in world.

In INDIA many manufacturers use FANUC machines

The Shape and Size of the output depend on the MOVEMENT OF THE TOOL or JOB and not because of the ROTATION. The Machining process may be broadly classified as follows: You may see the you tube videos for the good underestanding about the working of the various Machining process. Note:
  1. In this JOB means the material which you want to make to required shape and size.
  2. "TOOL is simply a tool"
As simple to understand: In your Home , Knife is a tool and vegetables or bread is job , (TOOL knife) which deforms the shape of (JOB vegetable )as required by (YOU the MACHINE).

Step 2: CNC Classification

The CNC machine can be basically classified into two types as follows :
  1. CNC Lathe Machine:
2. CNCMilling Machine :


CNC coding is basically in the Machine Level languages, there is a universal set of codes depending on the function and Operation the CNC does. The function of the CNC machine can be classified broadly as follows:
  1. Here I am focusing on the Lathe type CNC machines.
  2. The code may change according to the CNC machines, some codes may be similar. So It is advised to see the Manual of the CNC manufacturer before proceeding any further.
  3. Also it is required to know only very few CNC codes for understanding purpose only.
  4. Most important codes may be printed on the CNC machine itself.


As the name indicates, the auxiliary function is subordinate actions in the CNC machine. It is also called as the M-CODE Some of the examples of this function are: Some of the Common M codes in all the CNC machine are as follows :
  1. M03- Spindle ON clockwise
  2. M04-Spindle ON counter clockwise
  3. M05- spindle OFF
  4. M07 or M08- Coolent ON
  5. M09- Coolent OFF
  6. M30- Program end/ reset/ rewind
NOTE: Here spindle refers to part which holds the JOB.( Similar to the Hand in case of the Human ) The Spindly may be connected to the Induction or any other Motors, which makes it rotate.


This main function mainly deals with the Tool Movement and other preparatory works. It is also called as the G-CODE. here I will share some of the basic codes for understanding purposes Some of the G CODES are as follows: 1. G00 or G0 - Positiong the tool to the mark 2. G01- Linear Interpolation or Cutting feed 3.G02 or G03- Circular Interpolation(G02 -clockwise and G03 - counter clockwise) 4.G96 and G97 (CSS Mode- Constant Surface Speed control)


This function of the CNC mainly focus on the Speed of the Spindle. The speed of the Spindle mainly depends on the 2 main factors as follows :
  1. Diameter of the Tool or Job
  2. Cutting Speed (ie the Metal Removal rate)
CUTTING SPEED Vc= {(Circumference of the material or length removed per rev)*(number of revolution)}/ 1min Vc= π* D*n/1 mm/min Vc =π* D*n/1000 m/min now Rotation per min RPM n= (Vc*1000)/π* D RPM can be calculated easily. EXAMPLE: Consider a example of the material to be removed is of the diameter 100mm, cutting speed is 200 m/min given D=100mm Vc=200m/min RPM (n)=(Vc*1000)/π* D RPM (n)=(200*1000)/(3.141*100) n=636 RPM to be set for the good machining process. CODE:
  1. S(rpm value)
Example S636 ---> this maintains the speed of the Spindle at that RPM.


This function deals with the movement of the Tool for the required output shape. The Speed of movement of the TOOL is can be set by the calculation as follows: Speed= D/T mm/min It can be coded as 2 methods as follows :
  1. F (speed in mm/min) for example to set the speed of the tool as 100 mm/min we write as F100
  2. F(mm/revolution)for example need to remove 100 mm material in 1 min then we write as F100
Both methods of describing the feed function is valid. NOTE:
  1. But before using both you need to describe in the preparatory function as follows:
G94 for speed/min and G95 for mm/ revolution. ----->in G CODE B type G98 for speed/min and G99 for mm/ revolution. ----->in G CODE A type As said before there will be the slight difference in code for each and every CNC machine


This function determines the appropriate tool for the correct operation of the JOB. There will be set of Standard tools listed in the CNC and for each number feed will change the required tool automatically. The tool Code basically have 4 numbers the syntax of the code can be written as follows: CODE: T (tool number )(Offset Number) for example : T0101---->here the first 01 determines the tool number and the next 01 determines the offset number of the tool NOTE: The selection of the tool is totally different in the case of the Machine Centre that is Milling CNC types here it is written with the Auxiliary M code for example T01 M06


Thanks for your patient reading. This is the Important part in learning the CNC as it involves a better understanding of how the Codes are formulated for the required shape and size. There are 2 main methods of programming in the CNC, They are as follows :
  1. Absolute method
  2. Incremental method
Absolute method: Incremental Method: TIPS BEFORE WRITING CODE:
  1. Make sure of the Tool Path
  2. Establish absolute Virtual Zero point
  3. Job centre is X=0
  4. Job end face is Z=0
  5. Assume it as a cartesian centre
  6. always use a decimal point after the number
  7. End of the block is represented by semicolun (;).
  8. Stoping of the program is made by emergency key, which exist the loop operation.


The Steps in the CNC programming are as follows: Pre-requisities
  1. Make a diagram of the required job with the exact dimensions
  2. Make the Virtual zero at the center of the JOB.
  3. Mark the points where the Tool has to take path.
  4. Note down the X,Z table
Steps :
  1. Set absolute zero point
  2. Select the Tool
  3. Start the spindle with speed mentioning (as per the calculation)
  4. Start the coolent( to avoid heating in the machining process)
  5. Mention the points one by one ( always make sure the feed rate is low)
  6. Finally when all points are over stop spindle
  7. Stop coolent
  8. Return the tool back to Home position
  9. Program End M30
NOTES: These are the one's which I understand and It may differ to the other person or any standard material.


Here we can see the practical example of making it. here we need to write the coding to the Dimensions specified to the question.
STEP 1: Marking the points of motion of the TOOL
STEP 3: CODING (all the remaning steps comes under to avoid unnecessary confusions)

G28 U0.0 W0.0;//Automatic reurn to machine reference point
T0101;/Tool select ,

first 01 represents the tool and the next 01 represents offset tool

G0 X62.0 Z0.0;// Make sure the tool first placed little above the JOB
M03 S1000;// Start the spindle in clockwise direction and spindle speed is 1000 rpm
M08;// Coolent On
G01 X0.0 Z0.0 F0.1;// Set the JOB zero point and set the Tool feed speed
G01 X50.0 Z0.0;// from these plot the tabular column
G01 X50.0 Z-30.0;
G01 X54.0 Z-30.0;
G01 X54.0 Z-60.0;
G01 X58.0 Z-60.0;
G01 X58.0 Z-100.0;
G01 X62.0 Z-100.0;
M05;// Spindle off
M09;// Coolent off
G28 U0.0 W0.0;// Tool return to home position


Thus in this Instructable, I have made my full efforts to make sure that the reader will get a basic Idea of what is CNC and programming basics in it. I have made my efforts to cross check all details. I have given a gist of practical class in my internship from the expert of CNC. All comments improving this are welcomed. MY suggestions
  1. Install the Simulation Software and Simulate the code on your own....!
Thanks,... ENRICH YOUR LIFE WITH KNOWLEDGE .... BE happy.. GOD is with you..!!