Skip to main content

Complete Plugins Reference

This guide lists plugin-specific M-codes, G-codes, and $-settings provided by grblHAL’s plugin ecosystem.
Each section includes the original repository URL for reference.


Plugin: Plasma / Torch Height Control (THC)

Github Repository: https://github.com/grblHAL/Plugin_plasma

$-Settings

SettingDescriptionExample
$350Mode of operation1 → uses external arc voltage input
$351Arc OK pin2 → input pin number
$352Arc Voltage pin3 → input pin number
$353Up/Down pin4 → output pin number
$354Voltage scale1.0 → scaling factor
$355Voltage threshold0.5 → threshold value
$356Velocity Anti-Dive threshold (%)20

M-Codes

M-CodeSyntaxDescription
M62M62 P[port]Disable THC, synchronized with motion
M63M63 P[port]Enable THC, synchronized with motion
M64M64 P[port]Disable THC, immediate
M65M65 P[port]Enable THC, immediate
M67M67 E[port] Q[percent]Immediate velocity reduction
M68M68 E[port] Q[percent]Velocity reduction synchronized

Example

; Plasma THC example
$350=2 ; THC mode: arc ok + up/down
$356=20 ; VAD threshold 20%
$361=1.5 ; Voltage scaling factor
$682=80 ; Z feed factor

M190 P3 ; Select material #3
M63 P0 ; Enable THC synced
G1 X100 Y0 F2000
G1 X100 Y100 F2000
M67 E0 Q50 ; Immediate feed reduction to 50%
M64 P0 ; Disable THC after cut

Plugin: Fan Control (Plugin_fans)

Github Repository: https://github.com/grblHAL/Plugin_fans

M-Codes

M-CodeSyntaxDescription
M106M106 P[fan] S[speed]Turn fan ON, set PWM speed (0–255)
M107M107 P[fan]Turn fan OFF

$-Settings

$-SettingDescription
$386-$389Map aux port → fan 0..3
$480Auto-off delay (minutes)
$483Bitmask: link fans to spindle enable

Example

; Turn on fan 0 at PWM 200
M106 P0 S200

; Turn off fan 0
M107 P0

Plugin: RGB LED Strip (M150) - Plugins_misc

Github Repository: https://github.com/grblHAL/Plugins_misc

CommandSyntaxDescription
M150M150 [R[intensity]] [U[intensity]] [B[intensity]] [S[strip]]Set LED color/brightness for a strip

Example

; Set strip 1 to bright red
M150 R255 U0 B0 S1

; Set strip 1 to purple
M150 R128 B128 S1

; Turn LEDs off
M150 R0 U0 B0 S1

Plugin: Feed Override (M220) - Plugins_misc

Github Repository: https://github.com/grblHAL/Plugins_misc

CommandSyntaxDescription
M220M220 [B] [R] [S[percent]]Feed override: B=backup, R=restore, S=set %

Example

; Set feed override to 80%
M220 S80

; Restore previous backup and set to 50%
M220 RS50

Plugin: Servo Control (M280) - Plugins_misc

Github Repository: https://github.com/grblHAL/Plugins_misc

CommandSyntaxDescription
M280M280 P[servo] S[position]Control analog/PWM servo: P=index, S=angle 0–180°

Example

; Move servo 0 to 90 degrees
M280 P0 S90

; Query servo 1 current position
M280 P1

Plugin: OpenPNP (Plugin_OpenPNP)

Github Repository: https://github.com/grblHAL/Plugin_OpenPNP

M-CodeSyntaxDescription
M42`M42 P[ioport] S[01]`
M114M114Report current position
M115M115Report firmware info
M204M204 P[axes] S[accel]Set axis acceleration
M205M205 [axes]Set jerk
M400M400Wait for motion buffer empty

Example

; Turn on digital output 2
M42 P2 S1

; Set acceleration for X/Y
M204 PXY S500

Plugin: SD-Card / File System (Plugin_SD_card)

Github Repository: https://github.com/grblHAL/Plugin_SD_card

CommandSyntaxDescription
$F$FList CNC-compatible files (.nc, .gcode, etc.) in the current working directory.
$F+$F+List all files in the current working directory regardless of extension.
$F=[file]$F=[file]Run G-code file.
$CWD=[path]$CWD=[path]Change Directory. Usage: $CWD=/ (root), $CWD=.. (up), $CWD=subdir (down). If called without arguments, it reports the current path.
$PWD$PWDPrint Working Directory. Reports the current working directory in the format [CWD:/path/to/dir].
$FM$FMMount SD card.
$FU$FUUnmount SD card.
$FD=[file]$FD=[file]Delete file.

Example

; Mount SD card
$FM

; List files
$F+

