Author Topic: New Dynamic Laser Power feature in GRBL 1.1  (Read 9861 times)

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
New Dynamic Laser Power feature in GRBL 1.1
« on: October 27, 2016, 08:46:05 AM »
Hey guys, I just wanted to pass along some new info that was just given to me over the laserweb github repository.

Quote
@iceman1979 : Ok. I pushed Grbl's new dynamic laser power feature to the v1.1 repo. You'll need to uncomment the #define at the bottom of the config.h file to enable it. It's called LASER_CONSTANT_POWER_PER_RATE.

It's experimental, meaning that how it should behave hasn't been fully established or defined. So things may change, based on user feedback. One thing to look out for. The laser will remain off when the machine is not in motion, even though you enabled the laser with something like M3S1000. It'll only turn on, if it's in motion. I may change this to turn on to the minimum PWM output whenever enabled to help indicate that its on.

Feed rate overrides(FRO) do not alter the laser power/rate. Laser power will scale with FRO to keep it consistent. Useful if Grbl starts to stutter. You can slow down the job and the laser should keep burning the same. (There might be some slight variation due to nonlinearity in the laser output).

Spindle speed overrides(SSO) directly alter the laser power/rate. So it'll increase or decrease laser power and account for the power change, if the machine slows down.

With both FRO and SSO behavior set like this, you should be able to tune your job dynamically and in real-time, even if the laser power is nonlinear.

This was a feature that smoothieware had that the GRBL developers decided to add as well. The smoothie fan base seems to like this feature a lot and they say it helps with edge burn marks due to acceleration settings. Now, you can set your acceleration  to a nice comfortable level that won't shake your machine apart and not have to worry about edge burn marks.

I commented about us using low S values for focusing the laser so we'll see what they come up with.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5742
    • View Profile
    • T2Laser
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #1 on: October 27, 2016, 09:35:07 AM »
That looks interesting, does this doesn't fit on the Nano? (I guess I should just try it...)

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #2 on: October 27, 2016, 09:48:20 AM »
Not sure yet lol. I was going to try tonight when I got home. Sonny Jeon is looking at some gcode I posted from LW3 and asking questions about how developers are using G0 commands. He said he was under the assumption that G0 would be used for positioning the laser for the next line which is why he only removed the stop for G1-3 commands. He thought that we would implement over scan instead of sending a G0 right after the last laser on pixel.

Should we ask that all G commands remove the stop mechanism? Dynamic power may not help with laser modules that are not linear though. I know you said you pref not to do over scan.

Anything you want me to pass along to him?

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5742
    • View Profile
    • T2Laser
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #3 on: October 27, 2016, 10:16:05 AM »
I agree with Sonny, G0 would be a rapid move to position the laser.

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2739
  • Administrator
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #4 on: October 27, 2016, 10:29:06 AM »
John,

Can you ask him what Gcode Standard document he is writing to? It would be nice to know.

Paul has written the BCL Gcode Editor parser against this standard:
The NIST RS274NGC Interpreter - Version 3

And for G0 is says this:
3.5.1 Rapid Linear Motion G0
For rapid linear motion, program G0 X Y Z A B C, where all the axis words are
optional, except that at least one must be used. The G0 is optional if the current motion mode is
G0. This will produce coordinated linear motion to the destination point at the current traverse
rate (or slower if the machine will not go that fast). It is expected that cutting will not take place
when a G0 command is executing.
Admin -- Ralph -- support @ BenCutLaser dot us
https://www.dropbox.com/s/qv1qee2vb65785t/SetupBenCutLaser3.2a.zip?dl=0
BCL Paid license: $49.95
via Paypal to bclpp@primemail.com

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #5 on: October 27, 2016, 12:12:11 PM »
Will do!

Edit: Ok, I posted the question. We'll see what he says :)
« Last Edit: October 27, 2016, 12:21:16 PM by Agastar »

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #6 on: October 27, 2016, 12:44:36 PM »
@Zax, Sonny mentioned using over scan which I know you don't prefer so I asked if passing a G1 S0 command with the same coordinates as the last move, would help trick GRBL into not stoping for the next G0 move.

@Ralph, He also responded to your question in the same post.

Here was his response.
Quote
@iceman1979 : Actually, I'm not sure. That's a good question.

