Inside the ‘brains’ of the CNC

The term CNC first started out as just “NC” for numeric control. The concept was developed in the 1950s using punched paper tape to convey instructions to motors that controlled…

The term CNC first started out as just “NC” for numeric control. The concept was developed in the 1950s using punched paper tape to convey instructions to motors that controlled the movement of a metal milling machine. When computers became more readily available, they were wired directly to the motors and CNC was born.

Digital fabrication is a better description because a CNC machine is actually controlled by a combination of software programs. CAD software is used for part design, while CAM software translates the design into G-code or digital step-and-direction files to make the part. There’s also software to run the CNC machine’s controller and the seldom-discussed “post-processor.”

At its simplest, the controller is the brain of the CNC machine. It takes the G-code instructions and interprets them, changing them into electronic signals that are sent to the motors on the CNC machine, which in turn make each axis move in the desired direction by the desired amount. If you’re with me so far, you’ve mastered the basics of CNC operation.

Types of controllers

But no two controllers are exactly alike. Some are written with an open-source programming language and can be modified by a knowledgeable user. Some are written with proprietary language, making it difficult for anyone but the provider to modify the program. Some controllers are described as general purpose, meaning they can be used on any type of CNC machine after being properly configured. Finally, some controllers run off a Windows-based personal computer or a central processing unit built into the electronics of the CNC machine.

Though many providers claim their controller is the best, they are all pretty much the same in the final view. They function a bit like a filing cabinet full of folders with a set of instructions in each folder so the controller can generate a set of electronic instructions to the motors as instructed by the G-code so the CNC machine performs in a consistent and accurate manner. The technical term for this is the relational database.

The CNC controller’s relational database has information about the CNC machine’s cutting area, the type of motors that move each axis, the type of sensors and switches used, the type of spindle or router being used, if there’s an automatic tool changer in use and information about the tooling. If you’re buying a modern CNC machine, the manufacturer has set the parameters and it’s unlikely they will ever have to be changed. CNC machines focused on cabinet or furniture making now have integrated design and G-code generation in the controller or have integrated software packages from outside suppliers.

For those of us who like to tinker and build their own CNC machines, the two most commonly used non-proprietary software controllers are Windows-based Mach3 (www.machsupport.com) and the open source LinuxCNC (http://linuxcnc.org). With a close study of the instruction manuals, about two weeks of reading threads on support forums and a bit of patience and diligence, these can be installed and put into operation.

The most important portion of the controller software is called the user interface, which can be thought of as the desktop of any personal computer, giving the user access to many of the characteristics of the operating system and installed programs.

Though CNC controller interfaces vary widely, a typical user interface generally shows an operator what line of G-code is being run; the X, Y, and Z position of the cutting tool; the feed rate and the speed of the router or spindle. Most user interfaces also provide for “manual data input” to teach the controller a sequence of G-code instructions at the CNC machine that can be saved for future use.

Another very important part of the user interface is the diagnostic screen. If the CNC machine stops unexpectedly, the screen displays an error message — most likely indicating a software or electronics malfunction or incorrect command for the physical size of the machine. Since most CNC machines are linked to a computer network, a technician can access the controller remotely to help solve the problem.

The final puzzle piece

The post processor translates G-code into a language that can be used by the controller software to direct the actions of the CNC machine. This simple description isn’t really sufficient, since the process does not flow in one direction — it actually flows in a multiple of directions, which results in safer, more efficient and economical use of the software and the hardware in a digital fabrication process.

Most G-code programs are of a language that can be read by almost any appropriate piece of software, similar to how some word processor files can be read by a variety of word processors. Some CAM programs generate simple G-code instructions, while others generate very complex instructions. Problems arise when the CNC controller software is expecting electronic signals of a certain pattern or sequence based on that CNC machine’s mechanics, electronics and motors and other physical characteristics.

The post processor is the software that translates the relatively language-neutral instructions of the G-code into language-specific instructions for the CNC machine’s electronics and mechanics. And fortunately, the post processor generally has fixed characteristics that the operator will never have to deal with.

But the operator needs to have a general understanding about all of the software required to run a CNC machine, which has been the focus of my series of articles. As with all tools, increased knowledge will help to operate it safely and efficiently, as well as to know how to ask for help should the tool not function as expected. 

This article originally appeared in the June 2014 issue.

 A.J. Hamler is the former editor of Woodshop News and Woodcraft Magazine. He's currently a freelance woodworking writer/editor, which is another way of stating self-employed. When he's not writing or in the shop, he enjoys science fiction, gourmet cooking and Civil War reenacting, but not at the same time.