Lightburn not turning on laser

Hey everyone-
I’m so close at finally getting this all working (I think). Hopefully you know what I’ve done wrong at this point.

I’m currently using the 515 version dual endstop firmware with a RAMPS 1.4 board. I got my laser wired up to PIN44 and have tested it with M42 P44 S128. The laser turns on and burns a small scorch in the test piece of wood I have below it. Different values for S*** vary the laser power as expected, so all of this should be working.

After the successful test I installed a trial of lightburn. Configured it to use Marlin FW, set the commands to Inline, added M3 I to the start GCODE (and M5 to the end). Connected it to the MPCNC and verified it connects. I drew a small circle on the screen and hit the Start button. The MPCNC moves in a circle as expected. Basically everything seems to work, except the laser doesn’t turn on.

I’m not sure what I’m missing at this point. Admittedly I’ve never used Lightburn before, so maybe there’s an option I need to set yet?

Any help you guys have would be very appreciated!

Your Lightburn settings look correct. And as far as I know, there are no other settings you are missing. My next step would be to change laser mode commands to M03/M05 and see if that makes a difference. And to not overlook the obvious, did you set the power level for the cut when you authored your circle? Another test is to save the g-code to a file and verify the M3 I is at the top of the file and that you are getting inline (assuming the setting is inline) commands.

1 Like

IIRC my pin 44 was a remapping of the fan control on RAMPS 1.4… thus M106/M107 should be the proper commands to control the laser?

1 Like

I just looked, and in Marlin version 515, pin 44 is not a remapping of the fan pin. A good thing to check out though.

Should sending M3 I cause the laser to turn on at all? I know there’s a 1000ms timeout that will turn it off, but should sending that command at least have it turn on momentarily? If so, then there appears to be a FW problem because when I send M3 I I get an “OK” response, but the laser does not turn on.

Here’s the output from the LB console. There are some errors about “M9”. Not sure what that is. You can see M3 I at the top and M5 at the bottom. Also you can see it sets the value as 255 which is 100%. I likely don’t need that much power to it but I set it to 100% for testing.

Starting stream
M3 I
G21
G90
M9
echo:Unknown command: “M9”
M05
G0 X10.925 Y8.905 F0
G1 X10.307 Y9.281 F6000 I S255
G1 X9.729 Y9.713
G1 X9.197 Y10.197
G1 X8.713 Y10.729
G1 X8.281 Y11.307
G1 X7.905 Y11.925
G1 X7.589 Y12.581
G1 X7.337 Y13.27
G1 X7.152 Y13.988
G1 X7.039 Y14.733
G1 X7 Y15.5
G1 X7.039 Y16.267
G1 X7.152 Y17.012
G1 X7.337 Y17.73
G1 X7.589 Y18.419
G1 X7.905 Y19.075
G1 X8.281 Y19.693
G1 X8.713 Y20.271
G1 X9.197 Y20.803
G1 X9.729 Y21.287
G1 X10.307 Y21.719
G1 X10.925 Y22.095
G1 X11.581 Y22.411
G1 X12.27 Y22.663
G1 X12.988 Y22.848
G1 X13.733 Y22.961
G1 X14.5 Y23
G1 X15.267 Y22.961
G1 X16.012 Y22.848
G1 X16.73 Y22.663
G1 X17.419 Y22.411
G1 X18.075 Y22.095
G1 X18.693 Y21.719
G1 X19.271 Y21.287
G1 X19.803 Y20.803
G1 X20.287 Y20.271
G1 X20.719 Y19.693
G1 X21.095 Y19.075
G1 X21.411 Y18.419
G1 X21.663 Y17.73
G1 X21.848 Y17.012
G1 X21.961 Y16.267
G1 X22 Y15.5
G1 X21.961 Y14.733
G1 X21.848 Y13.988
G1 X21.663 Y13.27
G1 X21.411 Y12.581
G1 X21.095 Y11.925
G1 X20.719 Y11.307
G1 X20.287 Y10.729
G1 X19.803 Y10.197
G1 X19.271 Y9.713
G1 X18.693 Y9.281
G1 X18.075 Y8.905
G1 X17.419 Y8.589
G1 X16.73 Y8.337
G1 X16.012 Y8.152
G1 X15.267 Y8.039
G1 X14.5 Y8
G1 X13.733 Y8.039
G1 X12.988 Y8.152
G1 X12.27 Y8.337
G1 X11.581 Y8.589
G1 X10.925 Y8.905
M9
echo:Unknown command: “M9”
M05
G90
G0 X0 Y0 F0
M5
Stream completed in 0:03

Your file looks fine. M9 turns the coolant off. I’ve never seen this in my Lightburn files, so it is likely it is being inserted by your g-code sender, and there is probably a setting you can use so that coolant commands are not sent. But this is not the root of your issue.

Did you try changing to using M03/M05 commands in Lightburn.

This is the top of a file I cut this morning. There are some extra things in the file, but as you can see, it is similar to your captured text.

; LightBurn 1.3.01
; Marlin device profile, current position
; Bounds: X-0.1 Y-0.1 to X519.45 Y286.32

;USER START SCRIPT
M203 X900 Y900
M204 P180 T180
M201 X200 Y200
M03 I 
M17
M106 P2 S255
M0 S1 Quick Pause
M0 Glasses? Height?
;USER START SCRIPT

