Full Lightburn Control Guide

That’s because Lightburn is trying to use $h to home, which is the command in GRBL. This does not work on the Snapmaker, as it runs Marlin. If you want to home the machine via Lightburn, either type G28 in the console, or make a macro button and name it home that contains G28.

The reason for the GRBL-M3 profile is to take advantage of the firmware modifications. Since all the movement code is understood properly by Marlin for all the inline functions. The $ codes are all GRBL lines to ask info from the machine such as size, buffer, etc. Since the Snapmaker doesn’t understand these, they’re simply ignored with an unknown command response. No harm, no foul.

An additional reason is if you use the “Snapmaker” profile, then it outputs gcode in the same way Luban does, and I’ve outlined the differences below.

No, Luban does not know anything about the firmware. The results using Luban will be exactly the same, as all it does is generate the gcode and send it to the machine. It’s a fundamental difference in how Luban and Lightburn generate dithered code.

Snapmaker’s code for grayscale looks like this;

M3 P55 S140
M3
G4 P5
M5
G1 X-95.94 Y95.76
M3
G4 P5
M5
G1 X-95.94 Y95.58
M3
G4 P5
M5
G1 X-95.94 Y95.40
M3
G4 P5
M5
G1 X-95.94 Y95.22
M3
G4 P5
M5

It sets the power via M3 P55 S140 (P is a %, so 55%, and redundantly puts S as well… which 140 is 55% of 255). Then it simply turns the laser off (M5), moves your density size on Y (0.18mm here), then turns the laser on (M3) and then waits (G4) the default 5ms (P5). Afterwards, it repeats for the next dot. This move/stop/wait/repeat cycle is why it takes FOREVER on stock firmware/using Luban’s method.

Here’s an example of Lightburn’s methods;
1 - Dither

M3
G1 X0.589Y-0.589F2000S0
G1 X0.128Y-0.128S204
G1 X0.254Y-0.254S0
G1 X0.128Y-0.128S204
G1 X0.589Y-0.589S0
G1 X0.594Y-0.339S0
G1 X-0.589Y0.589S0
G1 X-0.127Y0.127S204
G1 X-0.51Y0.51S0
G1 X-0.127Y0.127S204
G1 X-0.255Y0.255S0

The laser is simply turned on, no power given (that’s why I have an extra M3 S0 in the header to ENSURE the laser power is set at 0). Then while moving turns the laser on and off as needed for the dots. This change in power is denoted by the S# at the end of each line (S204 is 80% power). Thus it does clean, smooth sweeps back and forth with the laser pulsing on and off.

2 - Grayscale

M3
G1 X0.589Y-0.59F2000S0
G1 X0.128Y-0.127S33.8
G1 X0.127Y-0.127S32.3
G1 X0.589Y-0.59S0
G1 X0.467Y-0.212S0
G1 X-0.589Y0.589S0
G1 X-0.127Y0.128S30.1
G1 X-0.128Y0.127S33.1
G1 X-0.127Y0.128S34.6
G1 X-0.128Y0.127S36.1
G1 X-0.589Y0.589S0

Similar start to the dithering, but look at the S# parts, see how they vary? This is because it’s actually changing the power levels to increase/decrease the amount of burn/darkening of the material. You can set the min/max to represent white/black and then it calculates grayscale between those amounts (i.e. for maple plywood, I use *5% ~ 60%, so 5% power for pure white, 60% power for full black)

With stock firmware (inline disabled) if you tried to run either method Lightburn uses for GRBL, it would cause it to stop at every power change, making it stutter and over/underburn your engrave. The firmware I uploaded enables the inline feature so it moves back and forth smoothly, turning the laser on and off as it needs without stutter.

I am not, sorry. I’ve been learning Lightburn as I go and using my knowledge of running CNCs and writing gcode by hand to bend it to my will. Personally, while I’m glad to have the E-Stop, it’s rare that I ever actually need it. Usually only when I’m doing experiments/tests and I know there’s a chance, or on purpose if that’s what the test is. With how I’ve laid out above, I’ve got it to pretty much just click-n-go without worry. I’ve never had it fail unless I messed up (say, forgetting to input my material height).

As a general side-note for everyone. Keep in mind, I wrote this with the intent of it being an extension of my laser origin guide. While the parts of the guide here CAN be used if you intend to use the touchscreen/Luban and not using a hard set origin (such as eyeballing it into the corner). If you intend to run the code “as intended” (Snapmaker’s way) then you only need the safety M3 S0 in the header, and the M5 in the footer. All the rest is relevant ONLY to set your repeatable origin and material height. Or basically, the full automation parts. Just make your project in Lightburn, click save gcode, then load it into Luban.

2 Likes