G-Code CNC Router Controller

Brian Millier constructed a microcontroller-based, G-code controller for a CNC router. So, we gave the retired instrumentation engineer space to publish a two-part series about his project.

In Part 1 (Millier-CC-2013-04-Issue 273), Millier explains the basics of G-code and how it is converted into three-axis motion, via the router’s three stepper motors. In Part 2, he describes his design of the router’s axis controller (powered by three small microcontrollers) and the host controller (powered by a more powerful microcontroller).

He calls the project one of the most challenging he has ever tackled.

So why bother? Especially when the combination of a PC and ArtSoft’s Mach3 software is a common and affordable approach to running a CNC router? Well, like most DIYers, Millier couldn’t resist an opportunity to learn.

“I want to be upfront and say that this is probably not the most practical project I have ever done,” Millier says in Part 1. “You can usually pick up a used PC for free, and the Mach3 software is professional-grade and handles much more complex G-code programs than my DIY controller will. However, it did provide me with a challenging programming task, and I learned a lot about designing a program with many concurrent tasks, all of which are quite time critical. Even if you are not interested in building such a controller, you may find interesting some of the techniques and tricks I used to provide the multi-axis stepper-motor motion.”

Millier’s two articles focus on the two main tasks of his project.

“The first was to understand the G-code language used to program CNC machines well enough to be able to write the firmware that would parse the G-code commands into something that a microcontroller could use to control the stepper motors used for each of the three axes,” he says. “The second task was to design the hardware/firmware that would actually control the three stepper motors, all of which had to move synchronously at accurate, ramped speeds.”

Millier wraps up his project by saying: “This was probably the most challenging project I’ve tackled, outside of work projects, in many years. In particular, the Basic program code for both of the controllers ran beyond 3,500 lines.”

You can Millier-CC-2013-04-Issue 273. The second article is available via Circuit Cellar’s webshop.

9 thoughts on “G-Code CNC Router Controller

      • Hi Chris,
        thanks for the reply. I found the code archive, but in the text of the article it’s written that the schematics (which are not shown in the article, neither in the first nor in the second part) should be available for ftp download. But the code archive does not contain any schematic documents…

        Regards from Stuttgart,
        Micha

        • We contacted the author and learned there were indeed schematics that did not get printed. I’ve updated the Issue 274 FTP folder I noted before to include those schematics in both the author’s ZIP files and the issue ZIP files.

          • thanks a lot for the effort. Having the schematics now makes clear how the controller is working…

  1. so is it also possible to control the u and v axis and have a separte feed input I am looking for a g code controle to control a EDM wire machine, but do you have the posibilty to let run back the machine but Mach3 don’t do it in a arc.
    I have a lot of intrest in your project.
    greetings Benny

    • Benny, at the end of the article in the magazine, you can find the author’s email. You might reach out to him directly with your question.

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>