Custom GCode execution before laser fire. LaserPro Autofocus

I’ll preface this saying that this is a very specific use case that applies only to the Sparkmaker LaserPro (that I know of). The LaserPro includes an autofocus sensor that can keep the laser head a constant distance from the material. The autofocus is activated using the following Gcode:

M206 S## ; Single point Autofocus. Moves Z down at the current position until it is the specifide distance (mm) away. For example, M206 S11 sets the focal distance to 11 mm. This only happens 1 time at time/position of code execution.

M207 S## ; this is realtime autofocusing. It constantly moves Z to maintain the set distance from the material. This is the code which pertains to the issue.

S0 disables the auto focusing.

Now the issue at hand is that in the current iteration of Lightburn, custom GCode commands can only be put at the very start or end. This means that if autofocus is enabled, the laser will move Z down at the home position, not over the material. This could cause several issues such as the machine trying to move down past the Z limit if the machine is propped up (which also seams to hang Lightburn) or if the head starts moves down, but is below the height of the material which causes it to run into the edge of the workpiece before it can move up.

The LaserPro software handles this by not issuing the autofocus command until the head is over the first point in the laser cut path. The head lowers, a short pause happens, then it starts lasering. This guarantees that the head is directly above the workpiece (assuming the user positioned/framed it correctly).

Is there a way to somehow incorporate this behavior into Lightburn? Have Gcode that gets sent right before the first laser fire command?

I know this is a niche case and specifically for this machine, but there may be some other useful cases of being able to execute code right before the laser starts firing (which should be over the material).

As a workaround, have you tried adding a move command there? There should be a spot in your work area that always has material on it, based on the way you usually put it on.

That sort of works. I added a movement command to the center of the bed before the autofocus command. This works if the object is in the middle of the bed, but there are still use cases where this isnt adequate.

1 Like

I’ve tried the same thing with my LaserPro - I put a move to the center of the workspace (directly over the tmbler in the rotary), then the autofocus command in the starting gcode. If the rotary is not enabled, autofocus works and cut proceeds. If I enable rotary, autofocus fails and the cut does not proceed. Any thoughts on how I can resolve this?

I set the focus point to 40,40. I set the distance on the “Move” window to 40 and move the laser to check if I’m unsure the focus will be on the work piece. If I need the focus somewhere else, I change it. I’ve had very bad luck with the auto focus. If the path of the laser goes anywhere near the edge of the work piece the engraving or cut will be ruined since the auto focus point is pretty far from the laser spot.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.