Skip to the content.

µCNC

µCNC - Universal CNC firmware for microcontrollers

Building µCNC

To configure µCNC to fit your hardware you can use µCNC config builder web tool to generate the config override files. Although most of the options are configurable via the web tool, some options might be missing and you might need to add them manually (regarding tools or addon modules mostly).

VERSION 1.9+ NOTES

Version 1.9 introduced several breaking changes from the previous version. These are:

As with version 1.8 µCNC is becomming too large for Atmega328P (still supports it, but barelly fits). For that reason and to keep giving support for this MCU a branch of version 1.7 will be maintained with all the latest bugfixes and patches.

IMPORTANT NOTE

By default and as a safety measure µCNC control inputs (Emergency stop, Safety door, Hold, Cycle start-resume), as well as limit switches and probe, are held high by the microcontroller input weak-pull up resistors. If left unconnected or connected to normally opened switches these inputs will be in an active/triggered state and the controller may lock all motions. There are a few ways you can reconfigure µCNC to enable normal operation here.

Also beware that the main branch contain the latest changes, including bug fixes and some intermediate changes. Some of theses changes are very extent and can come with issues and although new PR are tested, they might have unexpected errors or behavior. If you find and issue please report. Also prefer the latest release version over the master branch.

About µCNC

Heavily inspired by Grbl and LinuxCNC, µCNC started to take shape in the second half of 2019, in an attempt to come out with a G-Code interpreter/controller software/firmware that is both compact and powerful as Grbl and flexible and modular as LinuxCNC, with the following goals in mind:

  1. µCNC is written in C (GNU99 compliant). This gives the advantage of being supported for a large number of CPU/MCU and compilers available.
  2. Modular library based:
    • Independent hardware. All MCU/hardware operations are written in a single translation unit that acts like a standardized HAL interface, leaving the CNC controlling code independent of the MCU architecture has long has it has the necessary abilities to execute code and respond to interrupts in a predictable away. Porting µCNC for a different MCU should be fairly straight forward.
    • Independent kinematics. Another dimension of the HAL is the possibility of defining how the translation between machine coordinates and the motions is translated back and forth. This should theoretically allow µCNC to be easily adaptable to several types of machines like cartesian, coreXY, deltas and others. µCNC supports up to 6 axis.
    • As of version 1.2.0 the addition of a HAL config that allow the user to build link inputs and outputs of the controller to specific functions or modules (like using a generic input has an encoder input or a PWM output has a servo controller with a PID module)
    • As of version 1.3.0 a new dimension to the HAL was added. The tool HAL. This allow to add multiple tools that can perform different task with µCNC.
    • As of version 1.4.0 a special kind of PIN type dedicated to servo motors control was added µCNC.
    • As of version 1.4.0 a new module extension system was introduced. It’s now possible to add hooks in the core code and attach multiple listeners to execute additional code further expanding µCNC original capabilities. Modules can be enabled and disabled in the config file to enable feature on per need basis.
  3. Compatible with already existing tools and software for Grbl. There is no point in trying to reinvent the wheel (the whole wheel at least :-P). For that reason µCNC uses protocol compatible with Grbl. This allows it to easily integrate with Grbl ecosystem.

You can navigate the project wiki to find out more on how to use it.

You can expand µCNC using via modules. The available modules are at the µCNC-modules repository.

You can now also use µCNC config builder web tool to generate the files needed to adapt µCNC to your board.

You can also reach me at µCNC discord channel

µCNC discord channel

Supporting the project

µCNC is a completely free software. It took me a considerable amount of hours and effort to develop and debug so any help is appreciated. Building docs, testing and debugging, whatever. Also if you really like it and want help me keep the project running, you can help me to buy more equipment. Recently I have saved some extra money and bought a laser engraver. This hardware was fundamental to develop and testing version 1.2.0 and beyond. Currently this machine is being used to work on other projects and is running µCNC smoothly. Or you may just want to simply buy me a coffee or two for those extra long nights putting out code ;-)

paypal

Current µCNC status

µCNC current major version is v1.9. You can check all the new features, changes and bug fixes in the CHANGELOG.

Version 1.9 added the following new major features.

