CNC an Overview With Practical Example [MADE EASY]




Introduction: 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 information which I learned, but sorry if any errors present in this instructable....kindly forgive me as I am basically forming 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.

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

2.Why Number comes in play?

  • 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 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 a 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

Step 1: What Is Machining

Machining as simple can be said as a process of removal of the material form the workpiece to get the desired and needed shape.

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:

  • Lathe machining-(JOB rotate and TOOL move)
  • Mill Machining-(JOB move and TOOL rotate)
  • Drill Machining-(JOB stationary and TOOL rotate)

You may see the youtube videos for the good understanding about the working of the various Machining process.


  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 the 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:
  • Horizontal Operations.
  • JOB will rotate and TOOL will move.
  • Can be called as TURNING CENTRE.

2. CNCMilling Machine :

  • Vertical Operations.
  • JOB will move and TOOL will rotate.
  • Can be called as MACHINING CENTRE.


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:

  • Spindle ON or OFF
  • Door Opening
  • Coolant Operation

Some of the Common M codes in all the CNC machine are as follows :

  1. M03- Spindle ON clockwise
  2. M04-Spindle ON counterclockwise
  3. M05- spindle OFF
  4. M07 or M08- Coolant ON
  5. M09- Coolant 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 - Positioning the tool to the mark

  • It refers to the rapid positioning of the Tool to the required point.
  • Speed is at the maximum.

2. G01- Linear Interpolation or Cutting feed

  • It refers to the Stright line movement of the Tool.
  • It takes the shortest distance to the two points mentioned.
  • Speed can be set in this function

3.G02 or G03- Circular Interpolation(G02 -clockwise and G03 - counterclockwise)

  • This similar to the G01 code but it takes the curved path
  • So it is required for us to say about the radius and other specifications.

4.G96 and G97 (CSS Mode- Constant Surface Speed control)

  • This code controls the on and off feature in the Spindle Function, which may be elaborated in the next step.


This function of the CNC mainly focuses on the Speed of the Spindle.

  • The rotation speed of Spindle cannot be set to any arbitrary value, there is a calculation for the proper speed setup. Not maintaining the proper speed may lead to the improper FINISH of the JOB.

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.


Consider an example of the material to be removed is of the diameter 100mm, cutting speed is 200 m/min




RPM (n)=(Vc*1000)/π* D

RPM (n)=(200*1000)/(3.141*100)

n=636 RPM to be set for the good machining process.


  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 are valid.


  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 has 4 numbers the syntax of the code can be written as follows:


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


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




Thanks for your patient reading. This is the Important part in learning the CNC as it involves the better understanding of how the Codes are formulated for the required shape and size.

  • Before going any further you must be clear in plotting the 2d graph which is very basic part of the school higher Educations.
  • Here the points in the 2 D graph describe the exact notation of how the Tool must move and how to speed the spindle must rotate.

There are 2 main methods of programming in the CNC, They are as follows :

  1. Absolute method
  2. Incremental method

Absolute method:

  • Here the plotting of the graph will be taken with reference to particular point
  • Easy and safe
  • G90 is the CODE for absolute programming.

Incremental Method:

  • Reference to the previous point of the Tool.
  • used only for small changes.
  • Experts with great experience can make use of it.
  • G91 is the CODE for the Incremental programming.


  1. Make sure of the Tool Path
  2. Establish absolute Virtual Zero point
  3. Jobcentre is X=0
  4. Job end face is Z=0
  5. Assume it as a cartesian center
  6. always use a decimal point after the number
  7. End of the block is represented by a semicolon (;).
  8. Stoping of the program is made by emergency key, which exists the loop operation.


The Steps in the CNC programming are as follows:


  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 a 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 coolant( 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 coolant
  8. Return the tool back to Home position
  9. Program End M30


These are the ones 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


STEP3: CODING (all the remaining steps comes under to avoid unnecessary confusions)

G28 U0.0 W0.0;//Automatic return 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;// Coolant 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;// Coolant 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..!!


Teachers Contest 2017

Participated in the
Teachers Contest 2017

Be the First to Share


    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • CNC Contest 2020

      CNC Contest 2020
    • Secret Compartment Challenge

      Secret Compartment Challenge

    2 Discussions


    2 years ago

    thanks for my 1st lesson. Awaiting more


    Reply 2 years ago

    Congrats....Thank you for reading