← How-Tos
laser May 6, 2026 ◑ 12 views ◯ 8 min read

How to Optimize GRBL Firmware on the Longer Ray5 20W

longerray520wgrblfirmwareparameter tuningoptimizationlightburnsteps per mmaccelerationlaser modehowto

Introduction

The Longer Ray5 20W ships with a GRBL-based firmware optimized for laser engraving out of the box, but there is significant untapped performance hidden in the controller. Custom GRBL parameters, firmware updates, and performance tuning can improve engraving speed, cut quality, and motion smoothness. This guide covers everything firmware-related for the Ray5: stock firmware updates, custom GRBL parameter optimization, backup and restore procedures, and the settings that make the difference between good and professional-grade output.

What You Need

Step 1: Identify Your Current Firmware Version

  1. Connect the Ray5 to your computer via USB-C.
  2. Open LightBurn and connect to the laser (choose the correct COM port).
  3. Open the Console tab and type: $I then press Enter.
  4. The controller responds with version information. Look for:

Document this output. If a flash goes wrong, you need to know your baseline.

Step 2: Read and Document All GRBL Parameters

Before changing anything, back up your complete configuration.

  1. In the LightBurn console, type: $$ and press Enter.
  2. The controller dumps all stored EEPROM parameters ($0 through $132+ depending on version).
  3. Copy this entire output and save it to a text file named Ray5_GRBL_Backup_YYYYMMDD.txt.

Critical: This backup is your recovery path. If a parameter change ruins performance, you can restore every value individually.

Step 3: Stock Firmware Update Procedure

Longer periodically releases firmware updates that fix bugs, add features, or improve motion planning. Always update before reporting problems or doing custom tuning.

Method A: XLoader (Windows, Easiest)

  1. Download the official firmware .hex file from Longer's support site.
  2. Download XLoader from the GRBL wiki or Arduino site.
  3. Close LightBurn and any other software that may hold the COM port.
  4. Open XLoader:
  1. Click Upload. The status bar fills and reports bytes uploaded.
  2. When complete, open LightBurn and verify with $I that the new version is active.

Method B: Arduino IDE (All Platforms)

  1. Install Arduino IDE from arduino.cc.
  2. Add GRBL as a library: Sketch > Include Library > Manage Libraries > search GRBL.
  3. Connect the Ray5 via USB-C.
  4. Select Tools > Board > Arduino Uno.
  5. Select the correct COM port under Tools > Port.
  6. Open File > Examples > GRBL > grblUpload.
  7. Click Upload. The IDE compiles and flashes the firmware.

After flashing: The EEPROM is reset to GRBL defaults. You must restore Ray5-specific parameters (Steps/mm, max rates, accelerations) from your backup or re-tune from scratch.

Step 4: Optimize GRBL Parameters for the Ray5 20W

These parameters are specific to the Longer Ray5 20W hardware (LEKN-CZ V2.0 board, NEMA 17 steppers, M8 threaded rod Z-axis). Enter each in the LightBurn console with the format $NNN=VALUE then press Enter. The controller confirms with OK.

Step Calibration ($100, $101, $102)

To verify: jog 100 mm in X and Y, measure with calipers. If actual movement is 99.8 mm, adjust: new_value = (commanded_distance / actual_distance) * current_value. Repeat until accurate within 0.1 mm over 100 mm.

Maximum Feed Rates ($110, $111, $112)

Accelerations ($120, $121, $122)

Optimal acceleration note: For fine engraving with detailed images, reduce to 2000 mm/sec^2 for smoother motion. For cutting jobs where speed matters, 4000 mm/sec^2 works if the machine is on a solid surface.

Junction Deviation ($11)

Arc Tolerance ($12)

Step Pulse and Idle Delay ($0, $1)

Step Port Invert Mask ($2)

Direction Port Invert ($3)

Homing Cycle ($22, $23, $24, $25, $26, $27)

Spindle/Laser Mode ($30, $31, $32)

Step 5: Laser Power Calibration via Firmware

The Ray5's 20W diode output may not match LightBurn's 0-100% scale linearly. You can verify and calibrate this through GRBL parameters.

  1. In LightBurn, create a power test: a series of lines at 10%, 20%, 30%... 100% power.
  2. Engrave on black-anodized aluminum or tile at constant speed (1000 mm/min).
  3. Examine the result. If 10% is barely visible and 50% is already near-white, the response is non-linear.

Adjusting $30 for linear response:

Step 6: Enable and Test Limit Switches

  1. Verify your Ray5 has limit switches installed on X and Y (stock on newer units, optional on early units).
  2. Type $21=1 to enable hard limits.
  3. Trigger each limit switch manually by hand while the machine is idle. The controller should alarm and require a reset ($X to clear alarm, then $H to home).
  4. If triggering a limit causes no alarm, check wiring or enable soft limits ($20=1) as a fallback.

Soft Limits ($20)

Step 7: Advanced Tuning - Dynamic Laser Power and Scanning Offset

Scanning Offset Adjustment (LightBurn Setting)

At high speeds, the laser head may lag slightly behind the commanded position due to mechanical inertia. This causes the engraved image to shift slightly on reverse passes. Fix this in LightBurn:

  1. Edit > Machine Settings > Scanning Offset Adjustment
  2. Engrave a test pattern of 1 mm vertical lines at various speeds (100, 200, 300, 400 mm/s)
  3. Measure the offset between forward and reverse pass lines at each speed
  4. Enter the measured offset values for each speed in the table
  5. LightBurn automatically compensates by shifting the laser timing

Global Offset (Bi-directional Lettering Test)

If text appears doubled or shadowed on bi-directional fills:

  1. Create a grid of small text at 100 mm/s, 200 mm/s, 300 mm/s
  2. Measure the gap between forward and reverse strokes
  3. Enter the offset in Edit > Device Settings > Global Offset

Step 8: Backup and Restore Complete Configuration

To backup:

  1. Connect to the Ray5 in LightBurn
  2. Open Console, type $$ and press Enter
  3. Copy the complete parameter dump to a text file
  4. Save with a descriptive name: Ray5_GRBL_Optimized_2026-05-07.txt

To restore:

  1. Open your backup file
  2. For each line ($100=160.000, etc.), type the complete line into the console and press Enter
  3. Verify by running $$ again and comparing to your backup

Batch restore via macro:

In LightBurn, you can create a macro button that pastes all parameters at once. Go to Tools > Macros, create a new macro named Restore, paste your complete $$ output, and save. Clicking the macro restores all settings in seconds.

Step 9: Firmware Recovery - If the Flash Goes Wrong

If the controller becomes unresponsive after a bad flash:

  1. Power off the Ray5 completely.
  2. Disconnect USB.
  3. Press and hold the controller's reset button (small button on the LEKN-CZ board, may require removing the bottom cover).
  4. While holding reset, connect USB and power on.
  5. Release reset. The controller enters bootloader mode.
  6. Flash the known-good firmware using XLoader or Arduino IDE.
  7. After successful flash, restore parameters from backup.

Tips for Firmware Stability

Conclusion

The Longer Ray5 20W is capable of significantly better performance than its stock configuration suggests. By optimizing GRBL parameters for its specific hardware, calibrating laser power response, enabling limit switches, and compensating for high-speed scanning offsets, you transform the Ray5 from a stock laser into a precision instrument. Document your configuration, back up before changes, and tune incrementally. With optimized firmware, the Ray5 produces engraving quality that rivals machines costing three times as much.