G21
G91
; Cut @ 11 mm/sec, 100% power
M8
M05
G0 X-0.017 Y-0.098 F4200
; Layer C00 Pass 1 of 2
G1 X0.017 F660 I S255
G1 X508
G1 X0.035
G1 X0.047 Y0.043
G1 X0.018 Y0.058
G1 X-0.391 Y12.718
G1 X11.033 Y16.213
G1 X0.103 Y0.172

The one piece of this puzzle you have not tested is the connection between pin 44 and Marlin’s laser commands. The issue you are facing are not necessarily a Lightburn issue.

Yeah I tried all 3 settings and nothing turns the laser on. I’m convinced it has to be a firmware problem, but I haven’t changed anything in the firmware. The only thing I could think is if there’s something different in the dual endstop firmware?

Also does anyone know if sending M3 I should at least turn the laser on momentarily?

I keep asking about the M3 I command because it looks like at the beginning of the gcode an M5 is sent, I presume to turn it off. Since M3 I gets sent at the beginning followed almost immediately by an M5, I assume it should at least flicker (which doesn’t happen). I keep thinking if I just send M3 I from the console it should turn the laser on for 1 second then turn off with the safety features since nothing is moving. As mentioned sending M3 I just returns an “ok” message on the console but the laser doesn’t turn on.

Also, I did just figure out the weird M9 command. I had the air assist slider turned off (I don’t have any air assist hooked up yet). For some reason when that’s turned to off, the M9 command gets inserted.

For simplicity, I changed the design to a square and below is the gcode. It looks pretty much exactly like yours.

; LightBurn 1.3.01
; Marlin device profile, current position
; Bounds: X0 Y0 to X10 Y10

;USER START SCRIPT
M3 I
;USER START SCRIPT

G21
G91
; Cut @ 3000 mm/min, 100% power
M8
M05
G0 X0 Y0 F0
; Layer C00
G1 Y10 F3000 I S255
G1 X10
G1 Y-10
G1 X-10
M9
M05
; return to starting pos
G0 X0 Y0 F0

;USER END SCRIPT
M5
;USER END SCRIPT

Again, this is leading me to think there’s something not right in the firmware. As mentioned before, setting the value of pin 44 manually turns the laser on so I assume the firmware isn’t actually responding to M3 laser commands. My understanding is that the 515 RAMPS firmware should have the laser enabled. How can I verify this?

M3 I does not turn the laser on momentarily. It enables Marlin for inline laser commands.

If you did not put this line in the file, then lines like this that have inline ‘S’ commands…

G1 X10.307 Y9.281 F6000 I S255

…would not turn the laser on.

On the other hand, M3 S255 should turn the laser on briefly at full power…until the safety timeout cuts the laser. Or you might try something less powerful like M3 S5.

I spent a bit of time crawling through the code to see if I could spot a problem. I didn’t find anything. Note that I’m not aware of anyone who has laser working with a Ramps board on version 515. There may be lots of people, but I just haven’t seen anything on the forum that confirms the laser is working correctly in version 515 on Ramps. As a total shot in the dark, you might try putting the following two lines in the top of configuration.h and reflashing your board.

    #define SPINDLE_LASER_ENA_PIN             40  // Pullup or pulldown!
    #define SPINDLE_LASER_PWM_PIN             44  // Hardware PWM

OK, that’s got me curious…

Looking at this code block:

//
// M3/M4/M5 - Spindle/Laser Control
//
#if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN)
  #if NUM_SERVOS < 2                              // Use servo connector if possible
    #define SPINDLE_LASER_ENA_PIN              4  // Pullup or pulldown!
    #ifndef SPINDLE_LASER_PWM_PIN
      #define SPINDLE_LASER_PWM_PIN            6  // Hardware PWM
    #endif
    #define SPINDLE_DIR_PIN                    5
  #elif HAS_FREE_AUX2_PINS
    #define SPINDLE_LASER_ENA_PIN             40  // Pullup or pulldown!
    #define SPINDLE_LASER_PWM_PIN             44  // Hardware PWM
    #define SPINDLE_DIR_PIN                   65
  #else
    #error "No auto-assignable Spindle/Laser pins available."
  #endif
#endif

Could the issue be that I need to have the PWM pin plugged into pin 6, rather than pin 44 (I haven’t tested this yet)? I don’t know enough about what the if/else statements are doing. For the record I have a Dewalt 660 not a dedicated spindle, making me wonder if that could be what’s going on here.

SUCCESS!! That was it. I switched the PWM wire over to pin 6 instead of pin 44 and ran lightburn again. The laser fired! I still need to figure out feed rates, power, etc. and get my air assist hooked up but as of now it all works!

I’m sorta going on the assumption that if you have a dedicated spindle, that would normally be hooked up to pin 6? I saw a bunch of posts stating to hook the laser up to 44 but maybe they all had dedicated spindles?

Thank you again, Robert! Your posts lead me to start digging through the firmware code to figure this out. FWIW you now have confirmation that 515 ramps does indeed work with a laser. Thank you again!

1 Like

Glad you got that fixed. I was looking for just that sort of thing, and I missed it.

Hmmm, may have to try with my mpcnc. I have the Jl1 laser that was in another thread. But it has a small work area. I can do larger with my mpcnc :slight_smile:

1 Like

Has it tried taking the laser to dinner and a movie first? Maybe actually listen to what the laser is saying?

What? I waited until the problem was solved! Hmph… :pouting_cat: