Need help with my home made GRBL laser etch

Hi! I am new here and I really need help. Not sure which sub forum to use, partly because I don’t know what part of my setup is failing. But let me explain the situation.

I have built a simple laser etch based on an Arduino Nano with a cheap china laser with a TTL board. It is running GRBL 1.1 and I am able to control the steppers via LaserWeb. However, I am not able to control the laser in any way. It feels like I have tried everything (I am sure I haven’t) but am not getting closer to a solution. These are the things I have tried:

  • Made a simple “blink” sketch on the Arduino which successfully managed to control the laser with PWM using analogWrite() on the same pin as GRBL is supposed to use (D11).
  • Tried all various PWM prescaling settings in cpu_map.h
  • Tried tons of settings for $30, $31, $32, including setting $30 and $31 to 0, which according to the documentation is supposed to disable the PWM and enable 100% output instead.
  • Tried to connect the laser driver to the spindle enable pin instead, which worked but in the opposite way (turns of when it is supposed to turn on and vice versa).

Do anyone have suggestions on what else to try? I am running out of ideas here. I am not even sure if I should look into GRBL setup or in LaserWeb. Am I missing some important settings in the Gcode section of the settings? I am using the default settings here except the PWM max is 255 (same as $30). All kind of help is deeply appreciated. Thank you!

Seems this is mainly a GRBL thing.

Did you use Laser Mode ($32=1)?
Did you use M3 or M4 to activate the laser?

In Laser Mode, the PWM only fires when the head is moving with one of the G1-G3 commands. With M3, the power is directly defined by the S value. With M4, the power is additionally adjusted to acceleration/deceleration.

For details about laser mode visit

1 Like

Yes, I am aware of that and I have tried it both with $32 on and off. I am running actual gcode generated by LaserWeb for a test pattern so I am not talking about the test mode here.

I should mention the reason I am using LaserWeb is that I am on a Mac and that is the only decent GRBL software I know about. But I figure I should try with something else just to eliminate that as a source of failure. Do you have any suggestions?

EDIT:
This is the gcode I am running. A square with a circle in it. Does it look fine to you?

G21         ; Set units to mm
G90         ; Absolute positioning

;
; Operation:    0
; Type:         Laser Cut
; Paths:        2
; Passes:       1
; Cut rate:     25000 mm/min
;


; Pass 0

; Pass 0 Path 0
G0 X24.10 Y24.10
G1 X0.18 Y24.10 S255.00 F25000
G1 X0.18 Y0.18
G1 X24.10 Y0.18
G1 X24.10 Y24.10
G1 X24.10 Y24.10

; Pass 0 Path 1
G0 X18.89 Y18.89
G1 X19.13 Y18.63 S255.00 F25000
G1 X19.37 Y18.36
G1 X19.60 Y18.09
G1 X19.82 Y17.80
G1 X20.02 Y17.51
G1 X20.22 Y17.21
G1 X20.40 Y16.91
G1 X20.58 Y16.60
G1 X20.74 Y16.28
G1 X20.88 Y15.95
G1 X21.02 Y15.62
G1 X21.15 Y15.29
G1 X21.26 Y14.95
G1 X21.36 Y14.61
G1 X21.44 Y14.26
G1 X21.51 Y13.91
G1 X21.57 Y13.56
G1 X21.62 Y13.21
G1 X21.65 Y12.85
G1 X21.67 Y12.49
G1 X21.68 Y12.14
G1 X21.67 Y11.78
G1 X21.65 Y11.42
G1 X21.62 Y11.07
G1 X21.57 Y10.71
G1 X21.51 Y10.36
G1 X21.44 Y10.01
G1 X21.36 Y9.67
G1 X21.26 Y9.32
G1 X21.15 Y8.98
G1 X21.02 Y8.65
G1 X20.88 Y8.32
G1 X20.74 Y8.00
G1 X20.58 Y7.68
G1 X20.40 Y7.36
G1 X20.22 Y7.06
G1 X20.02 Y6.76
G1 X19.82 Y6.47
G1 X19.60 Y6.19
G1 X19.37 Y5.91
G1 X19.13 Y5.65
G1 X18.89 Y5.39
G1 X18.63 Y5.14
G1 X18.36 Y4.90
G1 X18.09 Y4.67
G1 X17.80 Y4.46
G1 X17.51 Y4.25
G1 X17.21 Y4.06
G1 X16.91 Y3.87
G1 X16.60 Y3.70
G1 X16.28 Y3.54
G1 X15.95 Y3.39
G1 X15.62 Y3.25
G1 X15.29 Y3.13
G1 X14.95 Y3.02
G1 X14.61 Y2.92
G1 X14.26 Y2.83
G1 X13.91 Y2.76
G1 X13.56 Y2.70
G1 X13.21 Y2.65
G1 X12.85 Y2.62
G1 X12.49 Y2.60
G1 X12.14 Y2.59
G1 X11.78 Y2.60
G1 X11.42 Y2.62
G1 X11.07 Y2.65
G1 X10.71 Y2.70
G1 X10.36 Y2.76
G1 X10.01 Y2.83
G1 X9.67 Y2.92
G1 X9.32 Y3.02
G1 X8.98 Y3.13
G1 X8.65 Y3.25
G1 X8.32 Y3.39
G1 X8.00 Y3.54
G1 X7.68 Y3.70
G1 X7.36 Y3.87
G1 X7.06 Y4.06
G1 X6.76 Y4.25
G1 X6.47 Y4.46
G1 X6.19 Y4.67
G1 X5.91 Y4.90
G1 X5.65 Y5.14
G1 X5.39 Y5.39
G1 X5.14 Y5.65
G1 X4.90 Y5.91
G1 X4.67 Y6.19
G1 X4.46 Y6.47
G1 X4.25 Y6.76
G1 X4.06 Y7.06
G1 X3.87 Y7.36
G1 X3.70 Y7.68
G1 X3.54 Y8.00
G1 X3.39 Y8.32
G1 X3.25 Y8.65
G1 X3.13 Y8.98
G1 X3.02 Y9.32
G1 X2.92 Y9.67
G1 X2.83 Y10.01
G1 X2.76 Y10.36
G1 X2.70 Y10.71
G1 X2.65 Y11.07
G1 X2.62 Y11.42
G1 X2.60 Y11.78
G1 X2.59 Y12.14
G1 X2.60 Y12.49
G1 X2.62 Y12.85
G1 X2.65 Y13.21
G1 X2.70 Y13.56
G1 X2.76 Y13.91
G1 X2.83 Y14.26
G1 X2.92 Y14.61
G1 X3.02 Y14.95
G1 X3.13 Y15.29
G1 X3.25 Y15.62
G1 X3.39 Y15.95
G1 X3.54 Y16.28
G1 X3.70 Y16.60
G1 X3.87 Y16.91
G1 X4.06 Y17.21
G1 X4.25 Y17.51
G1 X4.46 Y17.80
G1 X4.67 Y18.09
G1 X4.90 Y18.36
G1 X5.14 Y18.63
G1 X5.39 Y18.89
G1 X5.65 Y19.13
G1 X5.91 Y19.37
G1 X6.19 Y19.60
G1 X6.47 Y19.82
G1 X6.76 Y20.02
G1 X7.06 Y20.22
G1 X7.36 Y20.40
G1 X7.68 Y20.58
G1 X8.00 Y20.74
G1 X8.32 Y20.88
G1 X8.65 Y21.02
G1 X8.98 Y21.15
G1 X9.32 Y21.26
G1 X9.67 Y21.36
G1 X10.01 Y21.44
G1 X10.36 Y21.51
G1 X10.71 Y21.57
G1 X11.07 Y21.62
G1 X11.42 Y21.65
G1 X11.78 Y21.67
G1 X12.14 Y21.68
G1 X12.49 Y21.67
G1 X12.85 Y21.65
G1 X13.21 Y21.62
G1 X13.56 Y21.57
G1 X13.91 Y21.51
G1 X14.26 Y21.44
G1 X14.61 Y21.36
G1 X14.95 Y21.26
G1 X15.29 Y21.15
G1 X15.62 Y21.02
G1 X15.95 Y20.88
G1 X16.28 Y20.74
G1 X16.60 Y20.58
G1 X16.91 Y20.40
G1 X17.21 Y20.22
G1 X17.51 Y20.02
G1 X17.80 Y19.82
G1 X18.09 Y19.60
G1 X18.36 Y19.37
G1 X18.63 Y19.13
G1 X18.89 Y18.89
M5          ; Switch tool offEnd

