How-To: Modify Marlin to control a laser with an SKR Pro

See Marlin documentation Configuring Marlin | Marlin Firmware

Do you have laser mode enabled in the firmware? The firmware supports a spindle mode where tool motion is paused for a moment after RPM changes to allow the bit to settle at its new speed. With a laser, this pause results in burned areas, and often areas where tool motion speed changes (e.g. slowing down for a corner) end up burned as well. Laser mode addresses these issues since laser intensity changes are, for all intents and purposes, immediate. The pauses on intensity changes are removed, and laser intensity is modified to match velocity/acceleration changes.

Setting a non-zero minimum power may also help, depending on your specific laser. Many will not fire at very low intensities, so you’d want the minimum to be where the laser actually does fire.

1 Like

this is a big content to read i will take time to read it and look in my firmware whit visual studio code to compare the setting
thanks i will give you news

THIS IS MY SETUP IN FIRMWARE ¸
#if ENABLED(SPINDLE_FEATURE)

//#define SPINDLE_CHANGE_DIR               // Enable if your spindle controller can change spindle direction

#define SPINDLE_CHANGE_DIR_STOP            // Enable if the spindle should stop before changing spin direction

#define SPINDLE_INVERT_DIR          false  // Set to "true" if the spin direction is reversed

#define SPINDLE_LASER_POWERUP_DELAY   5000 // (ms) Delay to allow the spindle/laser to come up to speed/power

#define SPINDLE_LASER_POWERDOWN_DELAY 5000 // (ms) Delay to allow the spindle to stop

/**

 * M3/M4 Power Equation

 *

 * Each tool uses different value ranges for speed / power control.

 * These parameters are used to convert between tool power units and PWM.

 *

 * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE

 * PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE

 */

#if ENABLED(SPINDLE_LASER_USE_PWM)

  #define SPEED_POWER_INTERCEPT       0    // (%) 0-100 i.e., Minimum power percentage

  #define SPEED_POWER_MIN          5000    // (RPM)

  #define SPEED_POWER_MAX         30000    // (RPM) SuperPID router controller 0 - 30,000 RPM

  #define SPEED_POWER_STARTUP     25000    // (RPM) M3/M4 speed/power default (with no arguments)

#endif

#else

#if ENABLED(SPINDLE_LASER_USE_PWM)

  #define SPEED_POWER_INTERCEPT       0    // (%) 0-100 i.e., Minimum power percentage

  #define SPEED_POWER_MIN             0    // (%) 0-100

  #define SPEED_POWER_MAX           100    // (%) 0-100

  #define SPEED_POWER_STARTUP        80    // (%) M3/M4 speed/power default (with no arguments)

#endif

// Define the minimum and maximum test pulse time values for a laser test fire function

#define LASER_TEST_PULSE_MIN           1   // Used with Laser Control Menu

#define LASER_TEST_PULSE_MAX         999   // Caution: Menu may not show more than 3 characters

Which (if either) of these do you have enabled?

//#define SPINDLE_FEATURE
//#define LASER_FEATURE

I would expect you’d want LASER_FEATURE enabled.

I should warn you, I’m not using Marlin myself, so I can’t guide you by looking at my owne working configuration. On grbl I can switch between laser and spindle without having to recompile the firmware.

yes exactly
//#define SPINDLE_FEATURE
#define LASER_FEATURE
i now marlin is not perfect for what i am trying to do but for now it is the only one i have !
i order a small machine from NEZE to do my photo engraving on tiled but it will take a while to come !
For other job my cnc is good whit laser only whit tiled is the problem !

NEJE Master 2S plus laser engraver & cutter with N40630 laser module- – NEJE.SHOP

Follow the steps in this thread, that should help you get things up and running:

1 Like

my version is the latest 2.0.9.2 you link is for 2.0.7.2 it is not the same !
the problem is not because it is not working i have 3 laser working on my cnc !
but it is only when i used lightburn and try to burn white tiled paint white the problem

If you read that thread I mention 2.0.9.2 in it…

1 Like

