Pierce delay M5

I am using lightburn to run a cnc plasma. Everything works great except the pierce delay (cut though enabled)

In grbl m3, at the end of the pierce delay an m5 command is sent immediately followed by an m3 command (for the tool path)
If i open the gcode and comment out the m5 the code everything runs flawlessly.
If i leave the m5 followed by m3, the output hiccups enough that the torch loses arc.

Why is there an m5 command at the end of a pierce delay that immediately turns back on and moves on a tool path?

Is there any way to dissable this m5 command so it is not in the code (other than doing it manually)?

Any suggestion on how to electrically damp out the hiccup so the relay that controls the torch stays on throughout the hiccup? (I have tried stacking 2 mechanical relays, but this didnt work)

You can tweak your Grbl-M3 build as needed for your custom application.

To my knowledge LightBurn isn’t supporting plasma cutters at this time. You might however hear encouraging words form many hobbyists (or LightBurn staff - or both) here.

I haven’t hooked up my plasma cutter to try it yet.
I also haven’t explored the GRBL-M3 source code much.

If I haven’t mixed contexts: M5 (as described in the link) is Spindle-off.

I see it in a test project after G0 but not adjacent to the pause/cut through delays.

I’m attempting to get the M5 to not show up by turning laser mode off ($32=0) and setting the minimum spindle speed higher than off $31=26 (S max and $30=255) in LightBurn but to no avail.

The M5 in my test appears adjacent to a G0 command which doesn’t seem unreasonable for laser software.

Would you mind posting a little bit of the G-code and your torch / pierce delay settings so I can see what you’re experiencing?

@bLouChip might have some constructive input as his is already up and running.

The reason it uses the M5 command is that it’s not certain whether you’ll be in variable power or constant power mode after the pierce (M3 or M4), so we turn off the beam, then back on again.

I could feasibly have it check to see if you’ll be following it with M3, and if so, suppress the M5 output.

1 Like

I don’t know the answer re. either question. I noticed this behavior some time ago when I was first seeking a solution to LB and plasma process. Yet another question is: why does ‘cut through’ have to be enabled in order to get the ‘start pause time’ (aka pierce delay) to occur after the M3 command ? without ‘cut through’, the delay is before the M3 command and I’m not understanding what purpose that serves other than perhaps XY stoppage/location mechanical dampening. LB support will have to answer.

In my use case of LB and plasma process, I use GRBL-M3 device mode as you do, but I don’t use the ‘start pause time’ attribute, nor do I use ‘cut through’. Rather, I post-process the LB laser g-code replacing M3 and M5 with my own code blocks. In the case of M3, to perform per-cut torch touch-off with job surface giving a precise (+/-.1mm) Initial Torch Height and Pierce Height, as well as including a Pierce Delay and a torch (Z) ramp down on the LB line lead-in; and in the case of M5 to perform a torch off delay and a torch (Z) safe retract before having LB move to next cut.

The post processor is a VIM editor script. download it from this thread.

I hope this helps, happy to field questions as needed.

Because otherwise you’re not in “cutting through” mode, you’re just adding a start delay to the beginning of the cut, which, as you suggest, allows settling time for mechanical resonance damping.

I’ve made the change to remove the M5 command when it will be immediately followed with M3 or M4.


I had this sequence in my g-code for a test square:
This may not be relevant but may I ask how immediately?

I’m looking at the lines in between M5 and M3 in my output and would think that the change should apply here as well - as a medium novice I’m uncertain.
Starting stream
G00 G17 G40 G21 G54
G0 X16Y15
G1 F100 S255
G4 P0.1
G1 S0
Layer C00
G1 Y32S204F3000

Is this change in LightBurn for just Grbl-M3 or all Grbl flavors?

For further reference i am using GRBL-M3 with laser mode/variable power off in the most simplified version:
Here are my cut settings:

The start pause is 1s, with cut through on so that it the torch can air purge, strike an arc and pierce.
The end pause is 4s without cut through; this enables the time to stop, air purge/cool and reset for the next arc. If less than 3 seconds is used the torch is unreliable in its ability to strike an arc.
In both groups of code (start and end pause) there is an ‘extra’ M5 command that im not sure why it would be necessary in ‘router mode’

The gcode for a simple square (with some movements removed) looks like this (my comments in green):