; Run a file
$F=myprogram.ngc

; Change directory
$CWD=subdir

; Print working directory
$PWD

Storage Systems in grblHAL

grblHAL utilizes a Virtual File System (VFS) layer for unified storage access across multiple platforms.

  • SD Card (FatFs): High-capacity storage for G-code files, typically formatted as FAT32. Mounted at /.
  • Internal Storage (LittleFS): Fail-safe internal storage for macros and tool tables. Supported on ESP32, Teensy 4.1, RP2040, MSP432, and others. Often mounted at /flash, /littlefs, or as the root (/) if no SD card is present.

Navigation: grblHAL tracks a Current Working Directory (CWD). Use $CWD=foldername to enter subfolders and $CWD=.. to go back up. You can verify your location with $PWD.


Plugin: Motor / Trinamic (Plugins_motor)

Github Repository: https://github.com/grblHAL/Plugins_motor

M-CodeSyntaxDescription
M122M122 [axes]Driver report/debug
M569`M569 [axis] S[01]`
M906M906 [axes] S[current]Set RMS current
M911M911Report prewarn flags
M912M912Clear prewarn flags
M913M913 [axes]Hybrid threshold
M914M914 [axes]Homing sensitivity

Example

; Check driver status on X/Y
M122 XY

; Set StealthChop mode for X axis
M569 X S1

; Set RMS current for all axes
M906 X100 Y100 Z100

Plugin: Spindle (Plugins_spindle)

Github Repository: https://github.com/grblHAL/Plugins_spindle

M-CodeSyntaxDescription
M3M3 S[rpm]Spindle on clockwise
M4M4 S[rpm]Spindle on counterclockwise
M5M5Spindle off
M104M104 P[n]Select spindle
M51M51 [options]Enable spindle features

Example

; Turn on spindle clockwise at 1200 RPM
M3 S1200

; Select spindle 1
M104 P1

; Turn off spindle
M5

Plugin: Laser (Plugins_laser)

Github Repository: https://github.com/grblHAL/Plugins_laser

CommandSyntaxDescription
M3/M4M3/M4 S[power]Laser on with PWM power
M5M5Laser off

Example

; Laser on at 50% power
M3 S128

; Laser off
M5

Plugin: Encoder (Plugin_encoder)

Github Repository: https://github.com/grblHAL/Plugin_encoder

$-SettingDescription
$701-$704Encoder pins and scaling per axis

Example

; Read spindle encoder position
M114

Plugin: EEPROM (Plugin_EEPROM)

Github Repository: https://github.com/grblHAL/Plugin_EEPROM

FeatureDescription
StorageExtended EEPROM for custom variables

Example

; Read/write custom EEPROM values (plugin-specific)
; Example depends on machine configuration

Plugin: WebUI (Plugin_WebUI)

Github Repository: https://github.com/grblHAL/Plugin_WebUI

FeatureDescription
HTTP / WebSocket APIExposes existing M/G-codes via web interface

Example

; No new M-codes; use M3/M4/M5 via WebUI API

Plugin: Sienci ATCi (Automatic Tool Changer Interface)

Github Repository: https://github.com/Sienci-Labs/grblhal-atci-plugin

This plugin provides advanced safety, state management, and sensor integration for the Sienci Automatic Tool Changer (ATC).

$-Settings

SettingDescriptionFormat
$683ATCi ConfigurationBitmask: Enable(1), Monitor Rack Sensor(2), Monitor TC Macro(4)
$684Keepout X MinMinimum X coordinate of the safe zone (mm)
$685Keepout Y MinMinimum Y coordinate of the safe zone (mm)
$686Keepout X MaxMaximum X coordinate of the safe zone (mm)
$687Keepout Y MaxMaximum Y coordinate of the safe zone (mm)

M-Codes

M-CodeSyntaxDescription
M960`M960 P[01]`

Real-time Report

Appends |ATCI:[flags] to the status string.

  • E: Enforcement Enabled
  • Z: Machine is Inside Zone
  • R/M/T/S: Source of state (Rack, M-code, Tool Macro, Startup)
  • I: Rack Installed
  • B: Drawbar Open
  • L: Tool Loaded
  • P: Low Air Pressure

Example

; Configure Keepout Zone
$684=10.0 ; X Min
$686=50.0 ; X Max
$685=10.0 ; Y Min
$687=50.0 ; Y Max
$683=7 ; Enable plugin (1) + Monitor Rack (2) + Monitor Macro (4)

; Manually disable keepout to jog inside for maintenance
M960 P0

Plugin: Embroidery (Plugin_embroidery)

Github Repository: https://github.com/grblHAL/Plugin_embroidery