I used the pin PC( and the ground next to it for the M3 and inline command and an external power supply for the laser
so i used a 2 wires connect for the M3
i look again and i dont see any difference of the firmware fron the articlethe only difference could be the setup of the machine from lightburn is there anything i can change do you see the line in the picture









2 Likes

It sounds like your MPCNC and Marlin connections are working as expected, now its time to tune the Lightburn application’s settings. You may have better luck finding detailed Lightburn tuning advise on a Lightburn forum.

How closely does the finished image match what’s shown in the Lightburn editor window? Can you be specific about the defect in the output that you’re hoping to fix? I know some folks who would be overjoyed at that image.

If it is the vertical white lines, then I think you need to lower the “Line Interval” setting in your top image.

If elements of adjacent scan lines aren’t aligning properly, try turning off bidirectional scanning. This will ensure all lines draw in the same direction which tends to tune out artifacts due to physical backlash in the machine, but it does make the burn take longer as it has to return to the starting side after each line is burned.

1 Like

thank you

DId you found better LightBurn setting to avoid those vertical lines, and would you mind to share some screenshot if you resolve that issue ?

I added a laser to my mpcnc in January and have enjoyed playing around with it. I have made a handful of plaques and miscellaneous projects. I just threw together a rotary axis with spare parts but have not got that up and running yet. I have the SKR Pro 1.2 board running Marlin. I do not have dual endstops. Two questions:

  1. Can I attach the rotary axis to the E0, E1, or E2 axis? If so, do I need to make any changes in the firmware?
  2. Marlin shows that it has settings for controlling air assist. Is there a pin on the SKR Pro 1.2 where I can attach a relay that can be controlled with M7 or M8 commands using Lightburn?
    The code in Configuration_adv.h has the following beginning on line 3342.

//#define AIR_ASSIST // Air Assist control with G-codes M8-M9
#if ENABLED(AIR_ASSIST)
#define AIR_ASSIST_ACTIVE LOW // Active state on air assist pin
//#define AIR_ASSIST_PIN 44 // Override the default Air Assist pin
#endif

Any thoughts are greatly appreciated.

Hello there. I am trying to attach an attomstack m100 laser to my LR3 SKR PRO. This laser came with a 12v to 24v converter. I was thinking i should use fan O connected to the convertor? But i am not sure what input to connect it to. I have tried a few of the inputs from and cant control anything from the screen, i havent even attempted the test gcode yet. I want to fire it from the screen first nefore i move on to anything else.i am using the latest firmware.

Any help is appreciated.

That’s their new 20W, quad beam module. I’d love to hear how it works when you have it set up.

According to the link I found, it came with a power supply, so I assume you will be using their power supply. If so, the power supply plugs into the female barrel connector on this board. To connect to the SKR Pro, you can use Input B from this board. The TTL line goes PC9 on the SKR Pro, which is in the Extension 1 block. You can find a pinout diagram for the SKR Pro here. You will also need to connect the ground pin on the laser board to any ground on your SKR Pro, including the one adjacent to PC9.

If you want to power your laser from the same power supply as your MPCNC, the MPCNC power supply needs to be big enough to support both the MPCNC and the laser. As for connection, it is best to connect that power directly from where it enters your SKR Pro board to the screw terminals on the laser board.

2 Likes

I tried connecting through “input B”, and PC9, but i cant make it fire. Am i missing something in the firmware maybe? I thought the laser was enabled, based on the previous posts, but i dont know enough on this stuff to be able to identify if something is missing. Intried using the g1 codes and the m codes and nothing

Laser is enabled in the SKR Pro firmware. The laser stuff was overhauled in the latest version of Marlin. In order for inline codes in G0 and G1 to work, you must first send:

M3 I  

But straight M3/M5 g-codes work without needing this initial g-code string. As a start, I recommend carefully hooking up a multi-meter to PC9 and ground. Then you can send an M3 or an inline G0/G1 command and see if the voltage of the pin goes up. Note there is also a new feature in the latest version of the firmware where the laser pin will turn off if Marlin has not received a move command in 1s. These new features are in version 515. Things are simpler in 514 and below, but you don’t get the new laser code.

Anyway, if the pin voltage goes up, the issue will be in your laser hookup.

Edit: I also noticed that Input has two 2-pin connectors. To be on the safe side, use the pin closest to the TTL label for your PWM wire.

3 Likes

That thing is a beast!

Lots of inputs there, do you have a link to the manual or anything?

1 Like

Ok- quick Q for people already using a laser

Assuming everything is hooked up correctly to the skr pro1.2 (pin9 and ground, independent laser Power supply) and I’m using the latest updated software

And I have M03 l at the start

Is it really as simple as assigning an inline S## value to control the laser pwm?

Assume pwm range is 0-255, then 50% power would be S127

G01 x50 y150 f240 s127
G01 x100 y150 f240 s127

Will etch a 50mm line in X direction at 240mm/min at 50% power.

Is that really all there is?

That should do it. Make sure to drop an M5 as the last line just to be safe. I don’t think that is needed unless you have an enable pin, but I am not really sure, that is a guess.