Export .nc file for a CNC2-5040 with a GRBL1.1 2-axis control board

LightBurn doesn’t emit spaces in the GCode (it’s not required by the standard). If you draw a simple square, save the gcode, and add spaces does it work?

No it doesn’t.

here is Lightburn code
"
; LightBurn 0.9.14
; GRBL device profile, absolute coords
; Bounds: X11 Y9 to X48 Y41
G00 G17 G40 G21 G54
G90
M4
; Cut @ 20 mm/sec, 100% power
M8
G0 X11 Y9
G1 Y41 S1000 F1200
G1 X48
G1 Y9
G1 X11
M9
G1 S0
M5
G90
; return to user-defined finish pos
G0 X0 Y0
M2
"

LaserGRBL code (it works fine)
"M5
G0X8.09Y-81.96
M3 S1000
G1X45.09F200
Y-113.96
X8.09
Y-81.96
M5 "

The only big difference I see is the comments. Does it work if you remove them?

It doesn’t change anything.
I added the comments to the GRBL code generated by LaserGRBL and it works fine.
I also to modify the first lignes of code but nothing works.

I can’t spedn too long on it right now, so I going to leave it for now.
I will keep you updated if I find a solution.
It’s frustrating because it works if I use the USB cable…

Thanks for your help

regards

Gael

LaserGRBL is using the M3 (constant power) command, instead of M4 (variable power), it does not have the M8 command (air assist on), M9 (air assist off), the absolute coords setting (G90), the units setting (G21), or G17 and G54.

Any of those could be the problem.

it does seem strange that it works from USB but not when loaded from a file. I can’t imagine Lightburn doing anything differently with a USB stream and a file IO stream so maybe it is on your controller side.

It definitely is - I recall a similar conversation with someone else about this and their offline grbl controller having similar issues. I’ll have to see if I can find that thread.

Doesn’t appear there was a resolution there either.

Any likelihood it’s a /r or /r/n issue with the file parser?

Feasible, yeah, but I don’t have one of these to fuss with it.

Can you send me the file you are using, ie the one which is exported from Lightburn and saved to the uSD and doesn’t work?

I’m wondering if something didn’t convert your file when it was saved so that each line of g-code has a different line ending char than when it is sent over USB.

Hi Doug, thanks for your feedback.
I saved again the files :

  • file “test square GRBL.nc”, generated by LightBurn, works perfectly fine when my machine is linked via USB but doesn’t work when saved on a SD card.
  • file “test square GRBL M3.nc”, generated by LightBurn Same file as the one before expect I used a GRBL M3 machine on Lightburn.
  • file “test square laser GRBL.nc” file generated by Lasergrbl, works perfectly fine via USB or save on SD disc (except that I had a M2 fonction at the end, otherwise the laser doesn’t stop at the end;)

Thanks for your help

By the way, I can’t upload any files on this blog because I am a new member. I will copy/paste them below.

(PS : I haven’t had time in the pasts days to work on it)

1/ file “test square GRBL.nc”
; LightBurn 0.9.14
; GRBL device profile, absolute coords
; Bounds: X11 Y11 to X86 Y60
G00 G17 G40 G21 G54
G90
M4
; Cut @ 200 mm/sec, 50% power
M8
G0X11Y11
G1Y60S500F12000
G1X86
G1Y11
G1X11
M9
G1S0
M5
G90
; return to user-defined finish pos
G0 X0 Y0
M2

2/ file “test square GRBL M3.nc”
; LightBurn 0.9.14
; GRBL-M3 (1.1e or earlier) device profile, absolute coords
; Bounds: X11 Y11 to X86 Y60
G00 G17 G40 G21 G54
G90
; Cut @ 200 mm/sec, 50% power
M8
M5
G0X11Y11
M3
G1Y60S127.5F12000
G1X86
G1Y11
G1X11
M5
M9
G1S0
G90
; return to user-defined finish pos
G0 X0 Y0
M2

3/ file “test square laser GRBL.nc”
M5
G0X8.09Y-81.96
M3 S1000
G1X45.09F200
Y-113.96
X8.09
Y-81.96
M5

Background; there is a piece of software on your machine which takes a text string" G0 X27 Y18" and converts that to commands to move the motors. Let’s call that GRBL-basic.

GRBL-basic needs to know when that text string ends(End of Line-EOL) and another text string begins. So there are invisible codes put at the end of those text strings and are used for this purpose. Often they are either a carriage return char(CR), a linefeed character(LF) and sometimes both(CR/LF).

I am wondering if the EOL character used in the USB stream of text strings is different from the EOL character on the text file saved and put onto the uSD card. If you are using Windows Microsoft has done all kinds of things to try and guess at what you want to do. Like when you create a file called testing.conf and the file saved is really testing.conf.txt but they only show you “testing.conf” in the file browser(used to be called Explorer but who knows now). Software looking for a file called test.conf does not find one because there is only testing.conf.txt So I wonder if something changed the end of line(EOL) characters when Lightburn exported the G-Code to a file and now your GRBL-basic does not understand the G-Code.

That is why I was asking for the file, not a copy of the pasted GCode but the actual file. Copied off the uSD card would be best. I would even recommend you look at the number of bytes(size of the files) between the one saved to your computer by Lightburn and the size of the file on the uSD card.

GRBL-basic just works on those text strings and to get the strings to it there are 2 software modules, one reads from the USB connection and sends those to GRBL-basic and the other reads from a file on the uSD card and sends the text strings to GRBL-basic. So you see why this is a really strange problem…

Hi Doug,

Thanks for your feedback.

I checked the size of the files.
LaserGRBL file is 77 octets and Lightburn file is 253 octets.
There are no differences between the file on my computer or on my SD card.

I uploaded the files online : https://drive.google.com/drive/folders/14jOZsmvG_45olRmDUdVTLfoZBnXJ8luN?usp=sharing

Thanks again for your help.

Regards

Gael

again, the LaserGRBL file is of no use IMO. You need to concentrate on the LightBurn file as that is the one which works over USB but does not work when saved and loaded via SD file.
You need to look at the Lightburn saved file on your computer and look at the same gcode file as saved onto the uSD card. they need to be exactly the same file size at the very least.

I tried to get to the gdrive link but it’s not public nor shared such that I don’t need permission to access.

Sorry.
I thought I shared the g drive.
Please find an updated link : https://drive.google.com/folderview?id=14jOZsmvG_45olRmDUdVTLfoZBnXJ8luN

Thanks

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