Page 1 of 1

Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 5:42 am
by CADdy
Hi all,

I use UCCNC version 1.2115 with an UC400ETH to control a LED laser.

To switch the laser on and off I use the G-codes M3 and M5, the power is controlled with PWM and can be set between 0 and 100% with S0 to S100 . This works also so far quite well.

The real problem is that the laser is switched on at the start, for example of a line, to the specified power value and then the laser head accelerates to the speed defined in the G-code. So the laser already has its preset power at the start, even though the speed only starts moving at the acceleration desired in the axis settings. The same happens at the end of a movement. The laser is only switched off with M5 when the target point is reached.

The result is burned out holes at the beginning and at the end of a movement. The laser power would have to be controlled proportionally with the speed. This means that the power is increased depending on the current speed until the desired maximum value is reached. The same would have to happen during deceleration. Is there a possibility to define this in UCCNC?

I hope I have expressed myself in a reasonably understandable way. Would anyone have a tip for me?

Peter

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 6:59 am
by dezsoe
You should use the laser output instead of the spindle. The laser output is synchronized to the motions while the spindle is not. Also, you should use lead-in to accelerate. E.g.: you want to cut a line at half power from x0 to x10 then your code is:

Code: Select all
M3 (enable laser)
G0 X-5
F500
G1 X0 (-5 to 0: lead-in)
M10 Q128 (turn on the laser while moving)
G1 X10
M11 (turn off the laser)
M5 (disable laser)
M30

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 8:30 am
by CADdy
Hi dezsoe,

thank you for your answer. Is it this connector?

Laser1.png


What do I need to connect here on the hardware side? My laser module (from NeJe) has only three terminals: +12V, GND and PWM input.

I created my laser test with Inkscape and wrote it in G-code with the extension "J Tech Photonics Laser Tool". Should I possibly use Lightburn for G-code creation?

Peter

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 9:52 am
by dezsoe
Yes, that is the output for the PWM. If it starts on full power then you'll need to set it active low. The M3 relay output can be used to turn on the 12V for the laser (you may need to set some M3 delay to give time for the laser to start up). I don't use laser, so wait for someone who has experience in code generation.

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 11:46 am
by CADdy
thank you very much dezsoe, you have helped me a lot. The settings for the PWM pin I do not need then and can set them to "0" - right?

Laser2.png


But the settings for PWM frequency and duty remain?

After your code snippet I tested this manually via MDI and it worked fine. I will now edit my test file and try it out.

Peter

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 1:02 pm
by dezsoe
Yes, you have to zero out the spindle PWM output. The laser output PWM frequency is fixed, you cannot change it.

Re: Control Laser-power at start an ending

PostPosted: Tue Jun 13, 2023 2:01 pm
by CADdy
Thank you very much dezsoe!

Re: Control Laser-power at start an ending

PostPosted: Sun Nov 26, 2023 8:35 pm
by muxer
Will revive old topic,

so as I understand there is not native variable power (actual speed depended) laser output mode, however is this anyhow technically possible to achieve using plugins API? Just would like to check before spending more time on investigation.