GRBL Laser Mode $32 in Post Processor

This is a Vcarve post processor question.

I’m planning to use the J-tech no-z post processor for my laser. I looked it over and there is no $32=1 (Laser Mode) in that post processor. Can I treat “$32=1” as gcode and enter it into the startup section?

If that works, I could add $32=0 to my normal post-processor. That way I can never worry about setting it or resetting it. I can’t check the machine directly at the moment since it’s torn apart with the spindle upgrade project.

Yup.
Just put it in the Header section before any motion commands.
"$32 = 1"
or
"$32 = 0"

2 Likes

That’ll be great. Thanks

1 Like

@wb9tpg I’m interested in this as well, i can’t seem to figure out where to put the $32 = 1…i get a syntax error where ever i put it…where did you end up putting it?

%
“$32 = 1”
G90
G17
G20
G28 G91 Z0
G90

T2 M6
S18000 M3
G54
M7
G0 X2.5472 Y1.4003
Z0.6
Z0.2
G1 Z-0.25 F13.333
G0 Z0.2
X2.4682 Y1.5845
G1 Z-0.25 F13.333
G0 Z0.2
X2.4068 Y1.7279
G1 Z-0.25 F13.333
G0 Z0.2
X2.3431 Y1.8766
G1 Z-0.25 F13.333
G0 Z0.2
X2.2611 Y2.0679
G1 Z-0.25 F13.333
G0 Z0.2
Z0.6

M9
G28 G91 Z0
G90
G28 G91 X0 Y0
G90
“$32 = 0”
M30
%

What am i doing wrong?
Annotation (25)

I don’t know gcode at all, but I’m guessing it’s the quotes. It should probably be just $32=1

Thanks for the reply, @ctdodge. I have tried with and without quotes, with parenthesis, etc…still no success.

@neilferreri will probably chime in, but in the meantime could you try with the following format, just for the sake of experimenting (I don’t have access to VCarve just now but will try myself later today)

“[36][51][50][61][49]”

1 Like

@Julien, tried adding “[36][51][50][61][49]” but received an error, “Bad characters in gocode file”

Annotation (26)

(T2 D=0.0039 CR=0 - ZMIN=-0.6617 - flat end mill)
G90
G17
G20
G28 G91 Z0
G90

“[36][51][50][61][49]”

(Alignment)
T2 M6
S18000 M3
G54
M7
G0 X1.8659 Y1.9169
Z0.6
Z-0.0075
G1 Z-0.0871 F40
Y1.9171 Z-0.0874
Y1.9173 Z-0.0875
X1.8651 Y1.9328
X1.8627 Y1.948
X1.8588 Y1.9629
X1.8533 Y1.9774

Can you upload your post-processor file ? I’ll try it on my V-Carve install later today

@rub0t I’m not near a machine with any way to test, but the issue here most likely lies with Motion. $32=1 should work (I’d recommend adding a G4P0.25 dwell after that). Motion intercepts all commands and acts on them. There is no “syntax error” in GRBL. Try a different sender if you want to do this, or just send the Laser Mode command before the job.

1 Like

In the CM UI, Midi tab, for ‘directly sending GRBL’ you can prefix your command with a slash ‘/’. I wonder if it would ‘not interpret’ the $31= command if similarly prefixed in the post-processor output file?

ie: from the above

%
/$32=1
G90
G17
G20
G28 G91 Z0
G90

T2 M6
S18000 M3

Allright, a few tests:

I added the $32=1 line in the VCarve PP:

begin HEADER
 
"$32=1" 
"G17"
"G21"
"G90"
"G0[ZH]"
"M6 T1"
"G0[XH][YH][S]M3"

which generated the expected G-code for a random test cut I created :

$32=1
G17
G21
G90
G0Z20.3200
M6 T1
G0X0.0000Y0.0000S12000M3
G0X27.2063Y-32.4873Z3.0000
G1Z-1.0000F762.0
G1X-9.2937F2500.0
G1Y-28.4873
G1X27.2063
G1Y-24.4873
etc...

But then indeed Carbide Motion rejects the G-code file upon loading, reporting a Syntax error on the $32=1 line.

I then loaded the same G-code file in CNCjs, and it worked correctly (apart from the fact it displayed a weird “error 22: feedrate not set”, but it did not seem to have any impact, the air cut went fine and I was able to verify that $32 was indeed set to 1)

Conclusion: it seems CM does not allow for GRBL $ params to be modified from a G-code file.

I also tested adding the forward slash (which works when using the MDI tab, to tell CM to send the command straight through to GRBL), and the same Syntax Error is reported.

Not sure whether this behavior in CM is on purpose or not, maybe @robgrz can comment.

1 Like

@Julien If you have a chance, try adding a short dwell (G4P0.2) after the $32 command. The eeprom write takes time, albeit microseconds, and that can cause weird errors like what you saw.
Also, make sure you remember to set $32 back to zero or your spindle will do some weird stuff next carve.

1 Like

This is the very first thing I did after running the test, I made that mistake before :slight_smile:
Thanks for the dwell tip, makes sense.

Just tried putting $32=1 info my file, followed by the dwell you mentioned. CM complained of a syntax error, and I had to take the $32=1 back out again. I next typed /$32=1 into the MDI section, which did not complain. But after I started the run, CM turned the laser on, then popped up a dialog waiting for me to set the RPM to 255.
So is $32=1 working at all?

@erict I don’t think those with lasers use Motion.

CM does not like/support $ params modification from the Gcode file. On the other hand it won’t know if you manually changed $32, so that should stick (and then of course you have to manually switch it back to use the CNC mode again).

Two things here:

  • if you check the “has spindle control” box in CM settings, you should not get the RPM prompts anymore.
  • I suppose you set RPM in your design file to 255 as a mean to enable the laser at full power, which only make sense if your $30 is set at 255. With the default value of 1000, it will activate the laser at 1/4th the max power.

Then again as Neil said, few people use CM for lasering. Consider buying LightBurn software which is dedicated to using lasers, so there will be fewer hoops to jump through.

In case this comes up yet again (with a new crop of owners) Rob (the boss) said that no way will they ever support a laser on a Shapeoko.

You can look it up if you want to spend the time, but that’s the way I heard it. (:smiley: No, I’m not Mike Rowe!)

To be more precise, what he said what that they intentionally stayed away from selling laser modules (my interpretation : because the liability risk is not worth the extra business). This is subtly different from “you can’t use CM for a laser job”, but it does mean that there will probably not be much effort put in making CM more laser-friendly (again, my thoughts, I don’t know that for a fact)

1 Like