Saving GRBL GCode Settings for importation in UCCNC

Good day to all fellow laser users, sorry for the lengthy post. I have been tackling a particular problem for a long while without any success in finding a solution even though I searched everywhere from this forum to YouTube.
Basic outline: my 130W laser is servo driven, using UCCNC software & hardware, so connecting directly to the machine is out of the question up to the recent Lightburn software 1.6.00. So I am transfering jobs by saving the GCode in Lightburn, using GRBL-M3 (the only one that currently works) and then using the UCCNC macro to import Lightburn exported GCode files.
I have managed to get it to cut lines as they should but am having problems when the laser changes direction at corners where the laser beam is punching through the material even though at a relativly low power (see attached in red circle). From what I have read in many sources this is attributed to laser staying too long in the same place until it changes direction and the solution to this is to ramp down the laser power as it approaches the corner. I have tried many many settings but with no results.
The laser power is responding to the original lightburn settings, as I can see the current meter varing between one setting to another.
With this in mind, I narrowed it down to either (most likely) the GRBL code isn’t giving the proper instuctions related to rampming down or else there may be a fine tuning setting in Lightburn which I am not seeing or not aware of.
I have also compared GRBL codes in attempt to understand but unfortunately am comletely hopeless in this area. I mean, I see the difference from one to another (like M10 Q255 command) but have no clue how to put things together in this case. I have even tried reading tutorials in GRBL settings and tried cutting something but again failed!
Can anyone here advise if I’m making sense and maybe direct me in the right direction?
Much appreciated.

I’m, not really a grbl person, so …

Does you controller handle varying power on a corner? I have a dsp (Ruida) and it handles all of this, not Lightburn…

I thought this was handled by the controller, not Lightburn.

Maybe @misken can advise or one of the Lightburn folks - @Rick - which versions of grbl and if it’s a Lightburn function to do this…

Do you focus at the surface or middle of the material? I’d suggest material center with this kind of thickness… you’re only getting <4mm on each side from center of focus.

How is your cnc pwm wired to the lps (laser power supply)?


This is the culprit. grbl-m3 does not support dynamic power. It’s an older profile for earlier grbl-versions. Dynamic power, which automatically adjusts power to speed, was introduced in 1.1f (or so). If you select grbl-m3, then there is always constant power.

You are saying that it was the only thing that worked. Which error did you get? That M4 is a not supported command? Did you enable the laser mode setting ($32), that is required in that case, I think.


Hi Jack,
Since it varies the power from one line type to another, I suppose it should handle varying power at corners, that is why I concluded the problem is with the GRBL code. At this point in time I focus on the surface to avoid the possibility of having debris entering the lens area, but then again I wouldnt exclude focusing in the middle. Yes PWM is wired to the LPS.

Hi Misken, yes GRBL-M3 is the only one that worked for me but as you said with constant power. When using 1.1f version the laser moves but doesn’t fire up. Have experimented with other GRBL codes and yes had errors but don’t remember what they were.
Also I do have a setting for M4 command but if this is what’s hindering me, am not sure to which pin I need to and port I need to set it - could it be the same pins of the PWM (picture below)?
Also I cannot enable $32 as the laser in not directly connected to Lightburn, this is why I save to GRBL GCode and then import it in UCCNC.

I have also been making comparisonsbetween the old (right) and new (left) versions of GRBL (as can be seen below) and have concluded that the code needs to have the M10 Q… command for the reason that both M3 and M4 are laser on / off switches as opposed to the M10 comand it is also a variable. Now my problem is how to incorporate, modify or create a GRBL Code that functions using the M10 Q… command.
Now that I am writing about this and to be completly honest, I havent tried using M4 instead of M3 as a setting. I will try setting pinouts of M3 on M4 export in the latest GRBL Code and see what happens. I dont have high hopes about the latter but its worth a try.

Sorry to step in.
M3(CW) and M4(CCW) on the CNC is different than on the laser M3(fixed power) and M4(dynamic power).
You could try a Custom GCode machine wit more options to adapt to your CNC, remember to set Lightburn S-value max to 255 because your controller only accept values between 0-255.
Check also if you have some setting for the PWM frequency as lot of laser modules usually work at 1000Hz.
Maybe you could create a UCCNC profile for laser and other for CNC so you don´t miss any settings.

Also you could read the following topic

You could try with your UCCNC laser plugin save the gcode of a small image and compare the output with the generated from Lightburn.
If the above solutions don’t work you have to save gcode and then edit with Notepad++ and auto replace commands per your machine requirements.

Hi Parsec, thanks for your input. Yes I do have separate profiles in UCCNC for both router and laser. Further more after having posted this and looking further into finding a solution, it dawned on me that the potential answer of setting M4 as the output instead of M3 was infront of me the whole time and you mentioning it affirmed that to me. As you clearly said M3 and M4 have different applications in laser and I was not looking at it that way and was simply dismissing it as using router CW / CCW as a means to only switch on laser!
At the moment I am bound inhouse due to a terrible cold I caught but as soon as it passes I’m gonna try it out.

1 Like

​Hello to all,

Ok, so after having recuperate​d​ from the cold, I’ve had another go with the M4 settings​ on UCCNC and also tried one of the standard available GRBL GCodes on LightBurn. I then made a simple cutting profile and ran it on the laser but all it did was follow the cutting line without firing the laser :frowning:. No errors just executed the movement.

I then knew I needed to get my head wrapped around the GRBL language to at least have a functional code. So after a substantial amount of research I made a custom code (as parsec also advised - using the Smoothie flavour for a start), ran the same cutting file and came up with the below mentioned Gcode. I haven’t run it yet as I would like to see what you guys think about it and maybe be able to advise what might be a better code to use or even the order in which things are executed.
I have read somwhere on the forum that executing M10 before M4 will set the head to fast syncronous mode … I am not sure if this makes sense but I think this will conflict with G1 command. For sure will be doing away with the M7 and M9 comands since I run the compressor continuously the keep a clean lens.
Thanks Guys.