So, Grbl will allow both G1 and G0 to be set without requiring XYZ axis words. Meaning that they can be set without a motion involved. This isn't part of the LinuxCNC g-code standard, as you have pointed out, but it is very common on industrial machines. Grbl tries to follow the LinuxCNC g-code standard as closely as it can, but there are a couple instances where it deviates from their standard. Like this one. I'll write up a document or wiki page on all of the g-code descriptions after v1.1 goes to master.

Back to your question, I think you can trick Grbl into moving between G1 and G0 motions that have different spindle speeds without forcing a stop by inserting a G1 S0 command in between them. No XYZ axis words in the command. This would need to be placed whenever Grbl is transitioning between G1 and G0 or vice versa.

This trick doesn't resolve the problem with acceleration at lead-in and lead-out, because the machine has to slow down to reposition for the next pass. It only addresses how to smoothly transition over white space with a G0 within the same pass.

While this behavior is somewhat undefined, I don't intend on disallowing it, if it indeed works.

Hope that helps.

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2739
  • Administrator
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #7 on: October 27, 2016, 01:26:58 PM »
"Grbl will allow both G1 and G0 to be set without requiring XYZ axis words...<snip>This isn't part of the LinuxCNC g-code standard"

From the way I read it, in the LinuxCNC document, it is allowable:

"For rapid linear (straight line) motion, program G0 'axes', where all the axis words are optional."
Admin -- Ralph -- support @ BenCutLaser dot us
https://www.dropbox.com/s/qv1qee2vb65785t/SetupBenCutLaser3.2a.zip?dl=0
BCL Paid license: $49.95
via Paypal to bclpp@primemail.com

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #8 on: October 27, 2016, 01:46:16 PM »
Does the same hold true for G1?

beikeland

  • Guest
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #9 on: October 27, 2016, 01:52:24 PM »
This looks very promising! Slight burning of the entry points and some sharp corners is the only remaining issue I see now with running Grbl. Look forward to playing with this over the weekend!

Administrator

  • Administrator
  • Hero Member
  • *****
  • Posts: 2739
  • Administrator
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #10 on: October 27, 2016, 02:46:18 PM »
Does the same hold true for G1?

Yes:
"4. G1 Linear Move
G1 axes
For linear (straight line) motion at programed feed rate (for cutting or not), program G1 'axes', where all the axis words are optional. The G1 is optional if the current motion mode is G1. This will produce coordinated linear motion to the destination point at the current feed rate (or slower if the machine will not go that fast)."
Admin -- Ralph -- support @ BenCutLaser dot us
https://www.dropbox.com/s/qv1qee2vb65785t/SetupBenCutLaser3.2a.zip?dl=0
BCL Paid license: $49.95
via Paypal to bclpp@primemail.com

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5742
    • View Profile
    • T2Laser
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #11 on: October 27, 2016, 03:51:57 PM »
Sonny mentioned using over scan which I know you don't prefer...

No actually the opposite, I use over scan in most of my scanning algorithms but also use the S0 "trick" you mention. The original photo mode does more over scanning and uses it on the lead in and out.

I'm interested to use any advantages of Grbl 1.x but would like to keep backwards compatibility at least for a while.

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #12 on: October 27, 2016, 05:56:16 PM »
Oj, sorry I thought I had read that somewhere. I think this will work good then for our needs (as long as it still fits lol)

beikeland

  • Guest
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #13 on: October 27, 2016, 06:11:15 PM »
Oj, sorry I thought I had read that somewhere. I think this will work good then for our needs (as long as it still fits lol)
Code: [Select]
avrdude: reading input file "grbl.hex"
avrdude: writing flash (29734 bytes):

Writing | ################################################## | 100% 5.22s

avrdude: 29734 bytes of flash written
Just pulled Grbl 1.1d and enabled the #define LASER_CONSTANT_POWER_PER_RATE. Still fits, on an original Nano as well I would think, as its below 30k

(edit: If you enable #define USE_CLASSIC_GRBL_INTERFACE then the size increase to 31104, so that requires optiboot.)
« Last Edit: October 28, 2016, 04:53:20 AM by beikeland »

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: New Dynamic Laser Power feature in GRBL 1.1
« Reply #14 on: October 28, 2016, 05:03:29 AM »
Oh yeah, I forgot about the legacy mode not fitting anymore. Thanks for posting this.