Language of the Machines


2 -


Tags relevant to the post:
coding machine standardization


Introduction into reasons and structure of G-Code - a language for controlling machines.

why

Photos from lecture – CNC overview –

G-Code - a common language for many types of machines from CNC, to laser, to robot-manipulator, etc. It is established to create standardization - while different devices might need to be configured differently same set of instructions will do same outcome; abstraction - raises base level so you don’t have to do everything from scratch every time; protection - provides structure for many of most common dangers to be controlled (like boundary, speed limitations etc.); ease of use - common between devices, though might be slightly different based on capabilities and configurations; complex geometry simplification - huge geometry will easily overwhelm device if put all together into RAM, which is usually is too small to even handle large SD cards (not enough memory for addresses).

M-Code - firmware override commands

machines

Types:

Photos from lecture – CNC controller –

Parts:

Photos from lecture

Native steps - stable positions of stepper-motor. Micro-stepping - software based subdivisions (combine positive and negative signals to create fractional position). With modern control is fairly reliable but nonetheless is not as accurate as stepper with more resolution.

Photos from lecture – Disassembled stepper-motor –

code structure

  1. Setup and prepare (i.e. heat up the bed, heat up the filament and wait, go to 0, define new 0, etc.);
  2. Commands (various types of movement, activating, deactivating sensors and tools)

firmware

Benefit of these both is that they are both opensource. Both have many flavors - versions and variable functionality. Can be further edited through configurations.

common commands

Normally G-Code is generated (foe example, by slicer), but many tools (robot-manipulator, CNC, etc.) can show it so it’s important to at least approximately understand it.

F - speed
S - spindle speed
T - tool
It is possible to switch between relative or absolute coordinates by other commands. NB! Always double check - this is most common error.

Full list of Marlin commands

Common process - prepare g-code file, store on SD-card, read on machine and execute. However, can be done directly by interacting with machines over USB over serial:

Suggestion: Play around with it and G-Code instructions side by side.

// TODO: results of experimentation