Stream embroidery files (.dst, .pes) directly from SD card. This experimental plugin bypasses G-code translation for precise stitch timing.

Commands

CommandSyntaxDescription
$F<$F<[filename]Render embroidery file to G-code (for sender preview).
$F=$F=[filename]Run embroidery job from SD card.

$-Settings (Experimental)

SettingDescription
$450Stitch Feedrate: Feed rate for stitch moves (mm/min).
$451Z Travel: Needle Z travel (not yet implemented).
$452Trigger Aux Port: Input port number for needle position sensor.
$453Sync Mode: 0=Stepper Needle, 1=Trigger Sync (Sensor).
$454Stop Delay: Delay before motor off (ms).
$455Trigger Edge: 0=Falling, 1=Rising.
$456Aux 0 Cycle Output: Output logical high on Aux 0 during cycle (debug).

Example

; Configure embroidery settings
$450=600 ; Stitch feed rate (mm/min)
$453=1 ; Sync mode: Trigger Sync
$455=1 ; Trigger on rising edge

; Run embroidery file from SD card
$F=design.dst

Plugin: Event Triggers (eventout) - Plugins_misc

Github Repository: https://github.com/grblHAL/Plugins_misc

Bind real-time machine events to physical auxiliary output pins.

$-Settings

SettingDescription
$750-$759Event Source Selection: Assign a trigger event (e.g., Spindle On, Alarm) to Event Slot 0-9.
$760-$769Output Port Assignment: Assign a physical Aux Output Pin to Event Slot 0-9.

See complete-settings-reference.md for full trigger ID list.


Plugin: File-based Tool Table - Plugins_misc

Github Repository: https://github.com/grblHAL/Plugins_misc

Loads a LinuxCNC-compatible tool table (tool.tbl) from the SD card root.

Features

  • Automatically loads tool offsets from file on startup/mount.
  • Supports pockets for ATC logic.

Plugin: Homing Pulloff (Plugins_misc)

Github Repository: https://github.com/grblHAL/Plugins_misc

Allows setting a unique homing pulloff distance for each axis, overriding the global $27 setting.

$-Settings (Experimental)

SettingDescription
$290X-Axis Homing Pulloff (mm)
$291Y-Axis Homing Pulloff (mm)
$292Z-Axis Homing Pulloff (mm)
$293A-Axis Homing Pulloff (mm)
$294B-Axis Homing Pulloff (mm)
$295C-Axis Homing Pulloff (mm)

Plugin: FluidNC I/O Expander (Plugins_misc)

Github Repository: https://github.com/grblHAL/Plugins_misc

Adds support for external I/O expanders (like the Airedale) using the FluidNC UART-based protocol.

Hardware & Connection

  • Hardware: Connects via a UART (Serial) port on the controller
  • Firmware: The expander runs specific firmware (e.g., RP_FNC_IO_Expander).
  • Protocol: Uses a high-speed (default 1Mbaud), bi-directional UART protocol involving:
    • Text Commands: [EXP:...] for configuration (sent by controller).
    • Binary Events: 0xC4/0xC5 byte sequences for real-time pin state changes (latency < 1ms).
  • Passthrough: Supports daisy-chaining (passthrough) for other UART devices like a Pendant or Display on the same port.

Pin Mapping & Identification

The plugin registers the expander's pins as standard Auxiliary Inputs and Outputs in grblHAL.

  • Discovery: Use the $PINS command to see the assigned indices. Expander pins are typically labeled with FNC:.
  • Inputs: Expander Input 0-7 $\rightarrow$ grblHAL Aux Input $N$ to $N+7$.
  • Outputs: Expander Output 0-9 $\rightarrow$ grblHAL Aux Output $M$ to $M+9$.
  • RGB LED: If the main board has no RGB LED, the expander's status LED is claimed by M150.

Features & Usage

1. Digital Outputs (M62-M65) Control the expander's output pins.

; Turn ON expander output mapped to Aux Output 4
M62 P4
; Turn OFF
M63 P4

2. Wait on Input (M66) Use expander inputs for program flow control (e.g., wait for a button press or sensor).

; Wait for Expander Input (mapped to Aux Input 5) to go LOW
M66 P5 L0

3. Status LED (M150) Control the onboard RGB LED (if available and mapped).

; Set LED to Purple
M150 R255 B255

Protocol Details

The FluidNC protocol hybridizes text and binary for efficiency:

  • Config: Controller sends [EXP:io.0=in,high,pu] to configure Pin 0 as input, active high, pull-up.
  • State Change (Binary):
    • 0xC4 <PinID>: Set Pin LOW.
    • 0xC5 <PinID>: Set Pin HIGH.
    • PinID: 0x80 | PinIndex.
  • Ack/Nak: 0xB2 (Ack), 0xB3 (Nak).