Version 1.8 added the following new major features.

Version 1.7 added a new major feature.

Version 1.6 added a couple of new features.

Version 1.5 added a couple of new features.

Version 1.4 added the following new features.

Version 1.3 added the following new features.

Version 1.2 added lot of new features needed for the future hardware/features support and some important bug fixes. These include:

G-Codes support

µCNC for now supports most of the RS274NGC v3:

List of Supported G-Codes since µCNC 1.3.0:
  - Non-Modal Commands: G4, G10*, G28, G30, G53, G92, G92.1, G92.2, G92.3
  - Motion Modes: G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80, G81*, G82*, G83*, G85*, G86*, G89*
  - Feed Rate Modes: G93, G94
  - Unit Modes: G20, G21
  - Distance Modes: G90, G91
  - Plane Select Modes: G17, G18, G19
  - Tool Length Offset Modes: G43, G43.1*, G49
  - Cutter Compensation Modes: G40
  - Coordinate System Modes: G54, G55, G56, G57, G58, G59, G59.1, G59.2, G59.3
  - Control Modes: G61, G61.1, G64
  - Program Flow: M0, M1, M2, M30(same has M2), M60(same has M0)
  - Coolant Control: M7, M8, M9
  - Spindle Control: M3, M4, M5
  - Tool Change: M6
  - Valid Non-Command Words: A, B, C, F, H, I, J, K, L, N, P, Q, R, S, T, X, Y, Z

  - Outside the RS274NGC scope
    - Bilinear surface mapping: G39,G39.1,G39.2*
    - Servo Control: M10*
    - Digital pins/trimpot settings: M351* (set/get microsteps), M907* (set/get current via digipot)
    - Laser PPI M126*(mode) M127*(PPI) and M128*(Pulse width)
    - Valid Non-Command Words: E (used by 3D printing firmware like [Marlin](https://github.com/MarlinFirmware/Marlin)) (currently not used)

* see notes

NOTES:

Other G/M codes available via external modules

ALL custom G/M codes require at least ENABLE_PARSER_MODULES option enabled

TODO List of G-Codes in µCNC future releases:

µCNC capabilities

µCNC currently supports up to (depending on the MCU/board capabilities):

  - 6 independent axis
  - 8* stepper step/dir drivers
  - 9* limit switches (interrupt driven)
  - 1 probe switch (interrupt driven)
  - 1 feed hold input (interrupt driven)
  - 1 cycle start/resume input (interrupt driven)
  - 1 emergency stop (interrupt driven)
  - 1 door open switch (interrupt driven)
  - 16 pwm outputs
  - 16 analog inputs
  - 32* generic digital inputs
  - 32* generic digital outputs
  - 6 servo control outputs (50Hz-PPM)

* see notes

NOTES:

µCNC with a configuration similar to Grbl is be able to keep up to 30KHz step rate for a 3 axis machine on an Arduino Uno at 16Mhz. (the stated rate depends on the length of the segments too, since many short length segments don’t allow full speed to be achieved). For this specific type of use (like in laser engraving) a 16-bit version of stepping algorithm is possible pushing the theoretical step rate limit to 40KHz on a single UNO board.

µCNC current supported hardware

µCNC initial development was done both around Arduino UNO board just like GRBL. But µCNC can also be installed in other AVR boards like Arduino Mega (for Ramps), or similar boards (like Rambo). Other MCU’s have and will be integrated in µCNC:

I used several UNO emulators but debugging was not easy. So a kind of virtual board (Windows PC) was created to test µCNC core code independently. It can run on:

µCNC current supported kinematics

µCNC is designed to be support both linear and non-linear kinematics and can be extended to support other types of kinematics. Currently µCNC supports the following kinematics:

µCNC roadmap

A couple of changes were introduced with version 1.2.0 of µCNC to prepare for future and easier expansions. These changes are:

Future versions are in plan for:

Building µCNC

For building µCNC go ahead to the makefiles folder of the target MCU and follow the instructions specific to your device. Version 1.3.0 restructured the project so that it can easily be opened, configured, compiled and loaded via Arduino IDE environment. Just go to the uCNC folder and open uCNC.ino. See how to build the project for your board in the wiki.