Lightburn is a good laser software that also works on Mac. It’s commercial, but you can test it for 30 days.

Please post your $$ settings and a picture of the laser driver.

Sure. Like I said, I have tried hundreds of settings but these are the ones I am using at the moment:

 $0=20
 $1=20
 $2=0
 $3=0
 $4=0
 $5=0
 $6=0
 $10=1
 $11=0.010
 $12=0.002
 $13=0
 $20=0
 $21=0
 $22=0
 $23=0
 $24=25.000
 $25=500.000
 $26=250
 $27=1.000
 $30=255
 $31=0
 $32=1
 $100=200.000
 $101=200.000
 $102=250.000
 $110=500.000
 $111=500.000
 $112=500.000
 $120=10.000
 $121=10.000
 $122=10.000
 $130=40.000
 $131=40.000
 $132=200.000

I will try Laserburn tonight then. Thanks for that suggestion. I attach a photo of the driver. The TTL input is in the lower right corner. As I said, this works fine when I send PWM via analogWrite().

Wow, I finally got it. I tried Laserburn and that worked instantly. When I compared the gcode from LaserWeb, I found that the LaserWeb code is missing the M4 command at the beginning. When I added that into the Gcode Start field of the settings, the LaserWeb code worked just as well. Thank you for helping out!

3 Likes

good job troubleshooting this problem. There are lots of parts to these little things from hardware, firmware, gcode-senders(LaserWeb,LightBurn,etc) and gcode itself. It looks like you’ve learned lots and will keep learning more. Well done.

2 Likes

Thank you for those words! Great with a bit of inspiration.

It sure is hard to troubleshoot something when there are so many unknown parameters but of course also very satisfying to nail it :slight_smile:

3 Likes

We don’t see enough people like you who dig in and start looking and learning. Looking at GRBL setting dumps and what the codes mean will pay off in the future when you’re doing or using something else. And there are so many GCodes there are multi-hour classes just on gcode. But it’s the life blood of CNC machinery so being willing to dig into it will go a long way for you.

2 Likes

I don’t use mac but linux and mac are often cross compile-able, all nix based and all platforms have python in one description or another.
I have found a lovely little script that works brilliantly and won’t cost a penny. GitHub - vidmo91/imgcode
And for sending the code I use GitHub - vlachoudis/bCNC: GRBL CNC command sender, autoleveler and g-code editor.
There is another I have used but it relies on too many dependencies for my liking
UGS
Chuck the Arduino away unless you really like it and go to AVRDUDE - AVR Downloader/UploaDEr
You won’t look back, all blazingly fast and take very little space on the system.
Pleased you got sorted though, good luck.

1 Like

Interesting! I will check those out. Thank you!