Plugin: ESP-AT (Plugins_misc)

Github Repository: https://github.com/grblHAL/Plugins_misc

Enables WiFi connectivity using an ESP8266/ESP32 running AT-command firmware connected to a UART.

Features

  • Telnet access to the grblHAL console.
  • WebUI support (limited).

Plugin: Toolsetter / Secondary Probe (Plugins_misc)

Github Repository: https://github.com/grblHAL/Plugins_misc

Adds support for a dedicated toolsetter input and a secondary probe input, allowing for advanced probing scenarios.

$-Settings

SettingDescription
$678Toolsetter Input: Auxiliary input pin number.
$679Secondary Probe Input: Auxiliary input pin number.

Commands

CommandSyntaxDescription
G65G65 P5 Q[n]Select probe input: Q0=Standard, Q1=Toolsetter, Q2=Secondary.

Example

; Configure toolsetter input on Aux 2
$678=2

; Select toolsetter to probe tool length
G65 P5 Q1
G38.2 Z-50 F100

; Return to standard probe
G65 P5 Q0

Template Plugins

These plugins are available as templates in the grblHAL Web Builder under 3rd party plugins. They are designed to be starting points for custom functionality but often provide useful features out-of-the-box. Github Repository: https://github.com/grblHAL/Templates

FluidNC WebUI Support (FluidNC_ESP3D_cmd)

Adds support for extended commands required by the FluidNC WebUI (ESP3D v2 protocol).

  • Repo: my_plugin/FluidNC_ESP3D_cmd
  • Function: Enables [ESP:...] command handling, allowing the FluidNC generic WebUI to function with grblHAL.

MCU Load Estimator (MCU_load)

Adds a MCU: field to the real-time status report, showing the number of idle loop iterations per 10ms.

  • Repo: my_plugin/MCU_load
  • Report: |MCU:20000| (Higher is better, meaning less load. < 1000 indicates high load).

Modbus Command (Modbus_command)

Adds a system command for direct Modbus register access, useful for debugging VFDs or external modules.

  • Repo: my_plugin/Modbus_command
  • Syntax: $MODBUSCMD=<addr>,<func>,<reg>,<val>...
  • Example:
    • $MODBUSCMD=1,6,0x0201,1000 (Write 1000 to reg 0x201 on device 1).
    • $MODBUSCMD=1,4,0,2 (Read 2 registers starting at 0 from device 1).

Motor Power Monitor (Motor_power_monitor)

Monitors a digital input for high-voltage power loss (common on Trinamic setups).

  • Repo: my_plugin/Motor_power_monitor
  • Setting: $450 (Input pin number).
  • Behavior:
    • Triggers Alarm 17 associated with Motor Fault on power loss.
    • Automatically runs M122I (Re-init drivers) when power is restored and alarm is cleared.

Pause on SD File Run (Pause_on_SD_file_run)

Automatically triggers a Feed Hold when an SD card file starts execution.

  • Repo: my_plugin/Pause_on_SD_file_run
  • Usage: Useful for verifying machine state or changing tools before a job automatically begins. Requires user Cycle Start to proceed.

Realtime Report Aux State (Realtime_report_aux_out_state)

Adds the state of auxiliary output pins to the status report.

  • Repo: my_plugin/Realtime_report_aux_out_state
  • Report: |AUX:0010| (Bitmask of output states). Only reports ports available via M62-M65.

Realtime Report Timestamp (Realtime_report_timestamp)

Adds the system uptime to the status report.

  • Repo: my_plugin/Realtime_report_timestamp
  • Report: |TS:123456| (Milliseconds since boot).

Solenoid Spindle (Solenoid_spindle)

Optimizes PWM output for driving solenoids (Kick-and-Hold strategy).

  • Repo: my_plugin/Solenoid_spindle
  • Behavior:
    • Kick: 100% duty cycle for 50ms to energize the solenoid.
    • Hold: Drop to 25% duty cycle to maintain position without overheating.

Stepper Enable Control (Stepper_enable_control)

Adds Marlin-style G-codes for individual stepper control.

  • Repo: my_plugin/Stepper_enable_control
  • Commands:
    • M17 [X] [Y] ... - Enable specified steppers (or all if none specified).
    • M18 [X] [Y] ... [S<delay>] - Disable steppers immediately or after S seconds.
    • M84 - Alias for M18.

HPGL Plotter (hpgl)

Adds an HPGL interpreter mode, allowing the CNC to act as a native pen plotter.

  • Repo: my_plugin/hpgl
  • Command: $HPGL (Enter HPGL mode).
  • Exit: CTRL+X (Return to G-code mode).
  • Note: Originally based on Motöri.