Computer Numerical Control (CNC) is very much software driven. Yet, the architecture of the CNC software is obscured from the general software world. It has evolved separately with its own paradigm and nomenclature.
At the heart of a CNC is the G-Code which is an old programming language that resembles an assembly language. A G-Code keyword is a combination of a letter and digits such as G0, G2, M2, M30, etc. All letters in the alphabet are fully used in G-Code. It is all about moving a tool onto a certain path in a work coordinate system with certain speed, duration, distance, and anything related to it. They call it jogging and inching the tool. It may involves multiple tools simultaneously. The tools need to move accordingly to make, to assemble or to move products. Understanding how G-Code works is the precursor to understand how CNC works.
In a CNC controller as depicted above, the Arduino Nano becomes the G-Code interpreter to control 3 stepper motors simultaneously. G-Code is not just for stepper motors. It can deal with various actuators. However, this particular Arduino CNC controller is designed for controlling 3-axis movement using stepper motors. Arduino Nano is a small micro-controller. A powerful computer is needed to deal with more complex and high performance CNC requirements. The computer may run LinuxCNC which is a dedicated operating system for CNC.
Since the Arduino Nano has a very small processing resources so it requires a separate driver module for each stepper motor. The A4988 module simplifies Arduino interfacing with stepper motor. More details can be found in the article Control Stepper Motor with A4988 Driver Module & Arduino and in the video on How to Set Vref for A4988 and DRV8825 Stepper Motor Drivers.
The Arduino CNC controller will receive G-Codes from a master computer. Hence, it needs some sort of a handler that awaits for G-Codes and at the same time executes them. Grbl was designed for Arduino to serve that purpose. Usually an Arduino CNC controller is loaded with Grbl. What does Grbl stand for? The answer is nothing.
On the master computer side there are many software that can send G-Codes to Grbl-based controllers. One of it is bCNC. The word 'send' is highlighted in the earlier sentence because there are many G-Code sender software out there. It is a part of the nomenclature. The computer sends G-Codes to the machine so that the machine reacts accordingly.
The bCNC is a G-Code sender for 3-axis CNC machine. It has other features such as X-Y planar autoleveller, digitizer, and G-Code editor. First time user of bCNC will immediately notice some buttons of G54 to G59, and will wonder what are they for. The bCNC has dedicated G54-G59 user interfaces for configuring multiple workspaces. The G54-G59 are G-Codes that handle the work coordinate system for 6 tuples or workspaces. The bCNC is very much G-Code oriented.
Working with G-Codes directly can be very tedious. Hence, most software like bCNC will auto-generate G-Codes from a given Computer Aided Design (CAD) drawing which was previously conditioned for specific machining. However, fine-tuning G-Codes manually can improve performance and reduce the cost of production.
The Arduino CNC controller has nothing to do with Arduino programming. The only Arduino related coding is the Grbl which is maintained by a strong community. It has Arduino in the name because it uses an Arduino module. However, nothing is stopping anyone from writing his own Arduino code. But then he will be on his own, and he may have to write his own software on the master computer to communicate with his Arduino code.
There are many types of Arduino CNC controllers. The one in the picture above can control three 12V stepper motors. There are controllers that handles different types of stepper motors, servos, or linear actuators. There are controllers that handles spindles or lasers. A close-loop controller will handle feedback such as from limit sensors, rotary encoders, or gauges. There are general purpose controllers and there are single purpose controllers. As long as they use G-Codes then controlling them will be similar from the software point of view.
The diagram above summarizes the software stack for the Ardunino CNC controller. The bCNC software can work with various drawing types prepared using some CAD software. The bCNC will convert a drawing into a series of paths which will then be converted into G-Codes. The bCNC can also load G-Codes directly from files. The bCNC will then send the G-Codes to Grbl which will parse and run it. The Grbl will control the stepper motors attached to the Arduino according to the given G-Codes. The stepper motors are expected to move some sort of tooling such as engraving or cutting. The movement should follow the drawing.
The Arduino CNC controller cannot work on its own. It always await for a G-Code from a master. It is event driven. It is like a vehicle which requires a driver. A G-Code is like an instruction from a driver such as move forward, turn left, stop, etc.
The bCNC and Grbl can be replaced with any software with similar functionality. The G-Code, however, must be there to qualify for the CNC standard.
Comments
Post a Comment