# Laser module edge burn

**URL:** <https://forum.snapmaker.com/t/laser-module-edge-burn/21578>\
**Category:** Snapmaker 2.0 (3-in-1)\
**Created:** [October 23, 2021, 11:16pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578 "2021-10-23T23:16:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lennard](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lennard](https://forum.snapmaker.com/u/Lennard)\
**Post date:** [October 23, 2021, 11:16pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/1 "2021-10-23T23:16:11Z")

</div>

Hi,  
I use the Sm 2.0 with the 16mW laser module.  
I was engraving some wood veneer when I found out that the machine has to stop every time when powering off the laser. This happens when I use the laser in line mode for engraving. This leads to a more burned edge than the rest of the engraved line. With thin wooden veneer it burns through the wood and makes it very brittle, although the rest of the piece is only lightly scorched.  
Is there a way to avoid these stops ? That the laser head moves continuously ?  
Thanks for any suggestions.

Cheers  
Lennard

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [October 24, 2021, 4:49pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/2 "2021-10-24T16:49:43Z")

</div>

I have a PR in GitHub to fix that behavior, go show support on that please. It allows the laser power to be changed without stopping, and if it does stop it scales the power down as it slows down to avoid edge burning.

> <https://github.com/Snapmaker/Snapmaker2-Controller/pull/153>
>
> This pull request adds a new feature: Laser Inline Power. This greatly enhances …job completion time and quality for many types of jobs.
> 
> This pull request implements a feature from Marlin that was added to Marlin after Snapmaker forked. This addition is based on the work contained in this pull: https://github.com/MarlinFirmware/Marlin/pull/15335. Inline laser power is also a standard feature on GRBL firmware, another common laser cutter firmware.
> 
> \### Summary of New Features
> \- Enables optional use of inline power control by using a new I parameter on \`M3\`-\`M5\` in the form of \`M3 Pxx I\` (https://marlinfw.org/docs/gcode/M003.html)
> \- Increases compatibility by adding traditional power specified with the 0-255 S parameter in form of \`M3 Sxx\`
> \- Adds optional new parameter \`Sxx\` and \`Pxx\` to \`G0\`-\`G3\` movement commands to move with inline laser power specified in the form of \`G1 Yxx Pxx\`. (https://marlinfw.org/docs/gcode/G000-G001.html)
> \- A \`G28\` home command disables the laser for enhanced safety.
> \- Increases compatibility by adding traditional power specified with the 0-255 S parameter in form of \`M3 Sxx\`
> 
> \### Additional Changes
> \- A \`G28\` home command disables the laser for enhanced safety.
> \- Modified how the fan and power limits are controlled in \`toolhead\_laser.cpp\` to accommodate calls from within the stepper ISR by not triggering CAN communications within the ISR.
> \- Removes handler for unsupported air assist / coolant controls so that they return the standard unknown gcode handler so as to properly communicate to controlling software that air assist is unavailable.
> 
> When not enabling laser inline power the machine behaves the same as previous firmware, with the exception of the change made to \`G28\`.
> 
> \### Description of Laser Inline Power Behavior
> When enabled by using the \`I\` parameter laser control is moved into the planner and motion control modules to allow for smooth power changes.
> 
> \*\*First a review of previous laser power control:\*\*
> The \`M3\` command first calls \`planner.synchronize();\` which waits for all motion to complete. The machine decelerates and comes to a stop, then the laser power is changes, and then the machine accelerates to continue. Each deceleration/acceleration results in additional dwell that affects the accuracy of dwell timing, resulting in a slightly darker than intended laser burn. This is most pronounced when using continuously variable power in software like Lightburn (Lightburn calls this 'grayscale' mode, which is not dithered).
> 
> \*\*New behavior of laser inline power\*\*
> Control of the laser power has been moved into the planner and stepper ISR. The planner adds the requested power onto the motion block. As the blocks are executed in the stepper ISR the laser power is scaled with acceleration trapezoid to eliminate darkening caused by the machine moving at less than the commanded speed with the full laser power.
> !\[image\](https://user-images.githubusercontent.com/7025732/137256766-a3f7e4df-7c1a-4672-8c68-fe8c84da3362.png)
> 
> As the laser power is being controlled via the planner the \`planner.synchronize();\` is not necessary which allows the machine to use optimized exit and entry velocities similar to 3D printing.
> 
> \*\*Comparison between old and new behavior\*\*
> Here is a sample from a job using grayscale mode from Lightburn without laser inline power. Each concentric circle on the left and vertical line on the right is where the laser power changed, resulting in a pause as the motion came to a stop and resumed.
> !\[image\](https://user-images.githubusercontent.com/7025732/137254443-7a224ea0-2bff-4c1b-a137-e5d9faa247bc.png)
> 
> By enabling laser inline power and eliminating harmful motion pauses the job completes approximately 2x faster and is of higher quality.
> !\[image\](https://user-images.githubusercontent.com/7025732/137254610-1fed1b8b-1417-4d60-8306-83c929706be4.png)
> 
> When Lightburn or other software is configured to use inline power it generates gcode similar to the following:
> \`\`\`text
> G1 X0.3 S131.3
> G1 X0.7 S130.1
> G1 X0.1 S129.5
> G1 X0.8 S128.9
> \`\`\`

---

<div class="post-metadata">

**Author:** ![Lennard](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lennard](https://forum.snapmaker.com/u/Lennard)\
**Post date:** [October 25, 2021, 7:17pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/3 "2021-10-25T19:17:24Z")

</div>

That’s just amazing. But I don’t quite understand how I integrate your changes.  
Is this change for Lightburn or for Luban ? I’m new to cutting and engraving with a laser and even newer for adaptations of published software and modding.  
can you perhaps help me a bit ?  
Thx  
Lennard

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [October 25, 2021, 7:27pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/4 "2021-10-25T19:27:46Z")

</div>

> [@Lennard](#):
>
> Is this change for Lightburn or for Luban ?

Unfortunately there’s multiple systems working together here. This change is for the main controller firmware (the thing all the wires run into)

To use this you can use Lightburn and Luban, but the process for each is different. Rather than explaining both in detail maybe share what you want to use?

Lightburn can generate gcode that uses that change natively. Luban would require doing some find and replace in a text editor.

---

<div class="post-metadata">

**Author:** ![Lennard](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lennard](https://forum.snapmaker.com/u/Lennard)\
**Post date:** [October 25, 2021, 8:13pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/5 "2021-10-25T20:13:33Z")

</div>

So I’ve never used Lightburn before. That’s why I’m asking, and I would be so thankful if you can walk me through 🙂 Also I like the camera option in the Luban software for positioning.

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [October 25, 2021, 8:47pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/6 "2021-10-25T20:47:52Z")

</div>

This is to get it connected to the Snapmaker without the firmware modification I made. It’s a bit of a learning curve as it’s different than Luban.

> [@Lightburn Device Flavor - "Snapmaker", not "Marlin"](https://forum.snapmaker.com/t/lightburn-device-flavor-snapmaker-not-marlin/10626):
>
> EDIT: There’s a much easier way to do what I was trying to do, and that would be properly configure Lightburn, ha. Leaving the post up for posterity with the newer instructions A new Lightburn device needs to be created using the Snapmaker language variant. When I originally set it up I chose “Marlin” instead of “Snapmaker”. Lightburn correctly generates the required S and P parameters when using a “Snapmaker” type device. [image]

---

<div class="post-metadata">

**Author:** ![Lennard](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lennard](https://forum.snapmaker.com/u/Lennard)\
**Post date:** [October 25, 2021, 9:19pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/7 "2021-10-25T21:19:36Z")

</div>

Maybe I should have expressed myself more clearly:  
I’d like to use the Luban software because I’m already familiar with it and love the camera option. So I want the modification done for Luban. That’s entirely my fault, my apology. Sorry for the inconvenience but later maybe also helpful 🙂

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [October 25, 2021, 9:33pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/8 "2021-10-25T21:33:45Z")

</div>

Oh, yea. In that case with the Luban output files you’ll have to post process them in something like Notepad++.

It would probably be most simple to show you on a file you are already familiar with. Can you zip into a .zip file and then upload a .nc gcode file?

---

<div class="post-metadata">

**Author:** ![Lennard](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lennard](https://forum.snapmaker.com/u/Lennard)\
**Post date:** [October 27, 2021, 12:58pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/9 "2021-10-27T12:58:16Z")

</div>

[Manhattan\_template.zip](https://forum.snapmaker.com/uploads/short-url/b0To02SfRaYDRnAcxx9AL6sVvKi.zip) (287.3 KB)  
like this ? It should be a Manhattan map in B&W

---

<div class="post-metadata">

**Author:** ![rustyssjones](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rustyssjones](https://forum.snapmaker.com/u/rustyssjones)\
**Post date:** [November 27, 2021, 8:46am UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/10 "2021-11-27T08:46:20Z")

</div>

Hey Brent,  
We talked about this issue a year ago. Inline-power modulation in the newer marlin versions.

Im not sure where SM’s firmware is at as far as your PR.

Reading the comments is sounds like it has been implemented and will work with a lightburn file utilizing a GrayScale method? Just not from Luban?

Or are we still waiting for a Firmware update?

Thanks again for all your contributions.

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [November 27, 2021, 3:50pm UTC](https://forum.snapmaker.com/t/laser-module-edge-burn/21578/11 "2021-11-27T15:50:20Z")

</div>

They have not yet merged it, but I have a build based on the latest released firmware.

Still only works with Lightburn for the speedup, Luban doesn’t take advantage.
