How a CNC operates

From ShapeOko
Jump to: navigation, search

A CNC system needs to:

  1. read G-code from a file
  2. interpret the G-code
  3. plan the motions
  4. generate step and direction signals
  5. (indexing) count step pulses to determine the required current in each motor winding
  6. put that much current through the motor

In all cases, your motor drivers (e.g. Allegro A4988, Texas Instruments DRV8825, Toshiba TB6560...) do the last two steps (step 5 is called "indexing"). Cheap, small drivers do both step 5 and 6 on a single chip; larger and/or more advanced drivers (e.g. Gecko) do them with separate components.

LinuxCNC uses the PC to do all the other steps. It generates the step and direction signals on the PC's parallel port (or a specialized card), which connect to the inputs of the motor drivers.

Mach3 does the same, but it also supports doing step 4 (the actual timing and generation of the pulses) on separate, dedicated hardware connected by USB or Ethernet (e.g. SmoothStepper).

With GRBL, Universal G-Code Sender (or GRBL Controller, etc) runs on the PC, reads the G-code, and sends it over to GRBL via serial-over-USB (so the PC does step 1). GRBL runs on the Arduino Uno and does steps 2, 3 and 4. Your driver shield has the drivers that do steps 5 and 6.

For completeness, I should add that some driver chips do not use the step pulse system; instead, they are given motion commands directly from the planner. Steps 4 and 5 are replaced by a single step, "interpret motion commands to determine the required current waveform in each motor winding". GRBL does not support this type of driver, and I doubt it can be used from LinuxCNC or Mach3 either.

Also, there's great leeway in interpreting what step 2 means. GRBL has an intentionally limited G-code interpreter, with no support for user variables, expressions, flow control, canned cycles, spindle synchronization, and so on. It can handle only three linear axes. GRBL can not be used for lathes, nor for milling machines with more than three axes. Both LinuxCNC and Mach3 have pretty much complete G-code support, with all the features, and they understand rotary axes. They can be -- and are -- used with professional machines of many types. Humans who write G-code directly find the lack of variables and flow control in GRBL very limiting. However, G-code generated by CAM packages doesn't need those features, so GRBL works perfectly for that.[1]