Technically, the m3 directly follows the m5 as a command, but the comment line of the path name (;Layer PLASMA PERIMETER/OUTER) is between the two and may screw up the coding to suppress the M5.

AWESOME CUSTOMER SERVICE!!! how do i get the updated code?
thank you

Even just a toggle to turn off ‘M5 after pierce’ in advanced settings would be awesome
thank you

It’s a process very few people are good at, called “waiting”. :slight_smile:

It’ll be included in the next release, but I have to double check that it’s doing the correct thing. I assumed you’d be using GRBL, not GRBL-M3.

Edit: This does work for GRBL, but does not work for GRBL-M3. Unfortunately GRBL when NOT in laser mode will automatically pause any time there’s a mode change, or a spindle rate change, so changing from G1 to G0 / G0 to G1 will cause a small hiccup, even if you haven’t changed anything else.

If you use the GRBL device in LightBurn, enable “laser mode” ($32=1) and set it to constant power in the cut setting, it will work as you expect.

Forgive me, as i am going to write this based on memory of things that i have tried/discovered in the process of getting the plasma running…

I am running GRBL on the arduino, but i found the following:

Lightburn in GRBL Laser Mode ($32=1). M4 is 100% as control output, M3 is not used at all and M5 is only used at the end of the Layer (irrelevant of number of cuts in that layer). I can not see what regulates the M4 PWM as it appears to be behind the scenes (based on speed); but this has a hiccup after the pierce delay as well
-This did not work

Lightburn in GRBL Laser Mode ($32=1), Constant power
M4 is still used, but M3 is also used in the pierce delay code block (not sure which command supercedes but seems like a conflict of interest) ; but i believe M4 cuts the power after the pierce delay behind the scenes
-this did not work

Lightburn in GRBL Router Mode ($32=0).
M4 always has a hiccup at the end of the pierce because the laser stops (slows down) and the PWM drops to 0

Lightburn in GRBL Router Mode ($32=0); Constant power
M3 and M4 are both used and the laser turns on as soon as you hit start (regardless of position and never stops until the final position
M5 is used at the end of the code (not the end of each cut or the end of each layer even).
This means that every single cut has to be on its own layer (an issue when you have multiple holes in within a single perimeter
-This works if each cut is its own layer and they are output one layer at a time- not a realistic work stream.

Lightburn in GRBL-M3 Laser Mode ($32=1) (constant power is not an option)
Again, turns on and does not turn off until the complete gcode (all layers) is run
(there is only one m5 issued during the output)

Lightburn in GRBL-M3 Router Mode ($32=0)
M3 and M5 commands are issued at all times. The good is that they are issued at each time during multiple cuts in each layer. The bad is they are ALSO added at the start and stop of each pause delay.

After going through all of the configurations the Lightburn GRBL-M3 Router Configuration ($32=0) is the closest code.
I still have to manually comment out the M5 after each pierce code block but the rest is 100%

Im not sure why you would ever need the M5 at the end of the start delay- if this could just be removed from the start delay code as a whole; i think it would be ok…
The reason being it will always enter into a tool path code because its the only way to get that code block added vs suppressed…

It looks like y’all update monthly(ish) and i just missed the big one and the little followup… I guess im going to be waiting a bit.
No problem; thank you regardless- i appreciate you taking the time.

In the normal GRBL device, with constant power enabled on the cut setting, the output should work.
There’s a single M4 at the start, but the rest looks correct:

; LightBurn 1.2.00
; GRBL device profile, absolute coords
; Bounds: X35 Y83 to X93 Y99
G00 G17 G40 G21 G54
; Cut @ 6000 mm/min, 100% power
G0 X58Y83
G1 F100 S1000
G4 P1
G1 S0
; Layer C00
G1 X35S1000F6000
G1 Y99
G1 X58
G1 Y83
G0 X93Y86
G1 F100 S1000
G4 P1
G1 S0
G1 X76S1000F6000
G1 Y98
G1 X93
G1 Y86
G1 S0
; return to user-defined finish pos
G0 X0 Y0

That’s two rectangles, run with a 1000ms cut through at 100%.

It might still blip a little, because it flips to G0, then back to G1 again. The output could be made cleaner, but it’ll take a decent amount of work.

Thank you very much.
It looks like in the main toolpath code you moved the M3 up a line before the layer name/description:
“; Layer C00”
Simple solution; i like it
I will try to run this code tonight and see what the outcome is.

I think i found an error in this code…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.