Controlling Laser on/off with G-code

05 Apr 2021 22:30 #204974 by Limedodge
I have set up a a fiber laser engraver to be controlled by a 7i96 card using XY2-100 protocol

I have set up the HAL files to use M102 PXXX QXXX to input the desired power state (P) and frequency (Q) to the laser (and then latch it in). This can be changed at any time on the fly (sorta on the fly, takes time to run M102 command).

All other emergency stop, control settings, and logics have outputs and are ready to go

The last step in order to fire the laser is to send a high signal from an output pin. I currently have it wired to the spindle.0.on out pin, but.....

Here's the question: This galvo will raster VERY fast. I need to be able to turn the laser on/off quickly and in quick repetition. What's the best way to do this? Adding a M3 command before and M5 after each G1 line seems excessive and perhaps "time consuming". That is, the laser will turn on, galvos start moving, then comes to a stop, then turn off. Seems like communication time and line execution time could be an issue here. Creating a laser burn dwell at the start and finish Note: I haven't tried it yet to confirm, just a suspicion
N100 M2
N110 G1 X1 Y1
N120 M5
N130 G0 X1 Y1.1
N140 M2
N150 G1 X0 Y1.1
N160 M5

Perhaps using spindle speed as a binary input? ie SXXX (anything over 1) added to G1 lines and S0 added to the end of G0 moves. It's my understanding that the whole line will be read at the same time so the moves and spindle commands happen at the same time? Will spindle speed set to 0 keep the spindle.0.on pin false? Doesn't specifically mention this in the manual?
N100 G1 X1 Y1 S100
N110 G0 X1 Y1.1 S0
N120 G1 X0 Y1.1 S100

Use a pseudo axis? ie add U10.0 to each G1 line and wire to a "move" signal from that joint?
N100 G1 X1 Y1 U1
N110 G0 X1 Y1.1 
N120 G1 X0 Y1.1 U2

Has anyone else had and/or solved this problem before?

Please Log in or Create an account to join the conversation.

05 Apr 2021 22:43 - 05 Apr 2021 22:56 #204978 by PCW
I think a common way is to use the Z axis value
(and set a very high accel rate on Z)

Better yet would be to use something like hal-streamer
and read a file and synchronize it to motion in hal

Even better would be for me to finish the driver to the
datapainter module that allows high speed(faster than servo thread)
motion synchronized modulation of a video channel
Last edit: 05 Apr 2021 22:56 by PCW.

Please Log in or Create an account to join the conversation.

05 Apr 2021 23:10 #204986 by Limedodge
You're thinking wiring the pin to "". That seems like the only OUT BIT pin I can use. I'm assuming that's only active when commanded to move versus the joint.N.amp-enable-out which is True when the joint is "powered on".

I'll look into the hal.streamer avenue

To be clear. I already have a separate stream for the 1-600khz pulses. That stream is constant and sets the internal clock of the laser. The M102 command I built can adjust that frequency on whenever it needs to change (likely not very often).

I'm looking for an on/off switch at the start and end of "lasing" moves. Basically a binary spindle on/off command

Please Log in or Create an account to join the conversation.

06 Apr 2021 01:26 #205018 by PCW
no, for Z axis as was assuming to use the Z commanded position
(perhaps with the comparator function to turn it into a bit)

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum